Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #RequireAdmin
- #include <MsgBoxConstants.au3>
- if not RunWait('C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe "Mount-DiskImage ""' & @ScriptDir & '\FF7DISC1.ISO"""', @ScriptDir, @SW_HIDE) == 0 then ; mount iso
- MsgBox($MB_ICONERROR, "Error", "Failed to mount ISO: " & @error & @CRLF & @extended) ; error if mounting ISO fails
- else
- if not WinExists("7thHeaven Version") then ; only run 7th Heaven if it's not already open
- if not Run(@ScriptDir & "\7thHeaven\7thHeaven.exe", @ScriptDir & "\7thHeaven\") then ; run 7th Heaven
- MsgBox($MB_ICONERROR, "Error", "Failed to launch 7th Heaven: " & @error & @CRLF & @extended) ; error if launching fails
- endif
- else
- Sleep(2000) ; sleep a bit to make sure the ISO is mounted and window is loaded
- WinActivate("7thHeaven Version") ; activate window
- WinWaitActive("7thHeaven Version") ; wait
- $drives = DriveGetDrive($DT_CDROM) ; get drive letters
- If @error Then
- ; An error occurred when retrieving the drives.
- MsgBox($MB_ICONERROR, "Error", "Failed to get drive letter: " & @error & @CRLF & @extended) ; error if getting drive letter
- else
- $drive = "none"
- For $i = 1 to $drives[0]
- ; get the drive letter of FF7DISC1.iso
- If DriveGetLabel($drives[$i]) == "FF7DISC1" then
- $drive = $drives[$i]
- ExitLoop()
- EndIf
- Next
- if $drive == "none" then
- MsgBox($MB_ICONERROR, "Error", "Failed to get drive letter: No such drive") ; error if getting drive letter
- else
- if not RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Square Soft, Inc.\Final Fantasy VII", "DataDrive", "REG_SZ", $drive & "\") then ; write drive letter to registry
- MsgBox($MB_ICONERROR, "Error", "Failed to write drive letter to registry: " & @error & @CRLF & @extended) ; error if failed
- else
- Sleep(2000) ; some extra delay to make sure the window has loaded
- if not ControlClick("7thHeaven Version", "", "[TEXT:Launch Game]") then ; launch game
- MsgBox($MB_ICONERROR, "Error", "Failed to launch game: " & @error & @CRLF & @extended) ; error if clicking "Launch Game" fails
- else
- Sleep(10000) ; sleep 10 seconds
- WinClose("7thHeaven Version") ; finally, close 7th Heaven
- endif
- endif
- endif
- endif
- endif
- if not RunWait('C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe "Dismount-DiskImage ""' & @ScriptDir & '\FF7DISC1.ISO"""', @ScriptDir, @SW_HIDE) == 0 then ; mount iso
- MsgBox($MB_ICONERROR, "Error", "Failed to unmount ISO: " & @error & @CRLF & @extended) ; error if mounting ISO fails
- endif
- endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement