XIM Community

[XIM2] A Script for Toggling XIM Files; XIMSwitcher  (Read 13623 times)

Offline mikey1804

  • Member
  • *
  • Posts: 216
    • View Profile
Re: A Script for Toggling XIM Files; XIMSwitcher
« Reply #30 on: 03:23 PM - 09/17/10 »
i thought i would just share my version of the xim switcher, thanks to mtgtopdeck for the original and komrad for the modified-ish version, this has a wider window so if you have  long named files they are not cut off, the dropdown box has all your xim files listed,(thanks komrad) and it saves your chosen hotkey for the next time you use the program and when you edit the files. enjoy



Code: [Select]
#NoEnv
#SingleInstance force
SendMode Input
SetTitleMatchMode 3
SetWorkingDir %A_ScriptDir%
Gui +Delimiter`n

XIMFileCount = 0
XIMFiles = 
Loop, *.xim {
    XIMFiles = %XIMFiles%%A_LoopFileName%`n
    XIMFile%A_Index% = %A_LoopFileName%
    XIMFileCount += 1
}
Loop, parse, XIMFiles, `n
{
    if A_LoopField =
        continue
    FileDelete, XIMFileList.txt
    FileAppend, %XIMFiles%, XIMFilelist.txt
}


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, x26 y%y% w400 h21 vDDL%A_Index% R12 +hidden Choose%Select%, %XIMFiles%
        Gui, Add, DropDownList, x26 y%y% w400 h21 vGrayddl%A_Index% +Disabled Choose%Select%, %XIMFiles%
        y += 20
    }
}

Gui, Add, Text, x6 y12 w25 h15 , F1:
Gui, Add, Text, x6 y32 w25 h15 , F2:
Gui, Add, Text, x6 y52 w25 h15 , F3:
Gui, Add, Text, x6 y72 w25 h15 , F4:
Gui, Add, Text, x6 y92 w25 h15 , F5:
Gui, Add, Text, x6 y112 w25 h15 , F6:
Gui, Add, Text, x6 y132 w25 h15 , F7:
Gui, Add, Text, x6 y152 w25 h15 , F8:
Gui, Add, Text, x6 y172 w25 h15 , F9:
Gui, Add, Text, x6 y192 w25 h15 , F10:
Gui, Add, Text, x6 y212 w25 h15 , F11:
Gui, Add, Text, x6 y232 w25 h15 , F12:
Gui, Add, Button, x6 y260 w200 h20 vbutton1 +disabled, Save
Gui, Add, Button, x226 y260 w200 h20 vbutton2, Edit
Gui, Show, x173 y91 h292 w437, XIM Switcher
Return

ButtonEdit:
{
    GuiControl, Hide, Grayddl1
    GuiControl, Hide, Grayddl2
    GuiControl, Hide, Grayddl3
    GuiControl, Hide, Grayddl4
    GuiControl, Hide, Grayddl5
    GuiControl, Hide, Grayddl6
    GuiControl, Hide, Grayddl7
    GuiControl, Hide, Grayddl8
    GuiControl, Hide, Grayddl9
    GuiControl, Hide, Grayddl10
    GuiControl, Hide, Grayddl11
    GuiControl, Hide, Grayddl12
    GuiControl, Show, DDL1
    GuiControl, Show, DDL2
    GuiControl, Show, DDL3
    GuiControl, Show, DDL4
    GuiControl, Show, DDL5
    GuiControl, Show, DDL6
    GuiControl, Show, DDL7
    GuiControl, Show, DDL8
    GuiControl, Show, DDL9
    GuiControl, Show, DDL10
    GuiControl, Show, DDL11
    GuiControl, Show, DDL12
    GuiControl, Disable, button2
    GuiControl, Enable, button1
}
Return

ButtonSave:
{
    GuiControlGet, g1,, DDL1
    GuiControlGet, g2,, DDL2
    GuiControlGet, g3,, DDL3
    GuiControlGet, g4,, DDL4
    GuiControlGet, g5,, DDL5
    GuiControlGet, g6,, DDL6
    GuiControlGet, g7,, DDL7
    GuiControlGet, g8,, DDL8
    GuiControlGet, g9,, DDL9
    GuiControlGet, g10,, DDL10
    GuiControlGet, g11,, DDL11
    GuiControlGet, g12,, DDL12
    FileDelete, XIMSwitcherSave.txt
    FileAppend, %g1%`n%g2%`n%g3%`n%g4%`n%g5%`n%g6%`n%g7%`n%g8%`n%g9%`n%g10%`n%g11%`n%g12%, XIMSwitcherSave.txt
    Gui, 2:Add, Button, x46 y40 w60 h20 v2button1, OK
    Gui, 2:Add, text, x6 y10 w140 h20 , XIM Switcher Hotkeys Saved
    Gui, 2:Show, w152 h70, Saved
}
Return

