In case you haven't figured a way to load the saved XIM file to its drop down, here's a way;
I changed...
XIMFileCount = 0
XIMFiles =
Loop, *.xim {
XIMFiles = %XIMFiles%%A_LoopFileName%`n
XIMFile%A_Index% = %A_LoopFileName%
XIMFileCount += 1
}
If FileExist("XIMSwitcherSave.txt")
{
Loop, Read, XIMSwitcherSave.txt
{
Save%A_Index% := A_LoopReadLine
}
}
Else
{
FileAppend, `n `n `n `n `n `n `n `n `n `n `n `n, XIMSwitcherSave.txt
Loop, Read, XIMSwitcherSave.txt
{
Save%A_Index% := A_LoopReadLine
}
}
display_dropdowns()
display_dropdowns() {
global
y = 10
Loop 12 {
i = %A_Index%
Loop %XIMFileCount% {
File := XIMFile%A_Index%
SaveFile := Save%i%
IfInString, File, %SaveFile%
{
Select = %A_Index%
Break
}
}
Gui, Add, DropDownList, x36 y%y% w130 h20 vDDL%A_Index% R12 +hidden Choose%Select%, %XIMFiles%
y += 20
}
}
I also put "Gui +Delimiter`n" at the top. It also loads all the .XIM files in the drop downs instead of just 12.
Also, if you want to use this instead, it would make it easier to modify in the future and take up less lines.
F1::LoadProfile(Save1)
LoadProfile(i) {
If i Contains .xim
{
ToolTip
WinKill, XIM
BlockInput On
Run, %i%
WinWaitActive, XIM
BlockInput Off
ToolTip, %i%, 65, 6
}
}