How can I make a script start other scripts? Topic is solved
How can I make a script start other scripts?
My idea is to put a launching script into my AutoHotkey start up folder. I need to know where that is located, and I will store my other scripts in C:\Users\LPIII\Documents\AutoHotkey.
Re: How can I make a script start other scripts?
You can run other scripts from your script using the Run command.
I don't know what you mean by your "AutoHotkey start up folder." To start scripts automatically upon Windows startup, put a shortcut to your script in the Windows Startup folder. It's not a good practice to put the actual script file in that folder instead of a shortcut to the file. To create a shortcut, right-click on your script file in File Explorer and select "Create shortcut."
Use the full path to those scripts when you use the Run command in your main script. Or, if your main script is located in the same directory as those other scripts (which can be the case since you are only putting a shortcut to the script in the Startup directory), then you don't need a path at all unless your script changes the default working directory.
Re: How can I make a script start other scripts?
Is the following correct:
For adding scripts to the Run command, is there an alternative to &&?
Code: Select all
#IfWinActive, ahk_exe AM4.exe
Run C:\Users\LPIII\Desktop\WSS.ahk
Re: How can I make a script start other scripts?
No, that is not correct. The #IfWinActive directive applies to hotkeys and the like, not to regular commands. What are you trying to accomplish? Do you want it to run that script the first time the AM4.exe becomes active? Or when exactly?LAPIII wrote: ↑ Is the following correct:
Code: Select all
#IfWinActive, ahk_exe AM4.exe Run C:\Users\LPIII\Desktop\WSS.ahk
Using && is not a valid approach for running multiple programs/scripts. What you saw in the documentation is for running more than one command in a command (%ComSpec%) window that was opened by the Run command, not for running more than one program or script with the Run command. To run more than one script, you just use more than one Run command on separate lines.
For example, instead of this:
Code: Select all
Run notepad.exe && mspaint.exe
Code: Select all
Run notepad.exe
Run mspaint.exe
Re: How can I make a script start other scripts?
Yes the first time AM4.exe becomes active.
Re: How can I make a script start other scripts? Topic is solved
Code: Select all
WinWaitActive, ahk_exe AM4.exe
Run C:\Users\LPIII\Desktop\WSS.ahk