Jump to content

If WinExist help


Recommended Posts

I am making a script to install roxio 7. Some of the computers in my LAN have an older version or don't have it installed correctly. If the current machine already has roxio, I get different windows then I would if it were not previously installed. I think "If WinExist" is the appropriate way to do this, but I can't get it to work. The script runs fine up to Send ( '{Tab}' ) . Then it just stops. I don't know if it can even see the second window.

Run ( 'setup.exe /S /v /qn' )

WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'WARNING: This program is protected by copyright law and international treaties.' )

Send ( '{ENTER}' )

if WinExists ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Welcome to the InstallShield Wizard for Roxio Easy Media Creator 7 Basic DVD Edition' ) then

Send ( '{Tab}' )

Send ( '{Enter}' )

Send ( 'y' )

Send ( '{Enter}' )

if NOT WinExists ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Please read the following license agreement carefully.' ) then

endif ; Continue

endif

Link to comment
Share on other sites

I am making a script to install roxio 7.......

you don't give time for installation program to show the 2nd windows after sending the first Enter.

you must insert a winwait instruction like

Winwait ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard')

so, you will check what kind of window appears at the good time : after one of the 2 possibles windows appears.

An other way is to first check if your older version of roxio exists on the computer, deinstal it if present and then install without having this sort of question.. :P

Link to comment
Share on other sites

Are your silent switches not working ?

I normally add double quotes around the /qn so anything within the double quotes is passed to the extracted msi.

Run (@ScriptDir & '\setup.exe /S /v"/qn"' )

Others I've seen leave no spaces between /v and /qn

Run (@ScriptDir & '\setup.exe /S /v/qn' )
Link to comment
Share on other sites

Are your silent switches not working ?

I normally add double quotes around the /qn so anything within the double quotes is passed to the extracted msi.

Run (@ScriptDir & '\setup.exe /S /v"/qn"' )

Others I've seen leave no spaces between /v and /qn

Run (@ScriptDir & '\setup.exe /S /v/qn' )

It doesn't run at all when I use either of those options.

What is the correct syntax for winwait?

I just want the script to wait for 10 seconds before continuing.

Winwait (1000)

Edited by matthewst
Link to comment
Share on other sites

Use WinWaitActive as you have already used in your script for the other windows. WinExists is mostly good within loops or within a Adllb function. WinWait is good when using Control* functions to manipulate the window controls that do not need to be active.

Edited by MHz
Link to comment
Share on other sites

Use WinWaitActive as you have already used in your script for the other windows.

I can't seem to get that to work either.

Run ( 'setup.exe /S /v /qn' )

WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'WARNING: This program is protected by copyright law and international treaties.' )

Send ( '{ENTER}' )

Everything runs fine until here. Then it just stops.

WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'The InstallShield® Wizard will allow you to modify, repair, or remove Roxio Easy Media Creator 7 Basic DVD Edition. To continue, click Next.' )

Send ( '{Tab}' )

Send ( '{Enter}' )

this is the reveal mode text for the second window

>>>> Window Title <<<<

Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard

>>>> Window Dimensions <<<<

X: 244 Y: 129 Width: 504 Height: 386

>>>> Mouse Co-ords (relative to active window) <<<<

X: 259 Y: 329

>>>> Window Text <<<<

&Next >

Cancel

< &Back

NewBinary20

The InstallShield® Wizard will allow you to modify, repair, or remove Roxio Easy Media Creator 7 Basic DVD Edition. To continue, click Next.

Welcome to the InstallShield Wizard for Roxio Easy Media Creator 7 Basic DVD Edition

what am i doing wrong?

Link to comment
Share on other sites

The second window text has change from your 1st post. You now have Roxio installed and are processing the Add/remove window ?

You can also trim down those strings to a small length. AutoIt reads from the left so a string like "123456789" can be shortened to "123".

Use Opt('TrayIconDebug', 1) at the top of your script and hover the mouse over the systray icon to see which line that the script is at.

Try adding a Sleep(1000) just before you send the Tab.

Link to comment
Share on other sites

ok, heres the full scoop

I need to install roxio 7 on several machines

some already have roxio 7, some have an older version

if they have roxio 7 I need the script to restart the machine and thats it

if they have an older version of roxio I need the script to use the "remove older version" function

then continue with the roxio 7 install

