Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- ; dialogbox, features read from "ActiveWindowInfoInclude"
- /*
- Window title, Class and Process
- PeerBlock Portable (PortableApps.com Launcher)
- ahk_class #32770
- ahk_exe PeerBlockPortable.exe
- Mouse Position
- Absolute: 437, 670 (less often used)
- Relative: 363, 103 (default)
- Client: 360, 74 (recommended)
- Control Under Mouse Position (musepeker over OK-knappan)
- ClassNN: Button1
- Text: OK
- Color: F1F1ED (Red=F1 Green=F1 Blue=ED)
- Active Window Position
- x: 74 y: 567 w: 726 h: 126
- Client: w: 720 h: 94
- Visible Text (same as "All Text")
- OK
- PeerBlock Portable did not close properly last time it was run and will now clean up. Please then start PeerBlock Portable again manually.
- */
- tryStartAgain:
- ; Launc the program
- Run, PeerBlockPortable.exe
- ; Searching for errormessage (only if dialogbox size matchhes given criterias)
- ; Last about ten seconds. Then stop searching.
- Loop, 100
- {
- If (windowSizeMatchErrorMsg()) {
- WinActivate, PeerBlock Portable (PortableApps.com Launcher)
- Sleep, 100
- Click 363, 103 ; OK button
- Sleep 500
- Goto, tryStartAgain
- Break
- }
- Else
- Sleep 100
- }
- ; Returns 1 if active window have matching size
- windowSizeMatchErrorMsg() {
- IfWinExist, PeerBlock Portable (PortableApps.com Launcher)
- {
- ; Gathering basic info about window
- WinGetPos, X, Y, Width, Height, PeerBlock Portable (PortableApps.com Launcher)
- If (Width=726 && (Height=126 || Height=119)) {
- Return 1
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement