How do YOU start most of your AHK scripts?
Posted: 14 Jun 2018, 08:56
Not a gaming related question!
Hi guys,
I've been working with AHK for a while and I always get fascinated by its (almost) limitless possibilities.
In many cases I create bigger scripts which contain single scripts.
The single scripts get activated by keystrokes (e.g. Ctrl+Shift+F1 till Ctrl+Shift+F12).
Inside of my Logitech "Gaming" Software, I assign the keystrokes/key combinations to my G keys.
Then I just compile the AHK script and let it run in background.
When my target app is active and the profile has been loaded (Notepad++, Excel, some game etc.),
pressing the specific G key always works perfectly.
Now I'm thinking that in some case it might be useful to create single AHK scripts
without any keystroke/keycombination.
Then I don't assign any key to the G key, but simply the AHK/exe file (as a link).
The result is the same, but I wonder if method 2 has any disadvantages like cpu performance etc.
(Because a new process gets created).
Method 1 as code would be:
Method 2 would be the same but without hotkeys and 2 separate ahk files (and with ExitApp instead of return)
By method 2 I save all the keys, but somehow I tend to believe method 1 is the more correct way...
A concrete example would be :
Big script with 12 scripts (each with unique hotkey) vs 12 single scripts without any hotkey.
What do you think?
And how do you work?
Regards
Hi guys,
I've been working with AHK for a while and I always get fascinated by its (almost) limitless possibilities.
In many cases I create bigger scripts which contain single scripts.
The single scripts get activated by keystrokes (e.g. Ctrl+Shift+F1 till Ctrl+Shift+F12).
Inside of my Logitech "Gaming" Software, I assign the keystrokes/key combinations to my G keys.
Then I just compile the AHK script and let it run in background.
When my target app is active and the profile has been loaded (Notepad++, Excel, some game etc.),
pressing the specific G key always works perfectly.
Now I'm thinking that in some case it might be useful to create single AHK scripts
without any keystroke/keycombination.
Then I don't assign any key to the G key, but simply the AHK/exe file (as a link).
The result is the same, but I wonder if method 2 has any disadvantages like cpu performance etc.
(Because a new process gets created).
Method 1 as code would be:
Code: Select all
^+F1::
line = 1
while ErrorLevel != 1
{
FileReadLine, Clipboard, %A_ScriptDir%\Conversion(001).txt, %line%
Send ^v
Sleep, 5
Send {Tab}
Sleep, 5
line++
}
return
^+F2::
WinGetTitle, title, A ; Get current window title
if title contains .txt ; if it contains .txt
{
title := StrReplace(title, " - Editor") ; replace " - Editor" by nothing
}
Clipboard = WinGetTitle%title% ; Clipboard = WinGetTitle%title% (window title)
return
By method 2 I save all the keys, but somehow I tend to believe method 1 is the more correct way...
A concrete example would be :
Big script with 12 scripts (each with unique hotkey) vs 12 single scripts without any hotkey.
What do you think?
And how do you work?
Regards