2buttonOK:
{
    WinClose, XIM Switcher
    WinClose, Saved
}
Return


$F1::LoadProfile(1)
$F2::LoadProfile(2)
$F3::LoadProfile(3)
$F4::LoadProfile(4)
$F5::LoadProfile(5)
$F6::LoadProfile(6)
$F7::LoadProfile(7)
$F8::LoadProfile(8)
$F9::LoadProfile(9)
$F10::LoadProfile(10)
$F11::LoadProfile(11)
$F12::LoadProfile(12)
Return


LoadProfile(i)
    {
    FileReadLine, temp, XIMSwitcherSave.txt, %i%
    If temp Contains .xim
    {
    WinKill, XIM
    BlockInput On
    Run, %temp%
    WinWaitActive, XIM
    BlockInput Off
    ToolTip, %temp%, 65, 6
    }
}
return


$~*^Esc::ToolTip

$^NumpadEnter::ExitApp

Offline mikey1804

  • Member
  • *
  • Posts: 216
    • View Profile
Re: A Script for Toggling XIM Files; XIMSwitcher
« Reply #31 on: 03:30 PM - 09/17/10 »
oh and if you want it to work with the latest version of xim then just change the bottom function to
Code: [Select]
LoadProfile(i)
    {
    FileReadLine, temp, XIMSwitcherSave.txt, %i%
    If temp Contains .xim
    {
    sendinput, {ctrl down}
    sleep, 5
    sendinput, {esc down}
    sleep, 5
    sendinput, {esc up}
    sleep, 5
    sendinput, {ctrl up}
    BlockInput On
    sleep, 3000
    Run, %temp%
    WinWaitActive, XIM
    BlockInput Off
    ToolTip, %temp%, 65, 6
    }
}
return

you might need to adjust the sleep time(3000)if its not long enough, to be honest though id just revert back the the previous xim(unless you use the halo smart config) as it is instant xim file changing

Offline rtmoose

  • MVP
  • *
  • Posts: 1938
  • yea... its how those frenchies used to say my name
    • View Profile
Re: A Script for Toggling XIM Files; XIMSwitcher
« Reply #32 on: 09:36 AM - 11/26/10 »
im trying to use this with XIM1.. and when i press the key it just opens the corresponding XIM config and freezes my mouse... any ideas?
Hi, I don't know if this is the right place to write this, my husband Technogiant as gone out of the room, can you send him this xbox thing quickly he's driving me up the wall. thanks

i5-2500k - p8p67 rev3 - radeon HD6850 - 8GB corsair ram @ 1600mhz - WD caviar Black SATA III

Offline rtmoose

  • MVP
  • *
  • Posts: 1938
  • yea... its how those frenchies used to say my name
    • View Profile
Re: A Script for Toggling XIM Files; XIMSwitcher
« Reply #33 on: 12:28 PM - 11/26/10 »
i figured it out.. i had the default program to open the .xim files as notepad.. changed it to XIM.exe and now it works like a charm.. this is sick thanks man!
Hi, I don't know if this is the right place to write this, my husband Technogiant as gone out of the room, can you send him this xbox thing quickly he's driving me up the wall. thanks

i5-2500k - p8p67 rev3 - radeon HD6850 - 8GB corsair ram @ 1600mhz - WD caviar Black SATA III

Offline billythekid

  • Member
  • *
  • Posts: 42
    • View Profile
Re: A Script for Toggling XIM Files; XIMSwitcher
« Reply #34 on: 12:53 PM - 11/29/10 »
rtmoose

hey men i have the same problem. if i press F1 notepad comes up and freezes. would u mind guiding me pls thanks.

Offline billythekid

  • Member
  • *
  • Posts: 42
    • View Profile
Re: A Script for Toggling XIM Files; XIMSwitcher
« Reply #35 on: 01:09 PM - 11/29/10 »
I change the notepad to xim.exe now my problem is i dont have ximconfig. where can i find this?

Offline billythekid

  • Member
  • *
  • Posts: 42
    • View Profile
Re: A Script for Toggling XIM Files; XIMSwitcher
« Reply #36 on: 01:13 PM - 11/29/10 »
rtmoose

I get this error its says "unable to find xim configuration file" i change the notepad to xim.exe

Offline billythekid

  • Member
  • *
  • Posts: 42
    • View Profile
