Detect if intro video begins playing

Ask gaming related questions (AHK v1.1 and older)
Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

Detect if intro video begins playing

18 May 2023, 11:48

Using v1.1.30.3 WinXP SP3 32b

DiRT 3 is well known for crashing during start up. If the game launching process gets to about 5~7 seconds in (this is a couple seconds AFTER the intro loading video(s) would have begun playing)... the game hard locks and requires manual hold of power button to shut-down PC. After I tried all recommended solutions found on interwebz to repair / replace / reinstall game files failed, I wrote the following script:

This is what I have been using:

Code: Select all

                        sleep, 250
                        Run, "G:\Games\DiRT\DiRT 3\dirt3_game.exe"
                        sleep, 500
                        GoSub, Label1
                        F11::                        ;key by 5 seconds, if no intro video (3 sec. window to react)
                        {
                                Run "G:\Games\DiRT\DiRT 3\LaunchDiRT3andKeymapping.vbs"
                                sleep, 1000
                                Process, Close, dirt3_game.exe
                                sleep, 250
                                ExitApp
                        }
                        Label1:
                        sleep, 14500
                        send {enter down}
                        sleep, 100
                        send {enter up}
                        sleep, 1000
                        send {enter down}
                        sleep, 100
                        send {enter up}
                        sleep, 1000
                        send {enter down}
                        sleep, 100
                        send {enter up}
#IfWinActive ahk_exe dirt3_game.exe
WinWaitNotActive, ahk_exe dirt3_game.exe
WinWaitClose, ahk_exe dirt3_game.exe
ExitApp
return
The above works flawlessly. However, i have been using "IfWin[Not]Exist" and variations to detect windows and process functions on many other games. I don't know how to detect a video file "Exist" or not, so hoping for some help.

I have tried the following, and a few variations. Even though the intro video begins to play (launch is successful)... the script is triggered and endlessly loops starting up.... lol:

Code: Select all

                        sleep, 250
                        Run, "G:\Games\DiRT\DiRT 3\dirt3_game.exe"
                        sleep, 5000
                        {
                           IfNotExist, AMD_sting.bik      <------ tried "ahk_exe AMD_sting.bik Unlike exe file, no Spy "window" process 
                           {
                                Run "G:\Games\DiRT\DiRT 3\LaunchDiRT3andKeymapping.vbs"
                                sleep, 1000
                                Process, Close, dirt3_game.exe
                                sleep, 250
                                ExitApp
                           }
                        }
                        sleep, 14500
                        send {enter down}
                        sleep, 100
                        send {enter up}
                        sleep, 1000
                        send {enter down}
                        sleep, 100
                        send {enter up}
                        sleep, 1000
                        send {enter down}
                        sleep, 100
                        send {enter up}
I am hoping my supreme overlord AHK enthusiasts can offer some help for :morebeard:

[Mod edit: Moved topic from AHK v2 help to v1 help, since this is not v2 code.]
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)
Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

Re: Detect if intro video begins playing

18 May 2023, 17:11

Woke up this morning and realized... I am approaching this wrong :oops:

I need to do some additional research :thumbup: I think I need WinWait, else, timer to make this work. Syntax is not likely correct here, but my script needs to wait for 7000ms and if "AMD_sting.bik" has begun playing, the script forego rebooting continue to load game, else reboot.

Code: Select all

                        
{
   WinWait, AMD_sting.bik, 7
   if ErrorLevel
   {
        Run "G:\Games\DiRT\DiRT 3\LaunchDiRT3andKeymapping.vbs"
        sleep, 1000
        Process, Close, dirt3_game.exe
        sleep, 250
        ExitApp
    }
       else
       Continue to load game
   }
Again, clearly I am not displaying this correct, but this is the series of events I am looking to create. Loop is a possible direction as well, but have only used Loop a single time, my familiarity is extremely limited, but will include this in my research :thumbup:

................ for further research, To the internet and BEYOND!

:morebeard:
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)
magicshow
Posts: 67
Joined: 14 Oct 2022, 11:38

Re: Detect if intro video begins playing

19 May 2023, 02:19

"I don't think WinWait or IfNotExist works that way. Maybe I am wrong, but they are used to check the title of a window, not to check a running file. Unless the game works in that way (which I have never seen before, maybe in a music player...),

I may just delete all the intro bik files or replace them with a blank bik file to skip the intro. That may even fix the crash caused by loading."
Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

Re: Detect if intro video begins playing

19 May 2023, 03:31

@magicshow ... I actually have replaced the loading videos with [blank] ones, but will clarify a bit. The edited video's are not the actual reason the game crashes, there is something wrong with the launching process of DiRT 3. There are thousands of comments about it, as well as many videos on YouTube with solutions people have found.

I was unable to get any of those solutions to work, so is why I have been using the "GoSub" (code displayed above) command to this point. I was recently able to get Borderlands: The Pre-Sequel to reboot upon crash, but THAT game has an error window splash, so "IfWinExist" was perfect. As you said though, this is a running file. I have gotten IfWinExist to detect .exe process windows, but this .bik file does not create a window I can detect. I don't even know if the file is played by my native Windows Media Player or if the game has a codex that plays it.

Thanks for input, I will keep searching. I can see that a timer with "else" is going to be necessary here, so can see now that my initial script would never work.
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)
magicshow
Posts: 67
Joined: 14 Oct 2022, 11:38

Re: Detect if intro video begins playing

19 May 2023, 04:45

I am not truly understand the situation here. (the first script)

So i can just guessing...
1. The enter pressing is to kill off the hanged game
2. I don't understand why use gosub here , if you move the hotkey f11(set) to bottom it will do the same without gosub.
3. This script will run the D3 first no matter what , so i don't understand how it can work with other games as a launcher . (maybe it is part , anyway...)
Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

Re: Detect if intro video begins playing

19 May 2023, 05:50

@magicshow ..... This is the series of events:

When launch works correctly:
1. approx 5 seconds in, there are 2 publisher promotional loading videos (exchanged with 1000ms [blank replacements] that create no issues)
2. I am watching for the [blank replacement] videos with finger hovered over the "F11" key, just in case
3. within about 2000ms the [blank replacement] videos can be seen and launch will be successful
4. 14000ms later, the Welcome screen appears and the series of AHK scripted "Enter" auto-navigate to the "Play game" button

When it fails and MUST use "GoSub" to restart or hard shut my PC:
1. approx 7 seconds in, if I have NOT yet seen the [blank replacement] videos, I will key "F11"
2. The "LaunchDiRT3andKeymapping.vbs" file has 2000ms delay prior to relaunching "DiRT3.exe" file
3. My "GoSub" script kills the CURRENT DiRT3.exe that has crashed, but not yet locked up keyboard control
4. The "GoSub" script kills all processes during the 2000ms timer running via .vbs file
5. I am now back to square 1, when I have to watch to see if THIS launch is successful.

There have been quite a few times, when I am required to key "F11" more than once, until the launch is successful. Granted, I am sure there are some times when I key "F11" too soon and game WOULD have launched correctly, but if I am 1000ms to late.... hard crash. I do believe I can skip the "GoSub" and move to another part of script, but this method helps me to wrap my head around the order of events. I am NOT a natural with code by any stretch, as I was blessed with natural mechanical ability to fix stuff. However, when it comes to code... my brain will turn to mush after a couple hours. If I have not played DiRT 3 in a while, I will open up the AHK file and quickly see what is necessary to avoid a crash of PC.

This script is only used for DiRT 3. My mentions of "IfWinExist" are in other scripts and used Borderlands: The Pre-Sequel as an example of one time. Before I came here for help, I tried variations of "IfWinExist", "WinWait", but "IfNotExist" seemed to make the most sense for this issue.

Thanks for your help :morebeard:
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)
magicshow
Posts: 67
Joined: 14 Oct 2022, 11:38

Re: Detect if intro video begins playing

19 May 2023, 08:28

It does sound a bit complicated. Here's a rough logic that I can suggest:

Use "SetTimer" command to create a timer that will do the following:

1. Check the first 7 seconds of the game launch and scan for white pixels in a specific area. (PixelSearch)

2. If no white pixels are found and the time is up, kill the DiRT3.exe process, sleep for 2 seconds and relaunch DiRT3.exe.

3. If the white pixels are found, run the LaunchDiRT3andKeymapping.vbs file and stop/delete the timer.

You can also add a kill switch for the whole script in case something goes wrong:
~esc & f1::
Process, Close, dirt3_game.exe
exitapp

Regarding the LaunchDiRT3andKeymapping.vbs file, you can dissolve it into the AHK script and include the necessary commands directly in the AHK code.
Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

Re: Detect if intro video begins playing

19 May 2023, 08:58

Yes, it is a bit complicated. This is part of the reason I needed help, so thanks :thumbsup:

1. I have not, to this point, used a "SetTimer", as I have never needed one. I now have that on my list of research to do
2. I don't know what you mean by "scan for white pixels". There are none visible during crashing, so I am lost on this one
3. I have since added a "kill switch" via additional "GoSub" script
NOTE: I recall now, why I put the "GoSub" within the auto-execute section. I have a Process, Close, [.exe] on every one
of my scripts (some 1400 or so), but for unknown reason, it will NOT work on this game. The only way
it works on DiRT 3, is if it is within a "GoSub" and in the auto-execute section... cannot tell you why
4. Yes, many of my games do launch and start various programs, via the AHK.exe file*. However, in this case, I
I cannot simultaneously kill and restart a single AHK.exe file... lol. I have a number of AHK_Launcher.exe
files that do similar jobs of this .vbs, but just have not done it with this game is all.


... scurries off to research "SetTimer"... thanks, @magicshow :morebeard:

*EDIT: Now, if there is some way in which to "terminate" the running of script and start over from beginning WITHOUT
having to close / restart that AHK.exe file, that is news to me. I have no doubt there is a way, but I am going to get this resolved, before
I add more to my research... lol
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)
Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

Re: Detect if intro video begins playing

19 May 2023, 15:16

@magicshow Something just occurred to me, as I was researching "SendTImer" function. Until I find a way for AHK to "see" the presence, or lack there of, the intro video file... a timer will not work anyway :( I will continue my research on it, as it will no doubt be useful, at this point, it will not resolve my immediate issue.

I have restored the ORIGINAL intro video files for testing. The 1000ms [black screen] replacements, may prove to be too short for AHK to read anyway. The first one is 6000ms long, so plenty of duration for a timer to end after the intro video has been playing for a second or two.

My little brain keeps churning on this, so expectations are high :thumbsup: :morebeard:
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)
magicshow
Posts: 67
Joined: 14 Oct 2022, 11:38

Re: Detect if intro video begins playing

20 May 2023, 02:02

Code: Select all

#NoEnv
#SingleInstance force
DetectHiddenWindows, on

; === Dont' add any hotkey or return line above this line
sleep 500
run, "c:\thegame.exe"
sleep 1500		; 
start_timer:=A_TickCount
settimer, hang_check, 150
return

hang_check:
start_sum:=A_Tickcount - start_timer
if (start_sum > 7000)
{
Process, Close, "C:\thegame.exe"
; or Process, CloseHandle, "C:\thegame.exe" - never used , don't know work or not

WinWaitClose, ahk_exe thegame.exe
sleep 150
run, "c:\thegame.exe" 
sleep 2000
start_timer:=A_TickCount
return
}

; Search for a pure white pixel in the search area
PixelSearch, foundX, foundY, 0, 0, 1, 1, 0xFFFFFF, 0, Fast RGB
sleep 100
if (foundX = "")
	return
if (FoundX <> "")
settimer, hang_check, delete	
sleepmore:= 15000 - start_sum
sleep %sleepmore%
run, "your_script.vbs"
return

;	Killswitch
~esc & f1::
WinWaitClose, ahk_exe thegame.exe
Process, Close, "C:\thegame.exe"
; or Process, CloseHandle, "C:\thegame.exe" - never used , don't know work or not
exitapp

This is that rough logic in beta script form. I didn't read the post in detail as it kept changing. Your situation is kind of complicated and rare to me, and I may even fail if I were to sit with your PC and observe how it crashed. I apologize for my limitations.

This is just a demo to show how SetTimer works (poorly written by me, of course XD). This is what I would/could do if I were in that situation.

Everyone feel free to fix or improve the script or solve this problem in different views. It's done on the fly without any testing and deep thinking. By the way, I've never used PixelSearch because i have failed a few times before, so.
Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

Re: Detect if intro video begins playing

20 May 2023, 03:23

@magicshow Oh my goodness... thank you for your WAY over the top investment in helping me try to figure this out :thumbsup:

As I look at your script, 95% of it is WAY beyond my comprehension of AHK :oops: I have been using it for like 8 or 9 years and here is an example of probably my MOST complex script that I use for one of the ONLY 2 browsers that "mostly" work on my octogenarian Win XP OS*:

Code: Select all

    sleep, 250
    FileDelete, %AllUsersProfile%\Start Menu\Programs\Accessories\Scanner and Camera Wizard.lnk                        ;created whenever iPad is accessed by PC
    sleep, 50
    Run, C:\Program Files\Firefox\Firefox.exe
    sleep, 1000                                                                                                        ;proven to be enough time for corrupted file to be created
    {
       IfExist, %AppData%\Mozilla\Firefox\Profiles\Evil-e\places.sqlite.corrupt                                        ;script executed if found {1st attempt)
       {
          BlockInput, On
          Menu, Tray, Icon, C:\Program Files\Firefox\Uninstall.exe, , 1                                                ;replacement System tray icon during corrupted Bookmarks repair
          WinWait, ahk_exe Firefox.exe
          WinMinimize, ahk_exe Firefox.exe                                                                             ;minimize screen during corrupted file repair
          Process, Close, Firefox.exe
          sleep, 4000                                                                                                  ;allow corruption repair (less time fails consistantly) 
          FileMove, %AppData%\Mozilla\Firefox\Profiles\Evil-e\places.sqlite.corrupt, %AppData%\Mozilla\Firefox\Profiles\Evil-e\places.sqlite, 1
          sleep, 500
          Run,  C:\Program Files\Firefox\Firefox.exe                                                                   ;restart browser after Bookmarks repair
          sleep, 750
          CoordMode, Mouse, Screen                                                                                     ;moves cursor to upper LH corner near short-cuts
          MouseMove,100,150,0
          Menu, Tray, Icon, C:\Program Files\Firefox\Firefox.exe, , 1                                                  ;restore Firefox System tray con after Bookmarks repair
          BlockInput, Off
       }
    }
    CoordMode, Mouse, Screen                                                                                           ;moves cursor to upper LH corner near short-cuts
    MouseMove,100,150,0
    {
       IfWinExist, ahk_exe Firefox.exe
       {
          WinActivate, ahk_exe Firefox.exe
          sleep, 250
          WinActivate, ahk_exe Firefox.exe
          sleep, 250
          WinActivate, ahk_exe Firefox.exe
          sleep, 250
          WinActivate, ahk_exe Firefox.exe
       }
    }
    sleep, 4000
    {
       IfWinNotExist, ahk_exe Firefox.exe                                                                              ;ExitApp if browser closed prior to auto-execute complete
       {
          CoordMode, Mouse, Screen
          MouseMove, 700, 980                                                                                          ;cursor moved lower center of screen
          ExitApp
       }
   }
