Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Use this function to define any code you want to run in every module on start
- StartGlobalUserFeatures(){
- Global systemName, romName, WinIPACPath, WinIPACProfileDir, changedIPacProfile, 3rdPartyToolsSettingsFile
- Log("StartGlobalUserFeatures - Starting")
- 3rdPartyToolsSettingsFile := A_ScriptDir . "\Lib\3rdPartyToolsPaths.ini"
- Log("3rdPartyTools - Ini file location " . 3rdPartyToolsSettingsFile, 5)
- Log("WinIPAC - Start IPac System Profile Test")
- WinIPACPath := IniReadCheck(3rdPartyToolsSettingsFile, "WinIPAC", "WinIPACPath",A_ScriptDir . "\WinIPAC\WinIPAC.exe",,1)
- WinIPACProfileDir := IniReadCheck(3rdPartyToolsSettingsFile, "WinIPAC", "WinIPACProfileDir",A_ScriptDir . "\IPACProfiles",,1)
- If !(FileExist(WinIPACPath)) {
- Log("WinIPAC - The file WinIPAC.exe does not exist at " . WinIPACPath . ". Please check your paths!",3)
- } else {
- If !(FileExist(WinIPACProfileDir . "\" . "default.ipc")){
- Log("WinIPAC - IPac required Default Profile not found at " . WinIPACProfileDir . "\" . "default.ipc",5)
- } else {
- Log("WinIPAC - Default profile found: " . WinIPACProfileDir . "\" . "default.ipc",5)
- changedIPacProfile := LoadIPacProfile()
- }
- }
- Log("WinIPAC - Stop IPac System Profile Test")
- Log("StartGlobalUserFeatures - Ending")
- }
- LoadIPacProfile(){
- Global systemName, romName, WinIPACPath, WinIPACProfileDir
- IPacPath1 := WinIPACProfileDir . "\" . systemName . "\" . romName . ".ipc"
- IPacPath2 := WinIPACProfileDir . "\" . systemName . ".ipc"
- Loop, 2 {
- if FileExist(IPacPath%a_index%) {
- Log("WinIPAC - Loading IPAC profile: " . IPacPath%a_index%, 5)
- Run, % WinIPACPath . " " . IPacPath%a_index%,,UseErrorLevel,OutputVarPID
- Process, WaitClose, %OutputVarPID%, 5
- IPacPID = ErrorLevel
- Log("WinIPAC - WinIPAC PID: " . OutputVarPID . " Error Level: " . ErrorLevel, 5)
- ;11:55:54 AM | Title/Class: WinIPAC - Downloading ahk_class ThunderRT6FormDC is now active
- If (ErrorLevel > 0){
- ScriptError("Your IPac failed to program. Make sure the IPac is connected and try again. You may need to reboot your computer and try again.")
- } else {
- Log("WinIPAC - IPAC profile was loaded.",5)
- Return true
- }
- } else {
- Log("WinIPAC - IPac profile " . IPacPath%a_index% . " not found.",5)
- }
- }
- }
- ; Use this function to define any code you may need to stop or clean up in every module on exit
- StopGlobalUserFeatures(){
- Global WinIPACPath, WinIPACProfileDir, changedIPacProfile
- Log("StopGlobalUserFeatures - Starting")
- Log("WinIPAC - Start IPac Profile Restore")
- If (changedIPacProfile){
- RunWait, % WinIPACPath . " " . WinIPACProfileDir . "\" . "default.ipc",,UseErrorLevel,OutputVarPID
- If (ErrorLevel > 0){
- ScriptError("Your IPac failed to restore. Your default IPac profile was not programmed.")
- } else {
- Log("WinIPAC - Default IPac profile has been restored.",5)
- Return
- }
- } else {
- Log("WinIPAC - Alternative IPac profile not used. No need to restore.")
- }
- Log("WinIPAC - Stop IPac Profile Restore")
- Log("StopGlobalUserFeatures - Ending")
- }
Advertisement
Add Comment
Please, Sign In to add comment