Hello all.
I'm in love with AutoHotKey (AHK) and it's such a big time saver that I cannot help but share this little piece of code for all of you!
You can download AHK
here and for those of you who don't know what it is, click
hereSynopsis of the purpose of AHK
AutoHotkey is a free, open-source macro-creation and automation software utility that allows users to automate repetitive tasks in Microsoft Windows. Any application user interface can be modified by AutoHotkey (for example, overriding the default Windows control key commands with their Emacs equivalents).[2] It is driven by a custom scripting language that is aimed specifically at providing keyboard shortcuts or hotkeys.
So, by now you can probably understand why it can save so much time. I even automated a game hack using AHK and veency on my old ipod (got banned, but I learned a lot lol)! It's VERY versatile.
So, I urge you to learn more about AHK beyond this simple code share (only sharing code, not going to explain it as it's pretty human readable and if you're interested, AHK is very well documented and I'm confident in the fact that everyone here can fully understand it and pick it up quickly, but if you do need help you can always PM me)
Here's the code:
RunProgram(wintitle, programlocation)
{
IfWinExist, %wintitle%
{
IfWinActive, %wintitle%
{
WinClose, %wintitle%
return
}
else
{
WinActivate, %wintitle%
return
}
}
else
{
Run %programlocation%
WinWait,%wintitle%,,10
If ErrorLevel
{
WinClose, A
}
WinActivate, %wintitle%
WinMaximize
return
}
}
How to use the code/what it doesThat code is a function I wrote to automate the opening of a program.
If the program is not open, it opens it.
If the program is open but not active, it activates it
If the program is open and active, it closes it
Pretty simple, but you'd be surprised at how much time it saves!
To use it, make a new AHK script and type in something similar to this:
^!i::
{
RunProgram("iTunes", "C:\Program Files (x86)\iTunes\iTunes.exe")
return
}
This code runs the function when you press Control+Alt+I.
the "::" symbolize a hotkey, and a list can be found
here.
Make sure you use the brackets and such as shown above, and include the return, or else you will not be able to string multiple hotkeys together.
To use the function, just pass 2 parameters to it, the first one being the window title and the second one being the path to the program you wish to run.
A quick note about the window title, include
SetTitleMatchMode, 2 somewhere in the script to make the window title only have to match part of the title (iTune will match iTunes, for instance, if you include that code. This is useful for chrome and different chrome windows, for example)
Any questions, leave a comment/PM me and I will help

Finally, I have many many other tricks, let me know if anyone is interested in saving more time!