Script editor within ahk script, compilation Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Brazolek123
Posts: 187
Joined: 06 Jun 2016, 16:02

Script editor within ahk script, compilation

20 Aug 2017, 00:47

Hello everyone,
I'm struggling with another problem. The main idea is to have program that will automate some tasks and among others let user to create his own simple scripts. We've got main gui in which there will be Edit gui control type in which user will be able to write simple scripts using few, predefined functions (with up to lets say 5 parameters) and basic expressions (if, elseif, else, while), just like in this example:

Code: Select all

delay_random(500)
use(pos_x, pos_y)
go("up", 5)
if (param1 < 5){
	goto(label1)
}
else{
	pause()
	playsound(beep.mp3)
}
My questions is how the main program should read it? Since it wouldn't be compiled.
1. Should I make some kind of text interpreter for it?
2. Or maybe easier will be to attach ahk2exe compiler to the program files (however I'm afraid it might cause some false positives on most of the anti-viruses softwares). This way seems to be the easiest for me, but assuming each user can create for example 30 different little-scripts there will be 30 another exe files that after compiling that will weight over 50MB which is not a problem in fact but looks not nicely for me.
3. Also saw that there were some libraries on ahk forum for the lua interpreter - maybe thats the way to go?

How would you solve it? What's the method with most advantages in this case?
User avatar
Capn Odin
Posts: 1352
Joined: 23 Feb 2016, 19:45
Location: Denmark
Contact:

Re: Script editor within ahk script, compilation  Topic is solved

20 Aug 2017, 02:41

I would make a parser and an interpreter or just use someone else's script like this https://autohotkey.com/boards/viewtopic.php?f=6&t=6113
Please excuse my spelling I am dyslexic.
User avatar
Brazolek123
Posts: 187
Joined: 06 Jun 2016, 16:02

Re: Script editor within ahk script, compilation

20 Aug 2017, 19:06

Thanks for your reply, it has gave me some ideas.
Parser and interpreter will probably work well but it will require a lot of effort to create and probably the written script should be perfectly correct. The thing is that most of the users will probably be amateurs so no one can predict what they will write there, heh.

I'll try to ask different way, forget about built in script editor. We've got the main program that contains all the functions built in it and we have some external txt file with code like in the first post. What are the possible ways to execute them? Except for the parser/interpreter solution - it is too dificult for me (but if someones got a link to one I'd appericiate that).
I tried to search the code of this CodeQuickTester how its handling with that, but it was too complicated for me, never been working with classes, couldn't even hide menu items without making it totally bugged, hehe :D


edit:
or just use someone else's script like this https://autohotkey.com/boards/viewtopic.php?f=6&t=6113
I decided to go this way, after few modifications works good for now. Thread should be considered closed. Thanks

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, GollyJer, Lamron750 and 256 guests