I want to write a function that parses a bit of text into a section of the run command. I'm sure it's a simple problem but I'm sure you guys know how it is when something doesn't click.
The way I currently have things configured is as follows:
File tree:
Tasks (Folder)
> 1.ahk
> 2.ahk
> 3.ahk
main.ahk
Currently I am spamming this:
Code: Select all
^Numpad1::
If !WinExist("ahk_group Tasks")
Run "Tasks\1.ahk"
else
WinClose ahk_group Tasks
sleep %hCD%
return
^Numpad2::
If !WinExist("ahk_group Tasks")
Run "Tasks\1.ahk"
else
WinClose ahk_group Tasks
sleep %hCD%
return
^Numpad3::
If !WinExist("ahk_group Tasks")
Run "Tasks\1.ahk"
else
WinClose ahk_group Tasks
sleep %hCD%
return
Here's how I want it from now on:
Code: Select all
^Numpad1::Task(1)
^Numpad2::Task(2)
^Numpad3::Task(3)
Task(file)
{
GroupAdd, Tasks, %file%.ahk
global hCD
If !WinExist("ahk_group Tasks")
Run tasks\%file%.ahk
else
WinClose ahk_group Tasks
sleep %hCD%