Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

DRAKON-AutoHotkey: Space programs programming technology and AutoHotkey


  • Please log in to reply
19 replies to this topic
vasili111
  • Members
  • 40 posts
  • Last active: Feb 14 2016 07:25 AM
  • Joined: 08 Apr 2013
DRAKON-AutoHotkey: Space programs programming technology and AutoHotkey
 
DRAKON (Russian: ДРАКОН, backronym for Дружелюбный Русский Алгоритмический язык, Который Обеспечивает Наглядность, "friendly Russian algorithmic language that guarantees clarity") is an algorithmic visual programming language developed within the Buran space project. Its development started in 1986 and was directed by Vladimir Parondzhanov with the participation of Russian Federal Space Agency (Academician Pilyugin Center, Moscow) and Russian Academy of Sciences (Keldysh Institute of Applied Mathematics). DRAKON is used in many major space programs: an international project Sea Launch, Russian orbit insertion upper stage Fregat (Russian: Фрегат, frigate), upgraded heavy launch vehicle Proton-M, etc. DRAKON is also used in medicine, law, business processes and in other non-programming related fields.
 
In DRAKON clarity is above all. DRAKON is made as much ergonomic as possible, as much human readable as possible. DRAKON makes possible to create diagrams that are cognitively optimized for easy comprehension, making it a tool for intelligence augmentation.
 
Why to use DRAKON than other diagramming systems?
  • 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.
 
Learn DRAKON here: 
 
So why this thread is here?
Because it is possible to generate AutoHotkey code form DRAKON diagrams.
There are several software that can create DRAKON diagrams. But  generation of AutoHotkey code from DRAKON diagrams currently 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 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.  DRAKON Editor also supports code generation for other programming languages: Java, Processing.org, D, C#, C/C++ (with Qt support), Python, Tcl, Javascript, Lua and Erlang.
 
Homepage of DRAKON Editor: http://drakon-editor.sourceforge.net/
 
 
How to install DRAKON Editor:
1) Download and install latest version of ActiveTcl Free version from here: http://www.activestate.com/activetcl
2) Download and unpack in any location latest version of DRAKON Editor form here: http://drakon-editor....html#downloads
3) In the unpacked folder launch DRAKON Editor by double clicking  drakon_editor.tcl file.
 
How to add AutoHotkey code generation support to DRAKON Editor:
Download AutoHotkey code generator.zip from here: https://mega.co.nz/#...-V7W8edAN2fLUkc and unpack it to \generators  folder of DRAKON Editor.
 
How to use DRAKON Editor with AutoHotkey:
Download and read documentation in Documentation.zip from here: https://mega.co.nz/#...77t8lhULkIfTU8U .
 
There is no working Foreach loop in beta version. It can be added later if there will be demand for it. Don’t try to use it until it officially added to prevent unexpected behaviour!
Please post your ideas how it might look Foreach loop for AutoHotkey.
 
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?
 
There is also another thread about DRAKON-AutoHotkey: http://ahkscript.org...&t=3108&p=15537
 
Ask any questions you want related to DRAKON, using DRAKON Editor and AutoHotkey code generation in here or in main thread: http://ahkscript.org....php?f=6&t=3108 .  I will be glad to help you as much as I can.


ObiWanKenobi
  • Members
  • 83 posts
  • Last active: Oct 17 2015 05:37 PM
  • Joined: 21 Aug 2012

Thank you, great read, didn't know anything about Drakon before ... very interesting.

 

See editor in action:

 



vasili111
  • Members
  • 40 posts
  • Last active: Feb 14 2016 07:25 AM
  • Joined: 08 Apr 2013


Thank you, great read, didn't know anything about Drakon before ... very interesting.

Thank you.

There is also another video of DRAKON Editor here:

 

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


ObiWanKenobi
  • Members
  • 83 posts
  • Last active: Oct 17 2015 05:37 PM
  • Joined: 21 Aug 2012

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"

    }

}



vasili111
  • Members
  • 40 posts
  • Last active: Feb 14 2016 07:25 AM
  • Joined: 08 Apr 2013


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"

    }

}

 

