Jump to content
Sign in to follow this  
penggilas2

how to Skip search CD driver Notready..??

Recommended Posts

penggilas2

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.. ;)

Share this post


Link to post
Share on other sites
Melba23

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
penggilas2

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

I 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.. :)

Share this post


Link to post
Share on other sites
Melba23

penggilas2,

I do not know what the meaning of each symbol in the script.. I just learning script

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.... B)

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
penggilas2

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.... B)

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..

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  

×