Re: A Script for Toggling XIM Files; XIMSwitcher
« Reply #37 on: 02:00 PM - 11/29/10 »
how to reopen the script help pls

Offline rtmoose

  • MVP
  • *
  • Posts: 1938
  • yea... its how those frenchies used to say my name
    • View Profile
Re: A Script for Toggling XIM Files; XIMSwitcher
« Reply #38 on: 08:44 AM - 12/01/10 »
do what I did..

download this installer:

http://xim3.com/community/index.php?topic=265.0

run the installer..  just unzip to a folder on your desktop.. make sure you leave the "file associations" tab checked in the installer

copy all your .xim config files from wherever you have them now and  put them in the folder that you just installed..

make sure that the .xim configs are opened by xim.exe by default (instead of a notepad icon next to the file it should be a xim)

double clicking a config should open your xim.exe program..  pressing cntrl+enter while in xim.exe should bring up the ximconfig. if this all happens you should be good to go.

let me know if you have any problems

Hi, I don't know if this is the right place to write this, my husband Technogiant as gone out of the room, can you send him this xbox thing quickly he's driving me up the wall. thanks

i5-2500k - p8p67 rev3 - radeon HD6850 - 8GB corsair ram @ 1600mhz - WD caviar Black SATA III

Offline billythekid

  • Member
  • *
  • Posts: 42
    • View Profile
Re: A Script for Toggling XIM Files; XIMSwitcher
« Reply #39 on: 07:07 PM - 12/01/10 »
Rtmoose my problem is i tried to delete the autohotkey but i failed for some reason i cant delete it. i cant even open the script. @#$% im going to try it again

Offline rtmoose

  • MVP
  • *
  • Posts: 1938
  • yea... its how those frenchies used to say my name
    • View Profile
Re: A Script for Toggling XIM Files; XIMSwitcher
« Reply #40 on: 08:23 PM - 12/01/10 »
check your taskbar for a little green H icon

close that if its there

might tell you it cant delete it because its open in another process.. just retart your computer
then follow the steps i outlined..

should be fine
Hi, I don't know if this is the right place to write this, my husband Technogiant as gone out of the room, can you send him this xbox thing quickly he's driving me up the wall. thanks

i5-2500k - p8p67 rev3 - radeon HD6850 - 8GB corsair ram @ 1600mhz - WD caviar Black SATA III

komrad

  • Guest
Re: A Script for Toggling XIM Files; XIMSwitcher
« Reply #41 on: 10:20 PM - 12/01/10 »
You have to use the the Run function with the folder where XIM.exe is located for it to load properly... I haven't touched AHK in awhile, but
Code: [Select]
Run, someconfig.xim, C:\Program Files\XIM360

i'll edit the above script in a second...

komrad

  • Guest
Re: A Script for Toggling XIM Files; XIMSwitcher
« Reply #42 on: 10:23 PM - 12/01/10 »
Should work, but I didn't test it. I just added the folder in which the config will run under so it'll find the XIM.exe program and the XIMConfig program. You might have the edit the line not indented in the LoadProfile function to the proper location of your XIM folder.

