DRAKON-AutoHotkey: Visual programming with AutoHotkey

Post your working scripts, libraries and tools
vasili111
Posts: 696
Joined: 21 Jan 2014, 02:04
Location: Georgia

DRAKON-AutoHotkey: Visual programming with AutoHotkey

28 Mar 2014, 06:37

DRAKON-AutoHotkey: Visual programming with AutoHotkey




What is DRAKON
DRAKON is a is an algorithmic visual programming system for making complex and at the same time easy to understand algorithms. DRAKON is made for easy understanding for humans, not machines. DRAKON is used for programming software (including programming software for various space projects). Also DRAKON is used in medicine, law, business processes and in other non-programming related fields.


Why DRAKON is better then any other visual programming solutions?
In DRAKON clarity is above all. DRAKON is made as much ergonomic as possible, as much human readable as possible. DRAKON is very powerful and easy way for making complex algorithms. DRAKON rules for creating diagrams are cognitively optimized for easy comprehension, making it a tool for intelligence augmentation.
Some facts about DRAKON:
  • No line intersections. You will never find in DRAKON diagram two or more lines intersecting each other! Not seen in other diagramming systems!
  • Silhouette structure. It allows to break one diagram in to several logical parts. Not seen in other diagramming systems!
  • No slanting or curved lines. Only straight lines with right angles.
  • Icons are placed only on vertical lines.
  • Branching is done in a simple, visible and consistent way.
  • Each diagram has one entry and one exit.


History of DRAKON
Spoiler



What is DRAKON-AutoHotkey?
DRAKON-AutoHotkey is a hybrid visual programming language which consists of visual part of DRAKON and textual part of AutoHotkey. You can make diagrams in DRAKON and use AutoHotkey code in icons of that diagram.


More about DRAKON here:
http://drakon-editor.sourceforge.net/DRAKON.pdf
http://drakon-editor.sourceforge.net/language.html
http://en.wikipedia.org/wiki/DRAKON


What is DRAKON Editor?
DRAKON Editor is free, open source and multiplatform tool for creating DRAKON diagrams and generating code from them. In most part DRAKON Editor is developed using DRAKON system. There are several software for creating DRAKON diagrams. Currently generation of AutoHotkey code from DRAKON diagrams is possible only with DRAKON Editor. DRAKON Editor main developer is Stepan Mitkin. AutoHotkey code generator for DRAKON Editor is created by me.

Warning: At the moment code generation for AutoHotkey is on beta stage of development and some details is subject to change!

DRAKON Editor also supports code generation for other programming languages: Java, Processing.org, D, C#, C/C++ (with Qt support), Python, Tcl, Javascript, Lua, Erlang and Verilog.

Homepage of DRAKON Editor: http://drakon-editor.sourceforge.net/
GitHub of DRAKON Editor: http://github.com/stepan-mitkin/drakon_editor/


How to install DRAKON Editor:
1. Download and install latest version of ActiveTcl Free version from here: http://www.activestate.com/activetcl
2. Download DRAKON Editor from http://drakon-editor.sourceforge.net/editor.html#downloads and unpack in any location.
3. Double click drakon_editor.tcl file (is located in DRAKON Editor folder) to launch DRAKON Editor.


Documentations and examples for DRAKON-AutoHotkey:
Documentations for using DRAKON-AutoHotkey are located in docs\AutoHotkey folder. Read it before using AutoHotkey! If you read old version of documentation from attachment of this post then you need to read documentation from current version of DRAKON Editor, because there are substantial changes in a new AutoHotkey code generator.

Examples of DRAKON-AutoHotkey are located in examples\AutoHotkey


Known bugs:
There is no working Foreach loop in AutoHotkey code generator. Don't try to use it until it officially added to prevent unexpected behaviour! I mean the Foreach loop of DRAKON here, not the Foreach loops of AutoHotkey!



The main thread of DRAKON-AutoHotkey is this current thread. But there is also another thread about DRAKON-AutoHotkey: http://www.autohotkey.com/board/topic/1 ... utohotkey/


Please give me your feedback about AutoHotkey code generation. What you think about it? What you think need to be changed? What you think need to be added? Is there any bugs?

Ask any questions you want related to DRAKON, using DRAKON Editor and AutoHotkey code generation in current thread. I will be glad to help you as much as I can.




