Link to home
Start Free TrialLog in
Avatar of Luis Diaz
Luis DiazFlag for Colombia

asked on

AutoHotkey: call an AutoHotkey file from another AutoHotkey file

Hello experts,
I need to launch an AutoHotkey once I turn on my machine:
The idea is to place the following at:
AutoCorrect1:="C:\P\LD-autocorrect.ahk"
AutoCorrect2:="C:\F\LD-autocorrect.ahk"

If (FileExist(AutoCorrect1))
  Run,%AutoCorrect1%
Else
If (FileExist(AutoCorrect2))
  Run,%AutoCorrect2%
Else
  MsgBox,4112,Fatal Error, AutoCorrect does not exist on your system.
Return

Open in new window


I am aware that I can put: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
However I need to add some text at this file as a result I cannot place this file at this folder.

What is the best strategy:
1-Put a single AutoHotkey file at: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup to  automatically call autocorrect?
2-Create an AutoHotkey within my AutoHotkey file to run the autocorrect file? such as #!a:: however I need to remind every time that I need to launch this AutoHotkey to use autocorrect

Thank you for your help.
SOLUTION
Avatar of Joe Winograd
Joe Winograd
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Luis Diaz

ASKER

I attached autocorrect ahk file. This file allows me to avoid spelling checking through hotstrings.

If I do the following:
1-Run the file at startup
2- Launch the add hotstring feature through #a
3-Add the hotstring
4-Hotstring is not added

However if I do the same but I run the file at C:\ or another Folder step 4 is properly performed.
I hope it is clearer. If not let me know.
LD-autocorrect.ahk
3-Add the hotstring
What does that mean?
User generated image
Luis,
I'm going offline for a few hours. I'll look at this later.Regards, Joe
No rush. Thank you for your help.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Noted, Just to make sure that I am doing the right think:

1-If I create the shortcut of my AutoHotkey file like this:User generated imageShould I manually modify the extension and put .lnk prior to send to: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup)?
2-In case I need to transfer a new version of my AutoHotkey file I remove the old version, transfer new version with the same file, should I create again the shortcut?
Thank you for your help.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Noted.
Now is clear.
Thank you for your help.
You're welcome, Luis, I'm glad that cleared it up for you. Regards, Joe