Sign in to follow this  
Followers 0
VRANii

problem at script for bsplayer

6 posts in this topic

In this script i am trying to do next. If you have internet connection you get codec list to download, and if you don't have it you get error window. So i am trying to make this script working for hours, but no success. Here is code

Run($SF_1)

WinWaitActive("BS.Player PRO Setup", "License Agreement")
ControlClick("BS.Player PRO Setup", "I &Agree", "Button2")

WinWaitActive("BS.Player PRO Setup", "Welcome to the BS.Player PRO Setup Wizard")
ControlClick("BS.Player PRO Setup", "&Next >", "Button2")

WinWaitActive("BS.Player PRO Setup", "Choose Components")
ControlClick("BS.Player PRO Setup", "&Next >", "Button2")

WinWaitActive("BS.Player PRO Setup", "Choose Install Location")
ControlClick("BS.Player PRO Setup", "&Next >", "Button2")

WinWaitActive("BS.Player PRO Setup", "Additional install options")
ControlClick("BS.Player PRO Setup", "&Next >", "Button2")

WinWaitActive("BS.Player PRO Setup", "Language")
ControlClick("BS.Player PRO Setup", "&Install", "Button2")


If WinWait("BS.Player", "Do you want BS.Player to download and install missing codecs?") Then
    ControlClick("BS.Player", "&Yes", "Button1")
EndIf

If WinWait("Error") Then
    ControlClick("Error", "OK", "Button1")

EndIf

WinWaitActive("BS.Player PRO Setup", "Installation Complete")
ControlClick("BS.Player PRO Setup", "&Next >", "Button2")

WinWaitActive("BS.Player PRO Setup", "Completing the BS.Player PRO Setup Wizard")
ControlClick("BS.Player PRO Setup", "&Finish", "Button2")

Problem start at IF statements. So if i have only one IF it works great, but when i give another it just don't work ;)

Any solution?

Share this post


Link to post
Share on other sites



If WinWait("Error", "", 30) Then
    ControlClick("Error", "OK", "Button1")

EndIf

try that out

[size="2"] "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." - Brian Kernighan[/size]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

try that out

i tried that.. but it doesn't work.. Then if i rotate code like this, work first if, and second don't..

If WinWait("Error") Then
    ControlClick("Error", "OK", "Button1") 
EndIf

If WinWait("BS.Player", "Do you want BS.Player to download and install missing codecs?") Then
    ControlClick("BS.Player", "&Yes", "Button1")
EndIf
Edited by VRANii

Share this post


Link to post
Share on other sites

Don't use winwait, it pauses the script until that window appears.

if it is always going to be one of those 2 windows, use winexists in a loop that will check until the appropriate window appears, something like:

while 1
if winexists("BS.Player", "Do you want BS.Player to download and install missing codecs?") Then
ControlClick("BS.Player", "&Yes", "Button1")
exitloop
elseif winexists("Error") Then
ControlClick("Error", "OK", "Button1")
exitloop
endif
sleep(10)
wend

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

Don't use winwait, it pauses the script until that window appears.

if it is always going to be one of those 2 windows, use winexists in a loop that will check until the appropriate window appears, something like:

while 1
if winexists("BS.Player", "Do you want BS.Player to download and install missing codecs?") Then
ControlClick("BS.Player", "&Yes", "Button1")
exitloop
elseif winexists("Error") Then
ControlClick("Error", "OK", "Button1")
exitloop
endif
sleep(10)
wend

thank you, problem solved. I tried WinExists but i writed it wrong. But now with your code it works great.

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