Don't Use AutoHotkey code generator and documentation from attachment of this post! They are outdated and are here only if you have diagrams that need that version of code generator!
To use this old version of code generator:
1. Download and install latest version of ActiveTcl Free version from here: http://www.activestate.com/activetcl
2. Download DRAKON Editor 1.22 from here: http://sourceforge.net/projects/drakon-editor/files/ . Unpack anywhere you want.
3. Download AutoHotkey code generator.zip from the attachment and unpack it to \generators folder of DRAKON Editor.
Attachments
Documentation.zip
(115.69 KiB) Downloaded 290 times
AutoHotkey code generator beta v1.5.zip
(30.85 KiB) Downloaded 357 times
Last edited by vasili111 on 29 Nov 2014, 11:36, edited 11 times in total.
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
vasili111
Posts: 696
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: DRAKON-AutoHotkey: Space programs programming technology

29 Mar 2014, 02:56

There are two videos of DRAKON Editor:

[youtube]http://www.youtube.com/watch?v=5IJ8Kf7mwDY[/youtube]

and

[youtube]http://www.youtube.com/watch?v=_4PV78oSdwk[/youtube]

In these two videos is used another programming language, not Autohotkey. Also these videos are form old version of DRAKON Editor and new versions have some improvments.


Also some screenshots:
Spoiler
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
vasili111
Posts: 696
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: DRAKON-AutoHotkey: Space programs programming technology

29 Mar 2014, 15:17

I think this question will be interesting for users of DRAKON Editor at ahkscript.org .
I was asked by ObiWanKenobi at http://www.autohotkey.com/board/topic/1 ... /?p=640232

Hello vasili how do you handle return?
There is only one "End" allowed in charts, but how would i draw several returns like für example:
function my_function(a) {
if (a=0) {
return "zero"
} else if (a=1) {
return "one"
} else {
return "any other"
}
}


My answer:
I do it that way:

Code: [Select all] [Download] (Script.ahk)GeSHi © Codebox Plus

my_function(a) {
if (a=0) {
b := "zero"
} else if (a=1) {
b := "one"
} else {
b := "any other"
}
return b
}

Here is DRAKON diagram for that code:
Image


In attachment you can download that diagram in .drn format (DRAKON Editor format).
Attachments
1.zip
(1.6 KiB) Downloaded 148 times
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
vasili111
Posts: 696
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: DRAKON-AutoHotkey: Space programs programming technology

30 Mar 2014, 15:22

At autohotkey.com thread there was interesting question from ObiWanKenobi:

Hello Vasili, what does shelf icon and connector icon mean?

Currently ahkscript.org does not supports large images in posts, so I will be putting here a links of my posts at autohotkey.com :

Connector icon
http://www.autohotkey.com/board/topic/1 ... /?p=640352

Shelf icon
http://www.autohotkey.com/board/topic/1 ... /?p=640372
Last edited by vasili111 on 02 Apr 2014, 09:02, edited 2 times in total.
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
vasili111
Posts: 696
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: DRAKON-AutoHotkey: Space programs programming technology

01 Apr 2014, 01:23

Here is an example of using AutoHotkey with DRAKON : http://www.autohotkey.com/board/topic/1 ... /?p=640550
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
vasili111
Posts: 696
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: DRAKON-AutoHotkey: Space programs programming technology

03 Apr 2014, 02:08

Generator for AutoHotkey updated, beta v1.5:
Added extra return to end of header and beginning of footer.
Some corrections of autogenerated comments for generated code.

Download links are in the attachment of first post.
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
vasili111
Posts: 696
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: DRAKON-AutoHotkey: Space programs programming technology

19 Apr 2014, 10:11

DRAKON Editor is now on GitHub: http://github.com/stepan-mitkin/drakon_editor/
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
toralf
Posts: 431
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: DRAKON-AutoHotkey: Space programs programming technology

02 May 2014, 16:19

Drakon is very interesting.
I read the PDF and looked on the Wikipedia info. The PDF mentions Drakon-2, but I Couldn't find any info on that.

As far as I understood the language so far: you write the individual AHK commands as actions but the program flow is defined grafically. I can see the use when it is essential to be error free and maintain friendly.

