Jump to content
Sign in to follow this  
experience

WinWaitActive Question

Recommended Posts

experience

I've written a script and part of it changes the CD drive letter. The problem i've just encountered is that on new laptops the CD drive is D and on desktops its E.

I initially wrote my script for laptops but need to change it to include desktops hence the E drive.

When the script runs on desktops it stops because of the following:

WinWaitActive("Change Drive Letter and Paths for D: ()")

Is there a way i can keep the WinWaitActive but to wait for Either D or E ?

If not i'l just have to get rid of the WinWaitActive and use a sleep command

Edited by experience

Share this post


Link to post
Share on other sites
herewasplato

WinWaitActive("Change Drive Letter and Paths for")

Edit: AutoIt matches the title from the start by default unless you have changed it via Opt/WinTitleMatchMode - if so, change it back just before the WinWait...

Edited by herewasplato

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

Share this post


Link to post
Share on other sites
MisterBates

I've written a script and part of it changes the CD drive letter. The problem i've just encountered is that on new laptops the CD drive is D and on desktops its E.

I initially wrote my script for laptops but need to change it to include desktops hence the E drive.

When the script runs on desktops it stops because of the following:

WinWaitActive("Change Drive Letter and Paths for D: ()")

Is there a way i can keep the WinWaitActive but to wait for Either D or E ?

If not i'l just have to get rid of the WinWaitActive and use a sleep command

Look at WinTitleMatchMode 4 (advanced) and use a regular expression 'Change Drive Letter and Paths for [DE]:"

Share this post


Link to post
Share on other sites
experience

WinWaitActive("Change Drive Letter and Paths for")
Yeh i could do that but its a little bit risky incase the script selects the C drive and then changes its drive letter which i dont want to happen

I was thinking of the following but it doesn't work

WinWaitActive("Change Drive Letter and Paths for D: ()")
if not WinActive("Change Drive Letter and Paths for D: ()") then WinWaitActive("Change Drive Letter and Paths for E: ()")

Share this post


Link to post
Share on other sites
herewasplato

You can add a timeout to the first WinWait... but you run the same risk. The OS could be installed on most any drive letter. There is probably a way to find which drive letter is assigned to a CD/DVD.

DriveGetType ()

Edited by herewasplato

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

Share this post


Link to post
Share on other sites
/dev/null

Is there a way i can keep the WinWaitActive but to wait for Either D or E ?

If not i'l just have to get rid of the WinWaitActive and use a sleep command

Try this:

Opt("WinTitleMatchMode", 4)
WinWaitActive ("[REGEXPTITLE:Change Drive Letter and Paths for [DE]: \(\)]")

Replace [DE] with . if you don't care about the drive letter!

Cheers

Kurt

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites
MHz

I've written a script and part of it changes the CD drive letter. The problem i've just encountered is that on new laptops the CD drive is D and on desktops its E.

I initially wrote my script for laptops but need to change it to include desktops hence the E drive.

Why should drive letter be important? Your script should be able to work from any drive so long as your not doing something unusual.

:rolleyes:

Share this post


Link to post
Share on other sites
experience

Try this:

Opt("WinTitleMatchMode", 4)
WinWaitActive ("[REGEXPTITLE:Change Drive Letter and Paths for [DE]: \(\)]")
No that didnt work either :rolleyes:

tried putting it in as below

;Changes CDRom Drive to Z
send("{alt}")
sleep(1000)
send("{lwin}{r}")
WinWaitActive("Run")
send("{d}{i}{s}{k}{m}{g}{m}{t}{.}{m}{s}{c}")
send("{enter}")
WinWaitActive("Disk Management")
sleep(10000)
send("{down}")
sleep(3000)
send("{altdown}{a}{altup}{k}{c}")
Opt("WinTitleMatchMode", 4)
WinWaitActive ("[REGEXPTITLE:Change Drive Letter and Paths for [DE]: \(\)]")
sleep(2000)
send("{tab 2}{enter}")
WinWaitActive("Change Drive Letter or Path")
send("{tab}{z}{enter}")
WinWaitActive("Confirm")
sleep(1000)
send("{y}")
sleep(2000)
send("{altdown}{f}{x}{altup}")
sleep(8000)
send("{tab 2}{x}")
sleep(5000)

Share this post


Link to post
Share on other sites
/dev/null

No that didnt work either :rolleyes:

tried putting it in as below

WinWaitActive ("[REGEXPTITLE:Change Drive Letter and Paths for [DE]: \(\)]")

Seems to be a bug in WinWaitActive with RegExp. Try this:

WinWaitActive ("[REGEXPTITLE:Change Drive Letter and Paths for .: \(\)]")

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites
herewasplato

experience,

This has nothing to do with your WinWaitActive question...

but try this one line ShellExecute("diskmgmt.msc") to start the app.

Also, you do not need to "bracket" every letter.

this:

send("{d}{i}{s}{k}{m}{g}{m}{t}{.}{m}{s}{c}")

and this:

send("diskmgmt.msc")

are the same.

Just FYI...MSP


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

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  

×