 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Sun May 09, 2004 10:09 pm Post subject: Run AHK command dynamiclly |
|
|
I have a feeling this isn't going to be possible since I think all commands get converted when compiled.
But would it be possible to have a command named something like RunAHK that you could run any AHK command within a Compiled script. This probably doesn't make sense so here is an example script and INI file.
| Code: | IniRead, type, test.ini, Run, Type
IniRead, command, test.ini, Run, Command
if type = AHK
GoSub, AHK
if type = CMD
GoSub, CMD
Exit
AHK:
RunAHK, %command%
return
CMD:
RunWait, %comspec% /c %command%&pause
return |
| Code: | [Run]
Type=AHK
Command=MsgBox, 0, Testing, Test |
Does AHK have a Single Command Mode? AutoIt had one where I could Include the AutoIt.exe file in my script and have my script call things like this:
| Code: | | RunWait, AutoIt.exe /c "%command%" |
I would prefer not to include the AutoHotkey.exe file and call it within the script because calling the EXE over and over would be more overhead on the computer to start the application up over and over. But if one is more easier than the other I'll take the easier for you.
thanks,
beardboy |
|
| Back to top |
|
 |
compuboy_r
Joined: 04 May 2004 Posts: 68
|
Posted: Sun May 09, 2004 10:33 pm Post subject: |
|
|
| edit: oh! though this feature is a nice one, but the discussion was with someone else. sorry. (maybe too much C++ isn't too good) |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Sun May 09, 2004 11:45 pm Post subject: |
|
|
Rajat proposed something very similar and at the time I was very resistant because it's probably (just as a guess) going to be a fair amount of work. At the time, I also thought that too few users would ever need dynamic commands to make it worthwhile. But your examples and my recent work on the "minimize any window to menu" script has made me understand the value of such a feature, so I want to support it.
Also, there is no single-command mode currently. I'll put that on the list as well, though as a lower priority since it's probably not as useful.
Here's the "minimize to menu" script that would benefit from dynamic labels or dynamic something: http://www.autohotkey.com/forum/viewtopic.php?t=201 |
|
| Back to top |
|
 |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Sun May 09, 2004 11:56 pm Post subject: |
|
|
There always is a work around to what I want, I am just usually lazy or like smaller code. I added sections for MsgBox's, FileDelete, Run, and RunWait, in my script based on the type in my INI file.
thanks,
beardboy |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1717
|
Posted: Mon May 10, 2004 12:36 am Post subject: |
|
|
I'm glad that somebody else too felt the need for this addition. Chris had almost made me believe that it was quite loony what i'd used in some of my au2 scripts (though that worked!). LOL
I sure hope this gets added soon, btw i hadn't thought of having a diff cmd for this functionality, probably bcoz i'd still been thinking on the lines of what i'd done in au2.
good thinking Beardboy, and thanx. _________________
 |
|
| Back to top |
|
 |
compuboy_r
Joined: 04 May 2004 Posts: 68
|
Posted: Sat Sep 11, 2004 1:27 pm Post subject: |
|
|
When is this coming with AHK ??
compuboy_r |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Sat Sep 11, 2004 1:51 pm Post subject: |
|
|
It's going to be a while because the difficulty level and time required to implement is on par with the GUI feature. This is because AutoHotkey is designed to load, validate, and semi-compile the script prior to running. Having dynamic commands -- especially dynamic labels -- adds a great deal of complexity to almost every aspect of the program.
Since this feature would be rarely used by the typical script author, it's hard to justify giving it a high priority given how long it would take to implement. It's still on the list though, and in the meantime you could have one script dynamically modify itself, or use FileAppend to create another script to be run separately.
My original plan for the feature was to allow a variable containing command to be used anywhere, such as this:
if x = 1
{
%DynamicCommands%
}
That variable could contain any number of commands/labels separated by linefeeds (`n).
However, if you all would prefer a more simple feature, such as the ability to run only a single command dynamically, that would be slightly easier to implement and might raise the priority a little. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|