no matter the roxio version (if any) the first window will be identical

however there could be 3 different versions of the second window

how do I deal with that?

I've tried "if winexist" but couldn't get it to work

here is the entire script

it jump to the "are you sure you want to cancle window" but it doesn't send the "y"

Opt('TrayIconDebug', 1)

Run ( 'setup.exe /S /v /qn' )

WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Welcome to the InstallShield 

Wizard for Roxio Easy Media Creator 7 Basic DVD Edition' )
Send ( '{Enter}' )

WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Change which program features 

are installed.' )
Send ( '{Tab}' )
Send ( '{Tab}' )
Send ( '{Tab}' )
Send ( '{Enter}' )

WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Are you sure you want to cancel 

Roxio Easy Media Creator 7 Basic DVD Edition installation?' )
Send ( 'y' )

WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Click Finish to exit the 

wizard.' )
Send ( '{Enter}' )

WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'The wizard was interrupted 

before Roxio Easy Media Creator 7 Basic DVD Edition could be completely installed.' )
Send ( '{Enter}' )

WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'WARNING: This program is 

protected by copyright law and international treaties.' )
Send ( '{ENTER}' )

WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Please read the following 

license agreement carefully.' )
Send ( 'a' )
Send ( '{ENTER}' )

WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Please enter your information.' 

)
Send ( '{ENTER}' )
 
WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Please select a setup type.' )
Send ( '{ENTER}' )

WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Show the readme file' )
Send ( '{Tab}' )
Send ( '{Space}' )
Send ( '{Tab}' )
Send ( '{Space}' )
Send ( '{Tab}' )
Send ( '{Tab}' )
Send ( '{Tab}' )
Send ( '{Space}' )
Send ( '{Enter}' )

WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'InstallShield Wizard Completed' 

)
Send ( '{Enter}' )

WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition Installer Information', 'You must restart your system for 

the configuration changes made to Roxio Easy Media Creator 7 Basic DVD Edition to take effect.' )
Send ( 'Y' )
Edited by matthewst
Link to comment
Share on other sites

1 Suggestion

you should try to use

ControlSend()

to replace

Send()

you can use au3info to get the controls

2 version

example

$new_ver = "6.0.2900.2180"
$ver = FileGetVersion("Explorer.exe")

If $ver = $new_ver then
    MsgBox(0, "Explorer version", $ver)
; exit... restart
EndIf

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

ok, heres the full scoop

I need to install roxio 7 on several machines

some already have roxio 7, some have an older version

if they have roxio 7 I need the script to restart the machine and thats it

if they have an older version of roxio I need the script to use the "remove older version" function

then continue with the roxio 7 install

no matter the roxio version (if any) the first window will be identical

however there could be 3 different versions of the second window

how do I deal with that?

I've tried "if winexist" but couldn't get it to work

here is the entire script

it jump to the "are you sure you want to cancle window" but it doesn't send the "y"

Ok, so you want to script the Add/remove windows as well. AdlibEnable() should be able to take care of them as they may not always show. Sending the "y" perhaps does not work as it may need Alt to be pressed also.

I have taken a guess of the installation sequence below with changes. I have added some variables to try and save a visual repeat of your long strings.

Opt('TrayIconDebug', 1)

$title_1 = 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard'
$title_2 = 'Roxio Easy Media Creator 7 Basic DVD Edition Installer Information'

Run ( 'setup.exe /S /v /qn' )

WinWaitActive ( $title_1, 'Welcome to the InstallShield Wizard for Roxio Easy Media Creator 7 Basic DVD Edition' )
Send ( '{Enter}' )

AdlibEnable('_Adlib')

WinWaitActive ( $title_1, 'WARNING: This program is protected by copyright law and international treaties.' )
Send ( '{ENTER}' )

WinWaitActive ( $title_1, 'Please read the following license agreement carefully.' )
Send ( 'a{ENTER}' )

AdlibDisable()

WinWaitActive ( $title_1, 'Please enter your information.' )
Send ( '{ENTER}' )

WinWaitActive ( $title_1, 'Please select a setup type.' )
Send ( '{ENTER}' )

WinWaitActive ( $title_1, 'Show the readme file' )
Send ( '{Tab}{Space}{Tab}{Space}{Tab 3}{Space}{Enter}' )