But how are GUI programmed?
1 start
2 build GUI
3 show GUI

But how do you then programm the different options the user has? I guess the switch is not the right command?
Is there a visual representation in Drakon to "list/show" all the possible actions?

How do you distinguish in Drakon between subroutines and functions? How do you hand over parameters ?
ciao
toralf
vasili111
Posts: 696
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: DRAKON-AutoHotkey: Space programs programming technology

04 May 2014, 11:47

toralf wrote:Drakon is very interesting.
I read the PDF and looked on the Wikipedia info. The PDF mentions Drakon-2, but I Couldn't find any info on that.


As far as I know author of DRAKON does not using term DRAKON-2. I think that term is used by pdf autor only. There are aditional icons for realtime programming. It is possible to draw diagrams using realtime icons with DRAKON editor, but at that time there is not code generation support from them. If you are interested in realtime icons I can explain them, but as I mention before code generation is not supported by DRAKON Editor at that time.
If you need to use parallel process you can use Process icon to implement it.

toralf wrote:As far as I understood the language so far: you write the individual AHK commands as actions but the program flow is defined grafically. I can see the use when it is essential to be error free and maintain friendly.


Exactly. All program flow is graphical only and the code for script flow is generated by DRAKON Editor from diagrams. You dont wright any program flow code. You can only use goto and/or gosub command ONLY for calling Free type diagram (See more about Free type in documentation zip file).
DRAKON is extensively used in Space programs, where clarity of algorithms is at first place, where errors in code have very dramatic consequences. It is made for making as less possible errors in code as possible.

toralf wrote:But how are GUI programmed?
1 start
2 build GUI
3 show GUI

You are writing all commands for GUI creation inside action icons. Here is one simple GUI script example: http://www.autohotkey.com/board/topic/1 ... /?p=640550
If you need to use non standard If statments like IfMsgBox the only way to use it is to write all statement it inside action icon. Also as far as I know the AutoHotkey v2 will get remove all nonstandard If statements.
If you need some other example of creating GUI with DRAKON, then please give me the AutoHotkey code for it and I will try to make DRAKON diagram for it.

toralf wrote:But how do you then programm the different options the user has? I guess the switch is not the right command