Hello ObiWanKenobi.

I have also changed "function my_function(a)" to "my_function(a)". Because unlike JavaScript in AutoHotkey you don't need to wright "function" before creating it.

I do it that way:

 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:

jrGV6wN.png

 

 

Here you can download that diagram in .drn format (DRAKON Editor format): https://mega.co.nz/#...oGC-dYGGa5pth08



ObiWanKenobi
  • Members
  • 83 posts
  • Last active: Oct 17 2015 05:37 PM
  • Joined: 21 Aug 2012

Thank you vasili, i understand now.



ObiWanKenobi
  • Members
  • 83 posts
  • Last active: Oct 17 2015 05:37 PM
  • Joined: 21 Aug 2012

Another question is there an icon for a recursive call of the function itself?

For example:

power(val,pow) {
    if(pow = 0)
        return 1

    } else {
        return power(val, pow - 1) * val

    }
}



vasili111
  • Members
  • 40 posts
  • Last active: Feb 14 2016 07:25 AM
  • Joined: 08 Apr 2013
 

Thank you vasili, i understand now.

You are welcome.
 

Another question is there an icon for a recursive call of the function itself?

For example:

power(val,pow) {
    if(pow = 0)
        return 1

    } else {
        return power(val, pow - 1) * val

    }
}

 
 
DRAKON has Insertion icon, which is used for calling diagram from diagram.
Inside spoiler are all DRAKON icons. You can find Insertion icon in it:
Spoiler
 
 
Try this diagram and please let me know if it worked for you. 
 
sMzRFPn.png
 
 
 
 
Here you can download that diagram in .drn format (DRAKON Editor format) : https://mega.co.nz/#...gqV11YgTWslshZM


ObiWanKenobi
  • Members
  • 83 posts
  • Last active: Oct 17 2015 05:37 PM
  • Joined: 21 Aug 2012

Hello vasili, thank you for you response. Yes it worked.



ObiWanKenobi
  • Members
  • 83 posts
  • Last active: Oct 17 2015 05:37 PM
  • Joined: 21 Aug 2012

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



vasili111
  • Members
  • 40 posts
  • Last active: Feb 14 2016 07:25 AM
  • Joined: 08 Apr 2013

Connector icon

 

Currently Connector icon is  not supported by DRAKON Editor, but it is part of DRAKON.

Sometimes the Silhouette diagram is bigger in the width than the paper that you want to print that diagram on. In that case you can use Connector icon. For example, we have Silhouette diagram and we want to cut it in two parts for printing (first part will be printed on one paper list and second part will be printed on other paper list):

qnJgmlj.png

 

 

Lets cut it in two parts.

First part:

B4EFKbh.png

 

 

 

Second part:

oOgX1eC.png

 

 

Here Connector icon numbers (1 and 2) marks the places were you need to connect printed lists to have one big diagram. In our case we need to put first and second part so that number 1 of first list is aside to number 1 of second list. Number 2 of first list is aside to number 2 of second list. Now we will have one big diagram on two papers list like this:

OT1YKR4.png



vasili111
  • Members
  • 40 posts
  • Last active: Feb 14 2016 07:25 AM
  • Joined: 08 Apr 2013

Shelf icon

 

In code generation not everything that is for Shelf icon is supported by DRAKON Editor. So now I will explain what Shelf icon is for in DRAKON and after what code is generated by DRAKON Editor from Shelf icon.

 

In DRAKON Shelf icon has several purposes.

First purpose:

Lets look on DRAKON diagram Website status:

vGRzurB.png

 

We have two types of Shelf icons.

WWwoQcQ.png

 

In the upper part of Shelf icon we are writing reserved phrases "Set feature" on second icon "Remove feature". On the lower part of the Shelf icon we are writing identifier of feature. In the left icon variable Website status = 1 . In the right icon variable Website status = 1 . We can use action icons for setting these variables but in such case Shelf icon is ergonomically preferable.

 

 

 

 

Second purpose:

When we need to immediately quit current diagram execution and need to exit to diagram that called current diagram or even to diagram of upper level, we can use Shelf icon. On the upper part we write Exit , on the lower part Name of diagram where to exit.