WinWaitActive ( $title_1, 'InstallShield Wizard Completed' )
Send ( '{Enter}' )

WinWaitActive ( $title_2, 'You must restart your system for the configuration changes made' )
Send ( 'Y' )

Func _Adlib()
    If WinExists ( $title_1, 'Change which program features are installed.' ) Then
        WinActivate($title_1, 'Change which program features are installed.')
        Send ( '{Tab 3}{Enter}' )
    
        WinWaitActive ( $title_1, 'Are you sure you want to cancel Roxio Easy Media Creator 7 Basic DVD Edition' )
        Send ( '!y' )
    
        WinWaitActive ( $title_1, 'Click Finish to exit the wizard.' )
        Send ( '{Enter}' )
    
        WinWaitActive ( $title_1, 'The wizard was interrupted before Roxio Easy Media Creator 7 Basic DVD Edition' )
        Send ( '{Enter}' )
    EndIf
EndFunc

Edit: Added WinActivate() within _Adlib() function

Edited by MHz
Link to comment
Share on other sites

...however there could be 3 different versions of the second window

how do I deal with that?

Does this layout make sense to you:

run whatever

winwaitactive - window #1

send stuff to window #1

while 1 <<<< just keep looping the code below >>>>

if winexits("possible window #2a") then

func w2a

exitloop

endif

if winexits("possible window #2b") then

func w2b

exitloop

endif

if winexits("possible window #2c") then

func w2c

exitloop

endif

sleep(100)

wend <<<< just keep looping the code above >>>>

continue on with your code....

Func w2a

do stuff for window #2a

do stuff for any other windows that come with #2a

endfunc

Func w2b

do stuff for window #2b

do stuff for any other windows that come with #2b

endfunc

Func w2c

do stuff for window #2c

do stuff for any other windows that come with #2c

endfunc

Caveat: MHz knows more than I do and he wrote you some real code. You might want to stick with him.

@Valuater,

Sorry - no code box around my pseudo code. :-)

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

  • 2 weeks later...

GOT IT!!!!!!!!!

Thanks everyone

Opt('TrayIconDebug', 1)

Run ( 'setup.exe /S /v /qn' )

Sleep(70000)



If WinExists ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'WARNING: This program is protected by copyright law and international treaties.' ) Then
send ( '{Enter}' )
EndIf

If WinExists ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Welcome to the InstallShield Wizard for Roxio Easy Media Creator 7 Basic DVD Edition' ) Then
send ( '{Enter}' )
EndIf

If WinExists ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'License Agreement' ) Then
WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'License Agreement')
Send ( 'A' )
Send ( '{ENTER}' )
EndIf

If WinExists ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Customer Information' ) Then  
WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Customer Information' )
Send ( '{ENTER}' )
Sleep (20000)
Send ( '{ENTER}' )
EndIf

Sleep (10000)
If WinExists ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Previous Versions Detected' ) Then
WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Previous Versions Detected' )
Sleep (20000)
Send ( '{Tab}' )
Send ( '{Tab}' )
Send ( '{Tab}' )
Send ( '{Enter}' )
EndIf

If WinExists ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Show the readme file' ) Then
WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Show the readme file' )
Send ( '{Tab}' )
Send ( '{Space}' )
Send ( '{Tab}' )
Send ( '{Space}' )
Send ( '{Tab}' )
Send ( '{Tab}' )
Send ( '{Tab}' )
Send ( '{Space}' )
Send ( '{ENTER}' )
WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'InstallShield Wizard Completed' )
Send ( '{Enter}' )
Sleep(20000)
Send ( 'Y' )
EndIf

If WinExists ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Remove Roxio Easy Media Creator 7 Basic DVD Edition from your computer.' ) Then
WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Remove Roxio Easy Media Creator 7 Basic DVD Edition from your computer.')
Send ( '{Tab}' )
Send ( '{Tab}' )
Send ( '{Tab}' )
Send ( '{ENTER}' ) 
WinWaitActive ( 'Roxio Easy Media Creator 7 Basic DVD Edition - InstallShield Wizard', 'Are you sure you want to cancel Roxio Easy Media Creator 7 Basic DVD Edition installation?' )
Send ( 'y' )
Sleep(20000)
Send ( '{Enter}' )
EndIf


sleep(5000)
Shutdown(6)
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...