You mean the case when there is several options to choose from and not only YES or NO ? You can implement that using several question icons or with Switch macroicon (read more in documentations.zip that is attached to the first post). Keep in mind that I have submitted patch for next version of DRAKON Editor code generation for Switch macroicon for all supported languages (you can get development version that supports improved version of Switch macroicon form http://github.com/stepan-mitkin/drakon_editor/ . Read readme.md how to use it. Also read updated documentation form examples\AutoHotkey folder. keep in mind also that in developmet version for parameter commenting we use ;)

toralf wrote:Is there a visual representation in Drakon to "list/show" all the possible actions?

Can you please explain that question more?


toralf wrote:How do you distinguish in Drakon between subroutines and functions? How do you hand over parameters ?

About using subroutins, functions and hotkeys and parameters for functions please read about them in documentations.zip that is attached to the first post.

If my answers need some more clarification feel free to ask. If you have some other questions I will be glad to answer.
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
Awannaknow
Posts: 77
Joined: 01 Oct 2013, 08:07

SOLVED: cannot generate AHK code

27 Jun 2014, 04:30

*** UPDATE ***
I found out:
1- After close/reopen Drakon, all is working
2- Found in the doc (your link in your 1rst post: Doc1.docx in Documentation.zip) :"DRAKON Editor is currently tested with only AutoHotkey_L"
*** UPDATE ***
Hi Vasili111,
I luckily found out your thread about DRAKON and wanted to try it, downloaded and installed:
1- ActiveTcl8.6.1.0.297577-win32-ix86-threaded.exe
2- drakon_editor1.22.zip
3- AutoHotkey code generator beta v1.5.zip
Other details:
1- Win XP Pro
2- AutoHotkey Unicode 32-bit 1.1.11.02

I got an error:
No generator for language 'AutoHotkey_L'.
here is the pic
Spoiler


Apparently, this ahk version, which appear on the pic as AHK_L, is not the right one to try with Drakon, which version work with Drakon ?

Thanks for this DRAKON EDITOR and for help, I think I'll use it if I can make it works.
vasili111
Posts: 696
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: SOLVED: cannot generate AHK code

27 Jun 2014, 10:07

Awannaknow wrote:*** UPDATE ***
I found out:
1- After close/reopen Drakon, all is working
2- Found in the doc (your link in your 1rst post: Doc1.docx in Documentation.zip) :"DRAKON Editor is currently tested with only AutoHotkey_L"
*** UPDATE ***
Hi Vasili111,
I luckily found out your thread about DRAKON and wanted to try it, downloaded and installed:
1- ActiveTcl8.6.1.0.297577-win32-ix86-threaded.exe
2- drakon_editor1.22.zip
3- AutoHotkey code generator beta v1.5.zip
Other details:
1- Win XP Pro
2- AutoHotkey Unicode 32-bit 1.1.11.02

I got an error:
No generator for language 'AutoHotkey_L'.
here is the pic
Spoiler


Apparently, this ahk version, which appear on the pic as AHK_L, is not the right one to try with Drakon, which version work with Drakon ?

Thanks for this DRAKON EDITOR and for help, I think I'll use it if I can make it works.

Hi Awannaknow
Did you unpacked the content of AutoHotkey code generator beta v1.5.zip in the \Drakon Editor\generators folder? DRAKON Editor 1.22 works fine with AutoHotkey code generator beta v1.5.

OR

You can use DRAKON Editor from github https://github.com/stepan-mitkin/drakon_editor/ . There is upcoming version of DRAKON Editor. In current state it is tested by me and I think it works fine. That version has improvements of code generation for all supported languages and also has built in the newest version of AutoHotkey code generator wich also has some improvements. To use that version follow these steps:
1. Download upcoming version from here: https://github.com/stepan-mitkin/drakon ... master.zip
2. Unzip archive.
3. If you need to launch English version of DRAKON Editor delete folder \msgs . If you need Russion version of DRAKON Editor skip step 3.
4. Run drakon_editor.tcl

It the folder examples\AutoHotkey\ you will find updated documentation and some examples. Please read that documentation, becose it contains some changes of AutoHotkey code generator.

If something dont works after following steps above or you have any question related to DRAKON or DRAKON Editor write them here and I will help you with them.
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
Awannaknow
Posts: 77
Joined: 01 Oct 2013, 08:07

Write ShortcutGetHotkey ShortcutSetHotkey with DRAKON

06 Nov 2014, 03:25

Hi vasili111,
Thanks for Drakon, it easier with it.
I wonder if it's possible to write this 2 functions with it, I tried but can't find how.
I can't really 100% understand the code, because of lack of knowledge with com, object, dll . . .
Maybe it's part of why I can't write it in Drakon.
just me (ahk member) just created them to find a solution for a problem I had.
I past the whole code, so if you or someone wants to test it it'll be easy, but only the 2 functions (ShortcutGetHotkey and ShortcutSetHotkey) are what I try to write with drakon.
Here they are:

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus

Awannaknow
Posts: 77
Joined: 01 Oct 2013, 08:07

yes no msgbox

12 Nov 2014, 10:06

Any help appreciated.
From example code in help file which is almost what I need to do,

Code: [Select all] [Download] GeSHi © Codebox Plus

MsgBox, 4,, Would you like to continue? (press Yes or No)
IfMsgBox Yes
MsgBox You pressed Yes.
else
MsgBox You pressed No.

I tried this, and lots of variations, but not working:Image
This is working, but surely not the correct way of doing it:
Image
Thanks in advance.
vasili111
Posts: 696
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: DRAKON-AutoHotkey: Space programs programming technology

12 Nov 2014, 14:44

Hi Awannaknow :)

I cant tell you anything about two AutoHotkey functions that you posted above because I don't understand it (I don't know how to use com, object, dll and etc. with AutoHotkey).
But, actually any AutoHotkey code can be converted to DRAKON-AutoHotkey (hybrid language, AutoHotkey with DRAKON) with DRAKON Editor. But because AutoHotkey has several different If (IfXXX, like IfMsgBox and etc.) statements and currently AutoHotkey code generation with DRAKON Editor supports only regular If statement, we can't use directly not regular If statments (like IfMsgBox and etc). But there are two other ways we can use them:

First, as you mentioned before:
Image