jwmVSlQ.png

 

In fact using Shelf icon that way is creating another exit of diagram. It is not ergonomic, because diagram should have only one exit, the End icon. So best is to avoid using it. If there is not possible to avoid it, we can create visually more ergonomic diagram like here:

QetY0zk.png

 

Keep in mind, that in that diagram execution when executes Shelf icon immediately stops execution of current diagram and exits to diagram that is in lower part of Shelf icon. But connecting Shelf icon to End icon is more visually ergonomic.

 

 

Also I have seen some diagrams that have different meanning of Shelf Icon. You can simplly give it different meaning in your diagrams.

 

 

In DRAKON Editor:

In AutoHotkey code generation, DRAKON Editor from that icon:

grIFjHS.png

 

will generate:

a := b

 

So, in AutoHotkey code generation, DRAKON Editor will put upper part of Shelf icon first, than := and after lower part of Shelf icon.



vasili111
  • Members
  • 40 posts
  • Last active: Feb 14 2016 07:25 AM
  • Joined: 08 Apr 2013

Example of using AutoHotkey with DRAKON.

 


Guess the number - tiny little game


 

I took the code from here : http://www.autohotke...e-game/?hl=game (Gui version of game by jaco0646) . I have slightly modifide code, replaced ButtonOK label with Free_ButtonPress label:

Gui, Add, Text,,Guess a number from 1 through 50.
 
Gui, Add, Text,   wp vMsg
 
Gui, Add, Edit,   wp vNum Number
 
Gui, Add, Button, wp gFree_ButtonPress, OK
 
 
 
Gui, Show,,Number Guess
 
return
 
GuiClose:
 
 ExitApp
 
 
 
Free_ButtonPress:
 
 If !rand
 
  Random, rand, 1, 50
 
 Gui, Submit, NoHide
 
 If (Num = rand) {
 
  GuiControl,,Msg, (%Num%) Just right!
 
  GuiControl,,Num, Guess again to start a new game.
 
  rand = 0
 
  return
 
 }
 
 If (Num < rand)
 
  GuiControl,,Msg, (%Num%) Too low.
 
 Else If (Num > rand)
 
  GuiControl,,Msg, (%Num%) Too high.
 
 GuiControl,,Num
 
return

I have made DRAKON diagrams from that code. You can just open diagrams file in DRAKON Editor, click generate and DRAKON Editor will generate working AutoHotkey code. Please look at diagrams and pay attention at how much easier it is to read them in comparison to traditional textual version. DRAKON was made for easy readability. It was made for easy making of algorithms even by non programmer.

Also I will put Free_ButtonPress diagram in two forms: Primitive and Silhouette . Both of them are logically similar but in Silhouette form we have Free_ButtonPress diagram divided in to logical parts. That makes code easier to read and is more ergonomically preferable.

 

Click images to zoom.

 

Free_GuiStart diagram:

1zSjKTT.png

 

 

Free_ButtonPress diagram in Primitive form:

me47geL.png

 

 

Free_ButtonPress diagram in Silhouette form:

ZYU7gZX.png

 

 

Free_GuiClose diagram:

8DMXlq0.png

 

You can download diagram files.

Primitive version : https://mega.co.nz/#...EpDjL4bjMF4z1WY

Silhouette version : https://mega.co.nz/#...s1NmiGB6advy4jE

 

Also here you can download all images from that post archive: https://mega.co.nz/#...M7cF0Z0hpuiKELA



ObiWanKenobi
  • Members
  • 83 posts
  • Last active: Oct 17 2015 05:37 PM
  • Joined: 21 Aug 2012

Hello vasili, i also found this (ERIL - a Visual Language for Data Modelling):

http://drakon-editor...e.net/eril.html

Also interesting



vasili111
  • Members
  • 40 posts
  • Last active: Feb 14 2016 07:25 AM
  • Joined: 08 Apr 2013

Hello vasili, i also found this (ERIL - a Visual Language for Data Modelling):

http://drakon-editor...e.net/eril.html

Also interesting

Hi ObiWanKenobi. Yes I heared about ERIL, it is interesting.