#SingleInstance Ignore                                                                                                 ;disables program already running message
#IfWinActive, ahk_exe Firefox.exe
DetectHiddenWindows, On
WinWait, ahk_exe Firefox.exe
WinWaitClose, ahk_exe Firefox.exe
{
   IfWinExist, D3DOverrider ahk_class Afx:400000:20:10011:0:0                                                          ;skip actions if Google Chrome browser in use
   {
      Process, Close, D3DOverrider.exe                                                                                 ;close vertical Sync program
      BlockInput, On
      CoordMode, Mouse, Screen
      SendMode, Event
      MouseMove, 1750,1060,0                                                                                           ;clear cache from System Tray
      SendMode, Event
      MouseMove, 1845,1060,5
      SendMode, Event
      MouseMove, 700, 980                                                                                              ;cursor moved lower cetner of screen
      BlockInput, Off
   }
}
{
   IfWinNotExist, ahk_class Chrome_WidgetWin_1                                                                         ;skip actions if Google Chrome browser in use
   {
      WinMaximize, + Benjamin Boyce LINKS - WordPad ahk_class WordPadClass                                             ;restore Wordpad program to full-screen by default
      sleep, 50
      WinMaximize, + web site log-in and passwords - WordPad ahk_class WordPadClass                                    ;restore Wordpad program to full-screen by default
      sleep, 250
      WinClose, + Benjamin Boyce LINKS - WordPad ahk_class WordPadClass                                                ;in the event Benjamin Boyce LINKS file is left open
      sleep, 50
      WinClose, + web site log-in and passwords - WordPad ahk_class WordPadClass                                       ;in the event this log-in and passwords file is left open
      CoordMode, Mouse, Screen
      MouseMove, 700, 980                                                                                              ;cursor moved lower cetner of screen
   }
}
FileMove, %AppData%\Mozilla\Firefox\Profiles\Evil-e\places.sqlite.corrupt, %AppData%\Mozilla\Firefox\Profiles\Evil-e\places.sqlite, 1
sleep, 250
FileDelete, %AllUsersProfile%\Start Menu\Programs\Accessories\Scanner and Camera Wizard.lnk                            ;created whenever iPad is accessed by PC
sleep, 50  
FileRemoveDir, %AppData%\Mozilla\Firefox\Crash Reports, 1                                                              ;browser crash logs
sleep, 50
FileCopy, %AppData%\Mozilla\Firefox\Profiles\Evil-e\parent.lock, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e, 1
sleep, 50
Run, "C:\Program Files\Firefox\LAUNCHDeleteCacheItems_Firefox.vbs"                                                     ;Cleans Documents and Settings of hidden folder attributes and cache
ExitApp
ControlFocus, OK, Mozilla Firefox ahk_class MozillaWindowClass                                                         ;forces focus of browser when cursor is active
F1::                                                                                                                   ;extracts bookmarks with browser history
{
        BlockInput, On
        FileDelete, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e\sessionstore.js
        sleep, 50
        FileDelete, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e\cookies.sqlite
        sleep, 50
        FileDelete, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e\logins.json
        sleep, 50
        FileDelete, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e\places.sqlite
        sleep, 50
        FileDelete, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e\sessionCheckpoints.json
        sleep, 50
        FileDelete, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e\SiteSecurityServiceState.txt
        sleep, 50
        FileDelete, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e\xulstore.json
        sleep, 500
        FileCopy, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e\sessionstore.js, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e
        sleep, 50
        FileCopy, %AppData%\Mozilla\Firefox\Profiles\Evil-e\cookies.sqlite, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e
        sleep, 50
        FileCopy, %AppData%\Mozilla\Firefox\Profiles\Evil-e\logins.json, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e
        sleep, 50
        FileCopy, %AppData%\Mozilla\Firefox\Profiles\Evil-e\places.sqlite, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e
        sleep, 50
        FileCopy, %AppData%\Mozilla\Firefox\Profiles\Evil-e\sessionCheckpoints.json, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e
        sleep, 50
        FileCopy, %AppData%\Mozilla\Firefox\Profiles\Evil-e\SiteSecurityServiceState.txt, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e
        sleep, 50
        FileCopy, %AppData%\Mozilla\Firefox\Profiles\Evil-e\xulstore.json, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e
        sleep, 50
        FileCopy, %AppData%\Mozilla\Firefox\Profiles\Evil-e\sessionstore-backups\recovery.js, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e\sessionstore.js
        BlockInput, Off
}
return
F2::
{
        BlockInput, On                                                                                                 ;extracts bookmarks without browser history
        sleep, 50
        send {Ctrl down}                                                                                               ;opens Clear History dialog box
        sleep, 50
        send {Lshift down}
        sleep, 50
        send {delete down}
        sleep, 50
        send {delete up}
        sleep, 50
        send {Lshift up}
        sleep, 50
        send {Ctrl up}                                                                                                 ;waits for "Clear All History" dialog box to open
        {
           WinWait, Clear All History ahk_class MozillaDialogClass
           {
              send {enter down}
              sleep, 50
              send {enter up}
           }
        }
        sleep, 250
        FileDelete, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e\sessionstore.js
        sleep, 50
        FileDelete, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e\cookies.sqlite
        sleep, 50
        FileDelete, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e\logins.json
        sleep, 50
        FileDelete, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e\places.sqlite
        sleep, 50
        FileDelete, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e\sessionCheckpoints.json
        sleep, 50
        FileDelete, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e\SiteSecurityServiceState.txt
        sleep, 50
        FileDelete, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e\xulstore.json
        sleep, 500
        FileCopy, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e\sessionstore.js, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e
        sleep, 50
        FileCopy, %AppData%\Mozilla\Firefox\Profiles\Evil-e\cookies.sqlite, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e
        sleep, 50
        FileCopy, %AppData%\Mozilla\Firefox\Profiles\Evil-e\logins.json, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e
        sleep, 50
        FileCopy, %AppData%\Mozilla\Firefox\Profiles\Evil-e\places.sqlite, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e
        sleep, 50
        FileCopy, %AppData%\Mozilla\Firefox\Profiles\Evil-e\sessionCheckpoints.json, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e
        sleep, 50
        FileCopy, %AppData%\Mozilla\Firefox\Profiles\Evil-e\SiteSecurityServiceState.txt, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e
        sleep, 50
        FileCopy, %AppData%\Mozilla\Firefox\Profiles\Evil-e\xulstore.json, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e
        sleep, 50
        FileCopy, %AppData%\Mozilla\Firefox\Profiles\Evil-e\sessionstore-backups\recovery.js, G:\Games\+ FireFox browser\+ Profile\Mozilla\Firefox\Profiles\Evil-e\sessionstore.js
        BlockInput, Off
}
return
F3::                                                                                                                   ;"Tap" opens + web site log-in and passwords "Hold" closes file
keywait,F3,t.2                                                                                                         ;"Hold" 200ms will close file when focus on browser window
if (errorlevel) {
        ControlSend, + web site log-in and passwords - WordPad ahk_class WordPadClass                                  ;sends commands "+ web site log-in and passwords.rtf" while out of focus
        sleep, 250
        WinMaximize, + web site log-in and passwords - WordPad ahk_class WordPadClass                                  ;maximizes "+ web site log-in and passwords.rtf" while remaining out of focus
        sleep, 250
        WinClose, + web site log-in and passwords - WordPad ahk_class WordPadClass                                     ;closes "+ web site log-in and passwords.rtf" after setting Wordpad to open fullscreen
        sleep, 250
        CoordMode, Mouse, Screen                                                                                       ;moves cursor near center of the screen
        MouseMove,1000,600,0
} else {
        ControlSend, ahk_class Chrome_WidgetWin_1
        Run, "C:\Program Files\Google Chrome\+ web site log-in and passwords.rtf", ,Min                                ;launches "+ web site log-in and passwords.rtf" minimized to system tray
        sleep, 250
        WinActivate, + web site log-in and passwords - WordPad ahk_class WordPadClass                                  ;sets as active window
        sleep, 50
        WinActivate, + web site log-in and passwords - WordPad ahk_class WordPadClass
        sleep, 50
        WinActivate, + web site log-in and passwords - WordPad ahk_class WordPadClass
        sleep, 50
        WinWaitActive, + web site log-in and passwords - WordPad ahk_class WordPadClass                                ;sets this window to apply following script
        WinGet, window, ID, A
	TargetX := (A_ScreenWidth/2)-(Width/2)                                                                         ;sets horizontal target for window as 1/2 of screen width
	TargetY := (A_ScreenHeight/2)-(Height/2)                                                                       ;sets horizontal target for window as 1/2 of screen hight
        WinMove, ahk_id %window%, ,400 ,400 ,1000 ,600                                                                 ;window position: from LH side , from top , width , hight
        CoordMode, Mouse, Screen                                                                                       ;moves cursor near center "+ web site log-in and passwords.rtf"
        MouseMove,1000,600,0
}
return
F4::                                                                                                                   ;"Tap" opens + Benjamin Boyce LINKS "Hold" closes file
keywait,F4,t.2                                                                                                         ;"Hold" 200ms will close file when focus on browser window
if (errorlevel) {
        ControlSend, + Benjamin Boyce LINKS - WordPad ahk_class WordPadClass                                           ;sends commands "+ Benjamin Boyce LINKS.rtf" while out of focus
        sleep, 250
        WinMaximize, + Benjamin Boyce LINKS - WordPad ahk_class WordPadClass                                           ;maximizes "+ Benjamin Boyce LINKS.rtf" while remaining out of focus
        sleep, 250
        WinClose, + Benjamin Boyce LINKS - WordPad ahk_class WordPadClass                                              ;closes "+ Benjamin Boyce LINKS.rtf" after setting Wordpad to open fullscreen
        sleep, 250
        CoordMode, Mouse, Screen                                                                                       ;moves cursor near center of the screen
        MouseMove,1000,600,0
} else {
        Run, "C:\Program Files\Google Chrome\+ Benjamin Boyce LINKS.rtf", ,Min                                         ;launches "+ Benjamin Boyce LINKS.rtf" minimized to system tray
        sleep, 250
        WinActivate, + Benjamin Boyce LINKS - WordPad ahk_class WordPadClass                                           ;sets as active window
        sleep, 50
        WinActivate, + Benjamin Boyce LINKS - WordPad ahk_class WordPadClass
        sleep, 50
        WinActivate, + Benjamin Boyce LINKS - WordPad ahk_class WordPadClass
        sleep, 50
        WinWaitActive, + Benjamin Boyce LINKS - WordPad ahk_class WordPadClass                                         ;sets this window to apply following script
        WinGet, window, ID, A
	TargetX := (A_ScreenWidth/2)-(Width/2)                                                                         ;sets horizontal target for window as 1/2 of screen width
	TargetY := (A_ScreenHeight/2)-(Height/2)                                                                       ;sets horizontal target for window as 1/2 of screen hight
        WinMove, ahk_id %window%, ,400 ,400 ,1000 ,600                                                                 ;window position: from LH side , from top , width , hight
        CoordMode, Mouse, Screen                                                                                       ;moves cursor near center "+ web site log-in and passwords.rtf"
        MouseMove,1000,600,0
}
return
F5::                                                                                                                   ;"Tap" launches D3DOverrider
keywait,F5,t.2                                                                                                         ;"Hold" closes D3DOverrider and clears icon cache
if (errorlevel) {
      Process, Close, D3DOverrider.exe                                                                                 ;close vertical Sync program
      BlockInput, On
      CoordMode, Mouse, Screen
      SendMode, Event
      MouseMove, 1750,1060,0                                                                                           ;clear cache from System Tray
      SendMode, Event
      MouseMove, 1845,1060,5
      SendMode, Event
      MouseMove, 700, 980                                                                                              ;cursor moved lower cetner of screen
      BlockInput, Off
} else {
        Run, C:\Program Files\Firefox\D3DOverrider\D3DOverrider.exe                                                    ;launches D3DOverrider Vsync program
}
return
F12::Run, "C:\Program Files\Firefox\Keymapping_Kill_Firefox_and_Chrome_1.exe"                                          ;Complete restoration of Google Chrome / Firefox browsers
return
MButton::                                                                                                              ;"Tap" cycles Dark Mode
keywait,MButton,t.2                                                                                                    ;"Hold" 200ms saves bookmark to toolbar
if (errorlevel) {
        BlockInput, On                                                                                                 ;create Toolbar bookmark of current webpage
        CoordMode, Mouse, Screen
        MouseMove, 1788,48,2                                                                                           ;add Bookmark
        sleep, 500
        send {LButton down}
        sleep, 50
        send {LButton up}
        sleep, 250
        CoordMode, Mouse, Screen
        MouseMove, 1824,80,2                                                                                           ;save Bookmark (long script to overcome loading lag)
        sleep, 50
        send {LButton down}
        sleep, 5
        send {LButton up}
        sleep, 150
        send {LButton down}
        sleep, 5
        send {LButton up}
        sleep, 150
        send {LButton down}
        sleep, 5
        send {LButton up}
        sleep, 150
        send {LButton down}
        sleep, 5
        send {LButton up}
        sleep, 150
        send {LButton down}
        sleep, 5
        send {LButton up}
        sleep, 150
        send {LButton down}
        sleep, 5
        send {LButton up}
        CoordMode, Mouse, Screen
        MouseMove, 1824,354,0                                                                                          ;cursor upper RH side of webpage
        BlockInput, Off
} else {
        CoordMode, Mouse, Screen                                                                                       ;moves cursor over "Dark Mode" on / off switch
        MouseMove,1857,51,0
        send {LButton down}                                                                                            ;cycles "Dark Mode" on / off
        sleep, 50
        send {LButton up}
        CoordMode, Mouse, Screen                                                                                       ;moves cursor 1"x 6" down RH top of screen
        MouseMove,1860,350,0
}
return                                                                                                                 ;these block keys from various actions  (^=Ctrl / +=LShift / !=ALt / #=Windows)
^+::
tooltip,blocked                                                                                                        ;Disables "Ctrl+LShift"
sleep,50
tooltip
return
^!::                                                                                                                   ;Disables "Ctrl+Alt"
tooltip,blocked
sleep,50
tooltip
return
^#::                                                                                                                   ;Disables "Ctrl+Win"
tooltip,blocked
sleep,50
tooltip
Alt::                                                                                                                  ;Disables "Options Menu"
tooltip,blocked
sleep,50
tooltip
LWin::                                                                                                                 ;Disables "Left Windows"
tooltip,blocked
sleep,50
tooltip
RWin::                                                                                                                 ;Disables "Right Windows"
tooltip,blocked
sleep,50
tooltip
PgUp::                                                                                                                 ;Disables "Scrolling up"
tooltip,blocked
sleep,50
tooltip
PgDn::                                                                                                                 ;Disables "Scrolling down"
tooltip,blocked
sleep,50
tooltip
return
The above is 100% unrelated to my problem with DiRT 3, but much of what I wrote here is from knowledge of only the last 1 year. Up until this past year, 98% of my 1400+ scripts are WSAD = EDSF and hot keys. In short the language in your script is light years over my head :oops:

Do not misunderstand, my appreciation for your help is as over the top as your willingness to write that script for me. However, unless it were to work flawlessly as it stands (short of directory / file name changes), I would have literally ZERO idea of where to begin looking to figure out what went wrong. I can see it is doing a pixel search, but that is all I know. again.... :oops:

I will do some research on "pixel search", as there is a failing game code issue that is happening in processing launch, but all that I see is either the loading video's begin playing or they don't and I key "F11" to restart. Amazing that you wrote this script to help me, but I don't have the AHK knowledge to work with it... I am sorry :(

Thank you VERY much for all of your effort, but this is too complicated for me to understand :morebeard:

*I have EXTREMELY customized my Win XP, deep into System32 critical operation files and Bill Gates would DEFINITELY not approve!... :dance:
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)
Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

