; OngameMODStarter v0.95b ; Autor: Chris ; contributions by Roland ('s Functions) ; Contact: Chris228 @ 2+2 forum #NoEnv #SingleInstance force SetWorkingDir %a_scriptDir% ;===================================================================== ;=================== Autoexec ======================================== ;===================================================================== Settings() if ( Client = 0 ) { CreateSettings(ini) sleep, 500 Settings() } wdir:="" StringGetPos, pos, client, \, r1 if (pos > 0) StringLeft, wdir, client, pos+1 FileCreateDir, %wdir%\resources\graphics\originals\ FileCreateDir, %wdir%\resources\graphics\mod\ ClientOK:=CheckClient(client) ModOK:=CheckMod(wdir) if ( ClientOK = 1 && ModOK = 1 ) { FileCopy, %wdir%resources\graphics\originals\*.*, %wdir%resources\graphics\, 1 Sleep, 500 FileList:="" Loop %wdir%resources\graphics\mod\*.* FileList = %FileList%%A_LoopFileName%`n sleep, 500 Run, %client%, %wdir% sleep, 500 IfWinExist, Fehler ahk_class #32770 { ControlGetText, text, Static2 if ( text = "Error: There can only be one instance of the application running at once, exiting ..." ) exitApp } BackupOrgFiles(wdir, FileList, copymsg) sleep, 500 CopyModFiles(wdir, FileList, copymsg) if ( CloseWelcomeMsg = 1) CloseNews() } return ;===================================================================== ;=================== Prim. Functions ================================= ;===================================================================== BackupOrgFiles(wdir, FileList, copymsg) { stopTimer:=CreateStopTimer(120) Loop { id:=Ongame_LoginID() if ( id != "" ) { Loop, parse, FileList, `n { if ( A_LoopField = "" ) break FileCopy, %wdir%resources\graphics\%A_LoopField%, %wdir%\resources\graphics\originals\, 1 } if ( CopyMsg = 1) msgbox, 0, OngameMOD Starter, Original graphic files backuped., 5 break } if (A_Now > stopTimer) { msgbox, 4, OngameMOD Starter, Original graphic files not backuped. Backup now?, 120 IfMsgBox Yes { Loop, parse, FileList, `n { if ( A_LoopField = "" ) break FileCopy, %wdir%resources\graphics\%A_LoopField%, %wdir%resources\graphics\originals\, 1 } } break } sleep, 50 } } CopyModFiles(wdir, FileList, copymsg) { stopTimer := CreateStopTimer(120) Loop { id:=Ongame_LobbyID() if ( id != "" ) { Loop, parse, FileList, `n { if ( A_LoopField = "" ) break FileCopy, %wdir%resources\graphics\mod\%A_LoopField%, %wdir%\resources\graphics\, 1 } if ( CopyMsg = 1) msgbox, 0, OngameMOD Starter, Tablemod copied., 5 break } if (A_Now > stopTimer) { msgbox, 4, OngameMOD Starter, Tablemod not copied. Copy now?, 120 IfMsgBox Yes { Loop, parse, FileList, `n { if ( A_LoopField = "" ) break FileCopy, %wdir%resources\graphics\mod\%A_LoopField%, %wdir%\resources\graphics\, 1 } } break } sleep, 50 } } CloseNews() { stopTimer := CreateStopTimer(30) Loop { id:=Ongame_MsgID() if ( id != "" ) { WinClose, ahk_id %id% break } if (A_Now > stopTimer) { msgbox, 0, OngameMOD Starter, Can't find News/welcome message., 20 break } sleep, 50 } } ;===================================================================== ;=================== Sec. Functions ================================== ;===================================================================== CreateSettings(ini) { loop { FileSelectFile, client, 3, , Select "StartXXX.exe" of your Ongame client, *.exe if client != break } Msgbox, 4, OngameMOD Starter, Do you want to get a message if the backup/mod files are copied? IfMsgBox Yes CopyMsg:=1 IfMsgbox No CopyMsg:=0 Msgbox, 4, OngameMOD Starter, Do you want that the Welcome/News window from your Ongame client gets automaticly closed? IfMsgBox Yes CloseWelcomeMsg:=1 IfMsgbox No CloseWelcomeMsg:=0 IniWrite, % Client, % ini, Client, Client IniWrite, % CopyMsg, % ini, Prefs, CopyMsg IniWrite, % CloseWelcomeMsg, % ini, Prefs, CloseWelcomeMsg Msgbox, 0, OngameMOD Starter, OngameMOD Starter is now ready. If you want to change the settings modify or delete the "OngameMODStarter.ini". } Settings() { global StringTrimRight, ininame, A_ScriptName, 4 ini=%ininame%.ini iniRead, Client, %ini%, Client, Client, 0 iniRead, Copymsg, %ini%, Prefs, Copymsg, 0 iniRead, CloseWelcomeMsg, %ini%, Prefs, CloseWelcomeMsg, 0 } CheckClient(client) { IfExist, %client% { return 1 } else { FileDelete, %a_workingdir%\OngameMODStarter.ini Run, %a_workingdir%\%A_ScriptName% } } CheckMod(wdir) { FileList = Loop %wdir%resources\graphics\mod\*.* FileList = %FileList%%A_LoopFileName%`n if ( FileList = "" ) { msgbox, 4, OngameMOD Starter, Found no file(s) in the %wdir%resources\graphics\mod\ folder.`n`nCopy your modded your table/card mod in this folder. Copy now?, 60 IfMsgbox Yes { InstallMod(wdir) sleep, 1000 return 1 } IfMsgbox No return 0 } return 1 } InstallMod(wdir) { FileSelectFile, files, M3 StringLeft, dir, files, InStr(files, "`n")-1 StringTrimLeft, files, files, InStr(files, "`n") Loop, parse, files, `n { FileCopy, %dir%\%A_LoopField%, %wdir%resources\graphics\mod\, 1 } } CreateStopTimer(seconds) { stopTime := A_Now EnvAdd, stopTime, %seconds%, seconds return (stopTime) } ;===================================================================== ;=================== Client Functions =============================== ;===================================================================== Ongame_LobbyID() { SetTitleMatchMode 1 WinGet, id, id, PokerRoom.com - Welcome If ! id WinGet, id, id, HollywoodPoker.com - Welcome If ! id WinGet, id, id, EurobetPoker - Welcome If ! id WinGet, id, id, Tower Gaming Poker Room - Welcome If ! id WinGet, id, id, Betsson - Welcome If ! id WinGet, id, id, EuroPoker - Welcome If ! id WinGet, id, id, Prime Poker - Welcome If ! id WinGet, id, id, MANSION Poker - Welcome If ! id WinGet, id, id, Winamax Poker - Welcome If ! id WinGet, id, id, Chan Poker - Welcome If ! id WinGet, id, id, Scandic Bookmakers Poker - Welcome If ! id WinGet, id, id, bwin Poker - Welcome If ! id WinGet, id, id, HeyPoker - Welcome If ! id WinGet, id, id, Red Kings Poker - Welcome If ! id WinGet, id, id, NextPoker - Welcome If ! id WinGet, id, id, Whitebet - Welcome If ! id WinGet, id, id, Stryyke Poker - Welcome If ! id WinGet, id, id, PokerLoco - Welcome If ! id WinGet, id, id, Bestpoker - Welcome If ! id WinGet, id, id, Poker.gr - Welcome return id } Ongame_LoginID() { SetTitleMatchMode 1 WinGet, id, id, PokerRoom.com Login If ! id WinGet, id, id, HollywoodPoker.com Login If ! id WinGet, id, id, EurobetPoker Login If ! id WinGet, id, id, Tower Gaming Poker Room Login If ! id WinGet, id, id, Betsson Login If ! id WinGet, id, id, EuroPoker Login If ! id WinGet, id, id, Prime Poker Login If ! id WinGet, id, id, MANSION Poker Login If ! id WinGet, id, id, Winamax Poker Login If ! id WinGet, id, id, Chan Poker Login If ! id WinGet, id, id, Scandic Bookmakers.com If ! id WinGet, id, id, bwin Poker Login If ! id WinGet, id, id, HeyPoker Login If ! id WinGet, id, id, Red Kings Poker Login If ! id WinGet, id, id, NextPoker Login If ! id WinGet, id, id, Whitebet Login If ! id WinGet, id, id, Stryyke Poker Login If ! id WinGet, id, id, PokerLoco Login If ! id WinGet, id, id, Bestpoker Login If ! id WinGet, id, id, Poker.gr Login return id } Ongame_MsgID() { SetTitleMatchMode 3 WinGet, id, id, News return id }