Just remember any code that is inside Action icon is always directly sent to generated .ahk file as is.

Second:
Image

The idea above is that, in Action icon we put code with not regular If statement which will assign the result to the variable. After that we can use that variable in DRAKON If icon or in DRAKON Switch macroicone (Select/Case icons). So that way we can manage the result in DRAKON way. For, example we can:

Image

In above example, in any way we are not changing Action icon which assigns variable. We operate with the result of that action icon in DRAKON way. I understand that it is not really DRAKON way of making diagrams, because in DRAKON we should not need to use that Action icon and we should never use directly If or any other branching statements with DRAKON. But I think that because we can manage the result in DRAKON way Second method is better than First.

Also, DRAKON-AutoHotkey code generator has improved and I will post last version in several days.

If you have any other questions or you don't understand something that I wrote, ask and I will be glad to answer :)
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
Awannaknow
Posts: 77
Joined: 01 Oct 2013, 08:07

Re: DRAKON-AutoHotkey: Space programs programming technology

12 Nov 2014, 20:42

Everything is perfectly clear, the var=yes, var= no solution is what I will use until some new version comes out.
Thanks a lot.
It's perfectly usable like that, for what I want to do.
I can't tell you anything about two AutoHotkey functions that you posted above because I don't understand it (I don't know how to use com, object, dll and etc. with AutoHotkey).

Neither do I . . .
I though I was unable to do anything concerning ahk and drakon.
What a relief!
;-)
About the functions, I will write them manually at the end of the code in created ahk file as I do when I code directly in an ahk file.
I'm so curious to see how they looks like graphically in drakon, maybe one day . . . someone will know how to code it in drakon.
And also, having them presented graphically may be helpful to understand them.
vasili111
Posts: 696
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: DRAKON-AutoHotkey: Space programs programming technology

13 Nov 2014, 08:52

Awannaknow wrote:Everything is perfectly clear, the var=yes, var= no solution is what I will use until some new version comes out.

As far as I know, AutoHotkey V2 will only have one If statement. All IfXXX (like IfMsgBox and etc.) will be replaced like: IfMsgBox replaced with A_MsgBoxResult. So it will be much easier to use AutoHotkey with DRAKON Editor.


Awannaknow wrote:About the functions, I will write them manually at the end of the code in created ahk file as I do when I code directly in an ahk file.

You dont need to add AutoHotkey code manually. Actually, you never have to edit .ahk file manually. You can put all that kind of code in Action icon in Free type diagram (look in Documentation.zip) and all code will go to generated .ahk file as is and you can call that functions from other diagrams.
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
Awannaknow
Posts: 77
Joined: 01 Oct 2013, 08:07

Re: DRAKON-AutoHotkey: Space programs programming technology

13 Nov 2014, 09:18

So it will be much easier to use AutoHotkey with DRAKON Editor.

Good! It is already very helpful (for me).
You can put all that kind of code in Action icon in Free type diagram

Yes, of course! I didn't thought about doing it like that when I wrote my answer.
vasili111
Posts: 696
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: DRAKON-AutoHotkey: visual programming with AutoHotkey

28 Nov 2014, 10:50

1. First post of this thread updated.
2. New version of DRAKON Editor with current version of AutoHotkey code generator added (see the section "How to install DRAKON Editor" of the first post of current thread).
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
vasili111
Posts: 696
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: DRAKON-AutoHotkey: Visual programming with AutoHotkey

29 Nov 2014, 10:20

1. New version of DRAKON Editor released, v 1.24! It has built in correct version of AutoHotkey code generator. Download it from: http://drakon-editor.sourceforge.net/editor.html#downloads
2. If you read old version of documentation from attachment of first post of this thread, then you need to read documentation from current version of DRAKON Editor (located in docs\AutoHotkey folder), because there are substantial changes in a new AutoHotkey code generator.
3. You can check some examples of DRAKON-AutoHotkey from examples\AutoHotkey folder.
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
vasili111
Posts: 696
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: DRAKON-AutoHotkey: Visual programming with AutoHotkey

03 Dec 2014, 09:09

Example
Screenshot of the diagram for calculation Fibonacci numbers


Image
DRAKON-AutoHotkey: Visual programming for AutoHotkey.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: Randy31416 and 15 guests