Re: Detect if intro video begins playing

21 May 2023, 21:06

@magicshow ... I wanted to thank you again for your help and the script you wrote for me :thumbsup: I did try it today and changed the appropriate files / address as necessary to meet my directory and files. I did my best to incorporate it into my script and made the best sense of it I could, given my very limited knowledge about most of the syntax of it.

The game crashed and kept an eye out for anything different. Unfortunately, I was unable to gain anything new to add, so just wanted to let you know that I appreciate your help and tried to make it work :morebeard:
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)
magicshow
Posts: 67
Joined: 14 Oct 2022, 11:38

Re: Detect if intro video begins playing

22 May 2023, 01:36

I'm sorry to hear that. I understand your situation is difficult, so I can only offer suggestions and a demo to try (or study). I'm not a programmer at all, so what I do when faced with problems is trial and error, expecting bugs and failures. I don't care what method it is(endup), as long as it solves the problem. Anyway, good luck with everything, and have a good day, everyone.
Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

Re: Detect if intro video begins playing

22 May 2023, 09:12

@magicshow ... Though I did not find a solution to this issue, I am a bit more knowledgeable on AHK code :thumbsup: I am also pretty burned out on this particular issue, so I am gonna step back for a bit and move onto WinGet PID for identifying my browser windows of the same name.

I will get back to this and maybe somebody will stumble by the title then share a bit of info that may further or even solve it. Keep up the good fight, magic and may we find the key to life buried within an AHK script... :dance:

cheers :beer:

:morebeard:
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Chunjee and 45 guests