blinkdt Posted October 21, 2006 Share Posted October 21, 2006 I am encountering parsing issues when trying to include a variable in a command line. I am using a command line tool called RemoveDrive.exe to eject a removable drive from the machine. It would be great if the removable drive could be identified using a variable at the beginning of my longish script, and this tact works well throughout the script excepting the command line. This works... RunWait( @ScriptDir & "\TOOLS\RemoveDrive F:") ...as part of the eject function... Dim $RemovableDrive1 = "F:";<=== set location of removable drive _eject() Func _eject() DriveGetLabel($RemovableDrive1 & "\") If @error Then;check whether backup device is attached and powered on MsgBox(16, "Backup Operation", "The removable drive is not connected to the system!") Else;proceed with eject operation if backup device is attached and powered on RunWait( @ScriptDir & "\TOOLS\RemoveDrive F:", "", @SW_HIDE);<======= While 1 DriveGetLabel($RemovableDrive1 & "\") If @error Then;check whether backup device is attached and powered on MsgBox(64, "Backup Operation", "You may now power off and replace the removable drive!") EndIf ExitLoop Sleep(1000) Wend EndIf EndFunc ...but it would work better as something like this: RunWait( @ScriptDir & '"'\TOOLS\RemoveDrive & $RemovableDrive1'"') I have been searching for examples for a few days now with no success, and at this point I am just guessing at a solution that might include @ComSpec or some elaborate combination of quote marks with predictable, frustrating result. I need to get this pig working by Monday in the AM. Any help would be greatly appreciated. "No peace for the wicked, no rest for the good." Link to comment Share on other sites More sharing options...
Developers Jos Posted October 21, 2006 Developers Share Posted October 21, 2006 Not using SciTE right ? try: RunWait(@ScriptDir & '\TOOLS\RemoveDrive ' & $RemovableDrive1) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
blinkdt Posted October 21, 2006 Author Share Posted October 21, 2006 Sweet mother of god... it was just that easy. No, I clearly am not using SciTE right :"> Thank you, JdeB. "No peace for the wicked, no rest for the good." Link to comment Share on other sites More sharing options...
Developers Jos Posted October 21, 2006 Developers Share Posted October 21, 2006 Sweet mother of god... it was just that easy. No, I clearly am not using SciTE right :">Reason for mentioning SciTE is that the Colors of the Syntax highlighting would have shown you that you had an error in your single and double qoutes ..... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
blinkdt Posted October 21, 2006 Author Share Posted October 21, 2006 (edited) Yep, I just installed SciTE about a week ago (but have been fumbling around with AutoIt for years now) and have been using it as a simple text editor. Clearly, it's a heck of a lot more than that. On that subject, is there a simple way to select a block of text and decrease the indent, a la NotePad2? Easy enough to increase the indent with a TAB stroke, but I can't find anything on the menu that does the job. Did I miss it, as well? Also, where the heck is the "donate" button? EDIT: yeah, lower right corner. EDIT/EDIT: and thanks for those tips in the post below, real time savers and much appreciated. Edited October 21, 2006 by blinkdt "No peace for the wicked, no rest for the good." Link to comment Share on other sites More sharing options...
Developers Jos Posted October 21, 2006 Developers Share Posted October 21, 2006 Yep, I just installed SciTE about a week ago (but have been fumbling around with AutoIt for years now) and have been using it as a simple text editor. Clearly, it's a heck of a lot more than that.On that subject, is there a simple way to select a block of text and decrease the indent, a la NotePad2? Easy enough to increase the indent with a TAB stroke, but I can't find anything on the menu that does the job. Did I miss it, as well? Decrease the indent of a block is done with Shift+Tab, but when you want to Tidy your code its easier to run Tidy.... Ctrl+T .... It does all the Proper casing/Indenting for you at the push of 2 buttons. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Valuater Posted October 21, 2006 Share Posted October 21, 2006 if i am reading your intentions correctly....RunWait( @ScriptDir & "\TOOLS\RemoveDrive F:", "", @SW_HIDE);<======= While 1 DriveGetLabel($RemovableDrive1 & "\") If @error Then;check whether backup device is attached and powered on MsgBox(64, "Backup Operation", "You may now power off and replace the removable drive!") EndIf ExitLoop Sleep(1000) Wendyou would want to chage this.....RunWait( @ScriptDir & "\TOOLS\RemoveDrive F:", "", @SW_HIDE);<=======to thisRun( @ScriptDir & "\TOOLS\RemoveDrive F:", "", @SW_HIDE);<=======to get into the While loop( not sure, just a note )8) Link to comment Share on other sites More sharing options...
blinkdt Posted October 21, 2006 Author Share Posted October 21, 2006 (edited) I haven't looked into it in detail, but I suspect the command line utility RemoveDrive works in conjunction with Windows' "Safely Remove Hardware" feature. However, there is a pregnant pause between the time that RemoveDrive reports success and the device is actually removed, per Windows. Any way you slice it, the script does enter the loop using either the 'Run' or 'RunWait' functions, but a straightforward 'Run' makes more sense. Thanks for that, Valuater. Edit: Actually, after testing (must remember: test...then post ), just the opposite is true. The script executes successfully using Run but does not enter the loop to produce the Message Box. RemoveDrive is a nifty utility and I applaud the author, but the readme file is basic and I do not understand its inner workings. It takes several seconds to execute. When used with this script, it's as though 'Run' and 'Runwait' functionality is reversed. Edit/Edit: I abandoned RemoveDrive after spotty results and went with UNMOUNT to eject the drive: Func Eject();eject the removable drive DriveGetLabel($TargetDrive1 & '\') If @error Then;check whether removable drive is attached and powered on MsgBox(16, 'Backup Operation', 'The removable drive is not connected to the system!', 5) Else;unmount the removable drive TraySetState (4);flash the tray icon RunWait(@ScriptDir & '\TOOLS\UNMOUNT -bal ' & $TargetDrive1, '', @SW_HIDE) While 1;confirm that drive has been unmounted DriveGetLabel($TargetDrive1 & '\') If @error Then;check whether removable drive is attached and powered on MsgBox(64, 'Backup Operation', 'You may now power off and replace the removable drive!', 5) EndIf ExitLoop Wend TraySetState (8);stop tray icon flashing EndIf EndFunc Edited October 23, 2006 by blinkdt "No peace for the wicked, no rest for the good." 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