experience Posted June 12, 2007 Share Posted June 12, 2007 (edited) 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 June 12, 2007 by experience Link to comment Share on other sites More sharing options...
herewasplato Posted June 12, 2007 Share Posted June 12, 2007 (edited) 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 June 12, 2007 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
MisterBates Posted June 12, 2007 Share Posted June 12, 2007 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]:" [u]MisterBates[/u]_____________________________________________________Suspend/Resume Windows ScreensaverWatchWindows - Window watcher/loggerUDF: Click systray menu/submenu itemsUDF: Outlook Express Folder/Message handling (+ example code)HowTo: Multiple icons in one compiled script Link to comment Share on other sites More sharing options...
experience Posted June 12, 2007 Author Share Posted June 12, 2007 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: ()") Link to comment Share on other sites More sharing options...
herewasplato Posted June 12, 2007 Share Posted June 12, 2007 (edited) 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 June 12, 2007 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
/dev/null Posted June 13, 2007 Share Posted June 13, 2007 (edited) 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 June 13, 2007 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 * Link to comment Share on other sites More sharing options...
MHz Posted June 13, 2007 Share Posted June 13, 2007 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. Link to comment Share on other sites More sharing options...
experience Posted June 13, 2007 Author Share Posted June 13, 2007 Try this: Opt("WinTitleMatchMode", 4) WinWaitActive ("[REGEXPTITLE:Change Drive Letter and Paths for [DE]: \(\)]")No that didnt work either 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) Link to comment Share on other sites More sharing options...
/dev/null Posted June 13, 2007 Share Posted June 13, 2007 No that didnt work either 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 * Link to comment Share on other sites More sharing options...
herewasplato Posted June 13, 2007 Share Posted June 13, 2007 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] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now