penggilas2 Posted November 19, 2009 Share Posted November 19, 2009 Search file script... when cdrom notready I get this message there is no disk in the drive. Please insert a disk into drive E : I want skip everything popup until the file found.. How to modive this script..?? $sPath = _FindFile ("\MyFile.exe") MsgBox (0, "", $sPath) Func _FindFile ($sPath, $sSearch = "ALL") If StringLeft ($sPath, 1) <> "\" Then $sPath = "\" & $sPath Local $aDrives = DriveGetDrive ($sSearch) For $i = 1 to $aDrives[0] If FileExists ($aDrives[$i] & $sPath) Then Return $aDrives[$i] Next Return SetError (1, 0, "") EndFunc plz help me.. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 19, 2009 Moderators Share Posted November 19, 2009 penggilas2,Use DriveStatus to check if the drive is "READY". If it is "NOTREADY", then do not search and move onto the next drive. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
penggilas2 Posted November 20, 2009 Author Share Posted November 20, 2009 penggilas2,Use DriveStatus to check if the drive is "READY". If it is "NOTREADY", then do not search and move onto the next drive. M23I was try edit script and not able to run.. and always keep error.. Please help me again..?Because I do not know what the meaning of each symbol in the script.. I just learning script.. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 20, 2009 Moderators Share Posted November 20, 2009 penggilas2, I do not know what the meaning of each symbol in the script.. I just learning scriptThat is NOT the way to learn - you need to understand what is going on in a script or you will never be able to code one for yourself. Your current behaviour is a good example - I give you the solution, but you have NO IDEA of how to modify the script to use it. You need to read the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) - this will help you enormously. You should also look at the excellent tutorials that you will find here and here. There are even video tutorials on YouTube if you prefer watching to reading. To show you how simple it is to modify a script, here is yours with the ability to skip empty drives: $sPath = _FindFile("\MyFile.exe") MsgBox(0, "", $sPath) Func _FindFile($sPath, $sSearch = "ALL") If StringLeft($sPath, 1) <> "\" Then $sPath = "\" & $sPath Local $aDrives = DriveGetDrive($sSearch) For $i = 1 To $aDrives[0] If DriveStatus($aDrives[$i] & "\") = "NOTREADY" Then ContinueLoop ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< If FileExists($aDrives[$i] & $sPath) Then Return $aDrives[$i] Next Return SetError(1, 0, "") EndFunc ;==>_FindFile Please now go and read the Help file for each command and see if you can work out what is happening - and, more importantly, why. I shall expect better things from you in future.... M23 P.S. When you post code, put [autoit ] before and [/autoit ] after it (but omit the trailing space - it is only there so the tags display here). it is much nicer to read. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
penggilas2 Posted November 20, 2009 Author Share Posted November 20, 2009 penggilas2, That is NOT the way to learn - you need to understand what is going on in a script or you will never be able to code one for yourself. Your current behaviour is a good example - I give you the solution, but you have NO IDEA of how to modify the script to use it. You need to read the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) - this will help you enormously. You should also look at the excellent tutorials that you will find here and here. There are even video tutorials on YouTube if you prefer watching to reading. To show you how simple it is to modify a script, here is yours with the ability to skip empty drives: $sPath = _FindFile("\MyFile.exe") MsgBox(0, "", $sPath) Func _FindFile($sPath, $sSearch = "ALL") If StringLeft($sPath, 1) <> "\" Then $sPath = "\" & $sPath Local $aDrives = DriveGetDrive($sSearch) For $i = 1 To $aDrives[0] If DriveStatus($aDrives[$i] & "\") = "NOTREADY" Then ContinueLoop ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< If FileExists($aDrives[$i] & $sPath) Then Return $aDrives[$i] Next Return SetError(1, 0, "") EndFunc ;==>_FindFile Please now go and read the Help file for each command and see if you can work out what is happening - and, more importantly, why. I shall expect better things from you in future.... M23 P.S. When you post code, put [autoit ] before and [/autoit ] after it (but omit the trailing space - it is only there so the tags display here). it is much nicer to read. Thank`s M23.. for completion and advice.. 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