Someone a few posts earlier mentioned they use a program to help change jobs, and a few people replied in envy.
So I thought to myself, "Not that I would EVER use 3rd party programs to circumvent S-E's shitty client design, but I bet I could write an AHK script that parses a text file to help me not take 10 minutes every time I want to change classes, god fucking damn it. And it seems other people might find it useful too."
Not really a pro at this so there might be a flaw or a zillion, but it's been working for me so far so if someone needs it, here it is.
Code:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Event ; Hasn't worked with Input or Play thus far
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetKeyDelay, 20, 50 ; Needed to make sure pasting works consistently.
; GUI copied from example in documentation.
Gui, Add, Text,, Pick from the list below.`nTo cancel, press ESCAPE or close this window.
Gui, Add, ListBox, vMyListBox gMyListBox w640 r10
Gui, Add, Button, Default, OK
Loop, *.txt ; Change this folder and wildcard pattern to suit your preferences.
{
GuiControl,, MyListBox, %A_LoopFileFullPath%
}
Gui, Show
return
MyListBox:
if A_GuiEvent <> DoubleClick
return
; Otherwise, the user double-clicked a list item, so treat that the same as pressing OK.
; So fall through to the next label.
ButtonOK:
GuiControlGet, MyListBox ; Retrieve the ListBox's current selection.
MsgBox, 4,, Use this text file?`n%MyListBox%
IfMsgBox, No
return
; Otherwise, try to launch it:
GuiClose:
IfWinExist FINAL FANTASY XIV ; Check if FFXIV is up.
{
WinActivate ; If FFXIV is up, activate it as main window.
Loop, read, %MyListBox% ; Read selected file
{
IfWinActive FINAL FANTASY XIV ; Check if FFXIV is still active window.
{
StringLeft, First, A_LoopReadLine, 1 ; Checking first character.
If (First = "/")
{
clipboard = %A_LoopReadLine%
Send {Space}^v{Enter}
Sleep 1000 ; Short sleep period so that XIV can catch up.
}
}
Else
{
ExitApp ; Exit if no longer active.
}
}
}
else
{
MsgBox, Final Fantasy XIV not running.
}
ExitApp
Edit: added a real crappy GUI to it. Works the same otherwise. (Stick the files you want read in the same folder as the script.)
The script will skip lines that don't start with a / so you can organize your source text for your own sake (like have a line that says Gear, separate with some white space, and then have all your gear under it).