Sign in to follow this  
Followers 0
Ravel

Quick help

5 posts in this topic

I have this script below and i would like for it to open a program which it does just fine, however I would like the rest of the script to pause until the program is up and running. Then after its up and running proceed with the remainder of the the script. Can you all take a look at this and tell me what i have done wrong? thanks.

HotkeySet('{ESC}', 'Terminate')

Send("^!p"); sends shortcut key stroke to start program

WinWaitActive("Delta Force, V1.5.0.5")

Sleep(5000)

Send("+m");multiplayer

Sleep(1000)

Send("+j");join

Sleep(4000)

MouseClick("left", 488, 454,);user

Sleep(100)

Send("---edit---")

Sleep(100)

MouseClick("left", 516, 485,);pass

Sleep(100)

Send("---edit---{ENTER}")

Sleep(6000)

MouseClick("left", 650, 269,);server window

Sleep(16000)

MouseClick("left", 681, 436,);find link

Sleep(500)

MouseClick("left", 87, 181,);blackhawk word search

Sleep(100)

Send("blackhawk{ENTER}")

Sleep(500)

MouseClick("left", 317, 246,);blackhawk TDM

Func Terminate()

Exit

EndFunc

Share this post


Link to post
Share on other sites



I have this script below and i would like for it to open a program which it does just fine, however I would like the rest of the script to pause until the program is up and running. Then after its up and running proceed with the remainder of the the script. Can you all take a look at this and tell me what i have done wrong? thanks.

HotkeySet('{ESC}', 'Terminate')

Send("^!p"); sends shortcut key stroke to start program

WinWaitActive("Delta Force, V1.5.0.5")

Sleep(5000)

Send("+m");multiplayer

Sleep(1000)

Send("+j");join

Sleep(4000)

MouseClick("left", 488, 454,);user

Sleep(100)

Send("---edit---")

Sleep(100)

MouseClick("left", 516, 485,);pass

Sleep(100)

Send("---edit---{ENTER}")

Sleep(6000)

MouseClick("left", 650, 269,);server window

Sleep(16000)

MouseClick("left", 681, 436,);find link

Sleep(500)

MouseClick("left", 87, 181,);blackhawk word search

Sleep(100)

Send("blackhawk{ENTER}")

Sleep(500)

MouseClick("left", 317, 246,);blackhawk TDM

Func Terminate()

Exit

EndFunc

if the winwaitactive()'s aren't doing it for you, one thing you could do is do a pixelchecksum of an area of the screen to make sure that the correct window is open. I have to do that sometimes while waiting for child windows. i made a script recently to automatically import some fixed with files into excel. Because of different values in the file, excel's guesses on where the column breaks should be were often wrong, so my script waited for the import window, then removed all of the automatic column breaks, then reinserted them in the correct places. anyway, enough talk, here's a code example to illustrate my suggestion.

;this is the entire code of my import script.  it's called when the workbook opens, then it opens all files
;in the directory, then uses checksum to wait for the child window then continue.  right now i have it calling
;the function by Send()'ing the hotkey for the function, that's because this was originally 2 scripts, one 
;that  had a hotkey, and one that did the import, and i just combined them but didn't switch it to a 
;normal function call.  
HotKeySet("+7","lines")
Opt("TrayIconDebug",1)
Opt("WinTitleMatchMode",4)
if WinExists("Microsoft Excel - NRMacros.xls") Then
    WinActivate("Microsoft Excel - NRMacros.xls")
Else
    WinWait("Microsoft Excel - NRMacros.xls")
    WinActivate("Microsoft Excel - NRMacros.xls")
EndIf
Send("^o")
WinWaitActive("Open")
dim $toopen
Select
case @WDAY = 2
    $toopen = "l:\customer care center\not ready files\"& @MON & "-" & @MDAY-3 & "-" & StringRight(@YEAR,2) & "\*.*"
case Else
    $toopen = "l:\customer care center\not ready files\"& @MON & "-" & @MDAY-1 & "-" & StringRight(@YEAR,2) & "\*.*"
EndSelect
ControlSetText("Open","",54,$toopen)
ControlSend("Open","",54,"{ENTER}")
Sleep(500)
MouseClickDrag("LEFT",578,556,108,229,0)
ControlSend("Open","",54,"{ENTER}")
while 1
    Sleep(100)
$test = PixelChecksum(47,278,542,388)
if $test = 4105860283 Then Send("{ENTER}+7")
WEnd
Func lines()
While 1
$line = PixelSearch(63,473,517,473,0x000000)
If @error Then ExitLoop
MouseClick("LEFT",$line[0],$line[1],2,2)
WEnd
MouseClick("Left",130,478,1,0)
MouseClick("Left",138,478,1,0)
MouseClick("Left",193,478,1,0)
MouseClick("Left",215,478,1,0)
MouseClick("Left",502,594,1,0)
EndFunc

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

opt ("WinTitleMatchMode",2)

HotkeySet('{ESC}', 'Terminate')
Send("^!p"); sends shortcut key stroke to start program

WinWaitActive("Delta Force")

Take out your top few lines and replace with this, im stabbing in the dark here but its possible your window title is wrong

by using wintitlematchmode,2 window can be found just by delta or force etc...

Test this and see.

HardCopy

LoL , Beaten to it, I see an unanswered post, I refresh, I check again, then dive in, Boom, i'm either slow at typing or Camerons Dad is Superman.!!!

Edited by HardCopy

Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

Share this post


Link to post
Share on other sites

opt ("WinTitleMatchMode",2)

HotkeySet('{ESC}', 'Terminate')
Send("^!p"); sends shortcut key stroke to start program

WinWaitActive("Delta Force")

Take out your top few lines and replace with this, im stabbing in the dark here but its possible your window title is wrong

by using wintitlematchmode,2 window can be found just by delta or force etc...

Test this and see.

HardCopy

LoL , Beaten to it, I see an unanswered post, I refresh, I check again, then dive in, Boom, i'm either slow at typing or Camerons Dad is Superman.!!!

just shows i have more free time on my hands while at work... :lmao: and i'm usually a pretty quick typist in the afternoons. when i am really flying i can break 100 words per minute no problem, but i never post that fast because i'm thinking of what to say as i'm typing it, that slows me down vs doing a typing test. as far as beating you to it, i'm sure he doesn't mind having more than one solution to his problem.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

opt ("WinTitleMatchMode",2)

HotkeySet('{ESC}', 'Terminate')
Send("^!p"); sends shortcut key stroke to start program

WinWaitActive("Delta Force")

Take out your top few lines and replace with this, im stabbing in the dark here but its possible your window title is wrong

by using wintitlematchmode,2 window can be found just by delta or force etc...

Test this and see.

HardCopy

LoL , Beaten to it, I see an unanswered post, I refresh, I check again, then dive in, Boom, i'm either slow at typing or Camerons Dad is Superman.!!!

Thanks. That worked like a charm. I appreciate it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0