Code: [Select]
#NoEnv
#SingleInstance force
SendMode Input
SetTitleMatchMode 3
SetWorkingDir %A_ScriptDir%
Gui +Delimiter`n

XIMFileCount = 0
XIMFiles =  
Loop, *.xim {
    XIMFiles = %XIMFiles%%A_LoopFileName%`n
    XIMFile%A_Index% = %A_LoopFileName%
    XIMFileCount += 1
}
Loop, parse, XIMFiles, `n
{
    if A_LoopField =
        continue
    FileDelete, XIMFileList.txt
    FileAppend, %XIMFiles%, XIMFilelist.txt
}


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, x26 y%y% w400 h21 vDDL%A_Index% R12 +hidden Choose%Select%, %XIMFiles%
        Gui, Add, DropDownList, x26 y%y% w400 h21 vGrayddl%A_Index% +Disabled Choose%Select%, %XIMFiles%
        y += 20
    }
}

Gui, Add, Text, x6 y12 w25 h15 , F1:
Gui, Add, Text, x6 y32 w25 h15 , F2:
Gui, Add, Text, x6 y52 w25 h15 , F3:
Gui, Add, Text, x6 y72 w25 h15 , F4:
Gui, Add, Text, x6 y92 w25 h15 , F5:
Gui, Add, Text, x6 y112 w25 h15 , F6:
Gui, Add, Text, x6 y132 w25 h15 , F7:
Gui, Add, Text, x6 y152 w25 h15 , F8:
Gui, Add, Text, x6 y172 w25 h15 , F9:
Gui, Add, Text, x6 y192 w25 h15 , F10:
Gui, Add, Text, x6 y212 w25 h15 , F11:
Gui, Add, Text, x6 y232 w25 h15 , F12:
Gui, Add, Button, x6 y260 w200 h20 vbutton1 +disabled, Save
Gui, Add, Button, x226 y260 w200 h20 vbutton2, Edit
Gui, Show, x173 y91 h292 w437, XIM Switcher
Return

ButtonEdit:
{
    GuiControl, Hide, Grayddl1
    GuiControl, Hide, Grayddl2
    GuiControl, Hide, Grayddl3
    GuiControl, Hide, Grayddl4
    GuiControl, Hide, Grayddl5
    GuiControl, Hide, Grayddl6
    GuiControl, Hide, Grayddl7
    GuiControl, Hide, Grayddl8
    GuiControl, Hide, Grayddl9
    GuiControl, Hide, Grayddl10
    GuiControl, Hide, Grayddl11
    GuiControl, Hide, Grayddl12
    GuiControl, Show, DDL1
    GuiControl, Show, DDL2
    GuiControl, Show, DDL3
    GuiControl, Show, DDL4
    GuiControl, Show, DDL5
    GuiControl, Show, DDL6
    GuiControl, Show, DDL7
    GuiControl, Show, DDL8
    GuiControl, Show, DDL9
    GuiControl, Show, DDL10
    GuiControl, Show, DDL11
    GuiControl, Show, DDL12
    GuiControl, Disable, button2
    GuiControl, Enable, button1
}
Return

ButtonSave:
{
    GuiControlGet, g1,, DDL1
    GuiControlGet, g2,, DDL2
    GuiControlGet, g3,, DDL3
    GuiControlGet, g4,, DDL4
    GuiControlGet, g5,, DDL5
    GuiControlGet, g6,, DDL6
    GuiControlGet, g7,, DDL7
    GuiControlGet, g8,, DDL8
    GuiControlGet, g9,, DDL9
    GuiControlGet, g10,, DDL10
    GuiControlGet, g11,, DDL11
    GuiControlGet, g12,, DDL12
    FileDelete, XIMSwitcherSave.txt
    FileAppend, %g1%`n%g2%`n%g3%`n%g4%`n%g5%`n%g6%`n%g7%`n%g8%`n%g9%`n%g10%`n%g11%`n%g12%, XIMSwitcherSave.txt
    Gui, 2:Add, Button, x46 y40 w60 h20 v2button1, OK
    Gui, 2:Add, text, x6 y10 w140 h20 , XIM Switcher Hotkeys Saved
    Gui, 2:Show, w152 h70, Saved
}
Return

2buttonOK:
{
    WinClose, XIM Switcher
    WinClose, Saved
}
Return


$F1::LoadProfile(1)
$F2::LoadProfile(2)
$F3::LoadProfile(3)
$F4::LoadProfile(4)
$F5::LoadProfile(5)
$F6::LoadProfile(6)
$F7::LoadProfile(7)
$F8::LoadProfile(8)
$F9::LoadProfile(9)
$F10::LoadProfile(10)
$F11::LoadProfile(11)
$F12::LoadProfile(12)
Return


LoadProfile(i)
    {
    FileReadLine, temp, XIMSwitcherSave.txt, %i%
    If temp Contains .xim
    {
    WinKill, XIM
    BlockInput On
 Run, %temp%, C:\Program Files\XIM360
    WinWaitActive, XIM
    BlockInput Off
    ToolTip, %temp%, 65, 6
    }
}
return


$~*^Esc::ToolTip

$^NumpadEnter::ExitApp

« Last Edit: 10:31 PM - 12/01/10 by komrad »

Offline Jon_Jon

  • MVP
  • *
  • Posts: 597
    • View Profile
Re: A Script for Toggling XIM Files; XIMSwitcher
« Reply #43 on: 05:30 PM - 12/23/10 »
mann,finally got it working...nicely done...have to read through to minimize the delay between profile switching but avoiding the error 401! at the same time....very happy with this AHK program....

Offline Jon_Jon

  • MVP
  • *
  • Posts: 597
    • View Profile
Re: A Script for Toggling XIM Files; XIMSwitcher
« Reply #44 on: 07:41 AM - 12/26/10 »
Guys, i can run it without error but my update rate is fluctuating badly... 60 - 80 -120 -220 -75 etc...fyi, my update rate is set to 125.

I launched my XIM config manually without using this AHK profile and I have my update rate pinned at 125 only (no flluctuation at all)....

do you guys have this similar problem...