torels Posted February 3, 2009 Share Posted February 3, 2009 Hi guys. I have this piece of code that's driving me mad. What I basically want to do is this: get a list of removble drives and see which of these is an iPod $list = DriveGetDrive("removable") For $i = 1 to $list[0] If _IsiPod($list[$i] & "\") Then GUICtrlSetData($Combo, $list[$i] & "\") EndIf Next Func _IsiPod($drive) If DriveGetType($drive)="Removable" And FileExists($drive & "iPod_Control\iTunes\") Then Return 1 Return 0 EndFunc ;==>_IsiPod it is always givving me an ugly Win2k style error with a big red cross on it. It says "Exception Processing Message c0000013 Parameters 75b1bf7c 4 75b1bf7c 75b1bf7c" it's title is "Windows - Disco non presente" (meaning the drive isn't there) and it has 3 buttons. Abort,Try Again,Continue. It pops up twice (clicking continue). Why does this happen ? Thanks in advance! Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
KaFu Posted February 3, 2009 Share Posted February 3, 2009 Try $list = DriveGetDrive("removable") For $i = 1 to $list[0] If _IsiPod($list[$i] & "\") Then GUICtrlSetData($Combo, $list[$i] & "\") EndIf Next Func _IsiPod($drive) If DriveGetType($drive)="Removable" And DriveStatus($drive) = "READY" then if FileExists($drive & "iPod_Control\iTunes\") Then Return 1 EndIf Return 0 EndFunc ;==>_IsiPod OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
torels Posted February 3, 2009 Author Share Posted February 3, 2009 yes it's working perfectly thank you! Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
KaFu Posted February 3, 2009 Share Posted February 3, 2009 Had the same problem with ShellTristateTreeView / SMF ... it recognizes the drive and tries to access it, but there's no media inserted! Had this issue not with USB but with my disk drive a:. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
torels Posted February 3, 2009 Author Share Posted February 3, 2009 actually I too believed it was a: giving problems (It's the floppy disk drive, and there was no floppy disk in it XD) Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
MilesAhead Posted May 12, 2009 Share Posted May 12, 2009 (edited) actually I too believed it was a: giving problems (It's the floppy disk drive, and there was no floppy disk in it XD) I'm getting a strange problem. After reading this thread I wrote this function to test for valid path ;returns False if no media in drive or file/folder doesn't exist Func _ValidPath($path) If $path = "" Then Return False Local $drive = StringLeft($path,3) Local $driveType = DriveGetType($drive) If @error Then Return False If $driveType <> "FIXED" And DriveStatus($drive) <> "READY" Then Return False Return FileExists($path) EndFunc However I have a DVD in drive E:. I can open the dvd in explorer. Open VIDEO_TS folder, in a cmd prompt I can do dir e:\video_ts and it all works. If I do ShellExecute("e:\video_ts") explorer gives me the error "parameter invalid" even though there's no space in the path. I'm not getting any errors launching folders from the HD. Edit: seems it only acts up in Vista64. If I put a data disc in, I can open it using the 64 bit shell by double clicking in explorer. If I try to do the same with a 32 bit shell window on Vista64, I get the "Burn a Disc" format window. Also if I choose Explorer from FreeCommander it does the same thing. Something 32 bit on my Vista64 is interfering. Edited May 12, 2009 by MilesAhead My Freeware Page Link to comment Share on other sites More sharing options...
torels Posted May 12, 2009 Author Share Posted May 12, 2009 wht's the function got to do with the rest of the post ? i don't get it Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
MilesAhead Posted May 12, 2009 Share Posted May 12, 2009 wht's the function got to do with the rest of the post ?i don't get it FileExists by itself traps on removable drives with no media.You really don't see a correlation? My Freeware Page Link to comment Share on other sites More sharing options...
mrmacadamia Posted May 28, 2009 Share Posted May 28, 2009 hi, your script give me an idea to make like a shortcut on the desktop to access removable media. I have a laptop with usb port and integrated SD/MMC/MG/CF port. So, whenever I want to access the removable media, i just can double click on the script and open the usb removable windows. Anyway, I wanted the script goes like this. 1. whenever a removable media is inserted and detected the needed files in it, it will open the window. 2. whenever a removable media is inserted and no files that is required in it, it will give msg like "another/new usb is inserted" 3. whenever no removable media is inserted but the user run the script, it will give msg like "please insert usb" I think i able to make the script work until #2. I tried the #3 but still don't get it. $list = DriveGetDrive("REMOVABLE") For $i = 1 to $list[0] If _IsUSB($list[$i] & "\") Then ShellExecute($list[$i]) EndIf Next Func _IsUSB($drive) If DriveGetType($drive)="REMOVABLE" And DriveStatus($drive) = "READY" then if FileExists($drive & "COMMONFILES\MP3\") Then Return 1 Else MsgBox(4096, "error", "new usb inserted!") EndIf EndIf EndFunc ;==>_IsUSB Link to comment Share on other sites More sharing options...
mrmacadamia Posted May 28, 2009 Share Posted May 28, 2009 ahah, i think i figured it out. i tried and tested...it worked on my computer though.. $list = DriveGetDrive("REMOVABLE") For $i = 1 to $list[0] If _IsUSB($list[$i] & "\") Then ShellExecute($list[$i]) EndIf Next If @error = 1 Then MsgBox(4096, "error", "NEW usb inserted!") ElseIf @error = 2 Then MsgBox(4096, "error", "NO usb inserted!") EndIf Func _IsUSB($drive) If DriveGetType($drive)="REMOVABLE" And DriveStatus($drive) = "READY" Then If FileExists($drive & "COMMONFILES\MP3\") Then Return 1 Else SetError(1) EndIf Else If DriveGetType($drive)="REMOVABLE" And DriveStatus($drive) = "NOTREADY" Then SetError(2) EndIf EndIf EndFunc ;==>_IsUSB Link to comment Share on other sites More sharing options...
mrmacadamia Posted May 29, 2009 Share Posted May 29, 2009 Well, anyway...i do have a question though... How can I call the drive that has been detected in the script? example If @error = 1 Then do something or open the drive<-----------------------instead of calling msgbox ElseIf @error = 2 Then MsgBox(4096, "error", "NO usb inserted!") EndIf Link to comment Share on other sites More sharing options...
mrmacadamia Posted June 12, 2009 Share Posted June 12, 2009 $list = DriveGetDrive("removable") For $i = 1 to $list[0] If _IsiPod($list[$i] & "\") Then msgbox(0, "test", "test") EndIf Next Func _IsiPod($drive) If DriveGetType($drive)="Removable" And DriveStatus($drive) = "READY" then if FileExists($drive & "iPod_Control\iTunes\") Then Return 1 EndIf Return 0 EndFunc ;==>_IsiPod i'm using this script on this one computer and tried and gave me an error like this C:\Documents and Settings\GUNZed\??????\isipod.au3 (2) : ==> Subscript used with non-Array variable.: For $i = 1 to $list[0] For $i = 1 to $list^ ERROR the other computer runs well... any idea why? Link to comment Share on other sites More sharing options...
mrmacadamia Posted June 12, 2009 Share Posted June 12, 2009 $list = DriveGetDrive("removable") For $i = 1 to $list[0] If _IsiPod($list[$i] & "\") Then msgbox(0, "test", "test") EndIf Next Func _IsiPod($drive) If DriveGetType($drive)="Removable" And DriveStatus($drive) = "READY" then if FileExists($drive & "iPod_Control\iTunes\") Then Return 1 EndIf Return 0 EndFunc ;==>_IsiPod i'm using this script on this one computer and tried and gave me an error like this C:\Documents and Settings\GUNZed\??????\isipod.au3 (2) : ==> Subscript used with non-Array variable.: For $i = 1 to $list[0] For $i = 1 to $list^ ERROR the other computer runs well... any idea why? ok i solved it... i should put the if NOT @error Then ... ... top of the script... glad the autoit help file really help me... Link to comment Share on other sites More sharing options...
KaFu Posted June 12, 2009 Share Posted June 12, 2009 i should put the if NOT @error Then at top of the script...Looking at the solution it's obvious, but I saw you're request and didn't see it then too, good find . OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) 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