alterctrlego Posted January 4, 2007 Share Posted January 4, 2007 I am writing a small program for a U3 memory stick, and one of the things that I need the program to do is locate a partition on the memory stick and tell a script the drive letter. The code that I have used so far isFunc getdrive() For $number=97 to 122 Local $drive_l = Chr($number) Local $idnum = IniRead($drive_l&":\serial.ini","IDENTITY","SOFT_SERIAL","") If $idnum = "" Then Next Else Return($drive_l) EndIf EndFuncTo the naked eye, this code should work, yet AutoIt doesn't allow programs to have "for" and "if" statements nesting in the way that I have them here...Any ideas?Help would be much appreciated. :"> AlterCtrlEgo,http://www.alphahacka.com/ - Admin Link to comment Share on other sites More sharing options...
acidfear Posted January 4, 2007 Share Posted January 4, 2007 (edited) Would replacing the "For" loop with a "While" loop work? Edited January 4, 2007 by acidfear Link to comment Share on other sites More sharing options...
Uten Posted January 4, 2007 Share Posted January 4, 2007 uhh, why write code you know want work? Try: DriveGetDrive in the helpfile.. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
alterctrlego Posted January 4, 2007 Author Share Posted January 4, 2007 It might, but I am still unsure about how to cycle through the letters while being able to exit out of the loop once the drive has been found. Thanks, AlterCtrlEgo Link to comment Share on other sites More sharing options...
alterctrlego Posted January 4, 2007 Author Share Posted January 4, 2007 Uten, Thanks for the reply but, I thought about using DriveGetDrive, but it wouldn't work for the my program as there may be many of one type of drive plugged into the computer at one time. I know there are other ways of identifying a drive but I think that looking for a value in a file is the most useful way for me AlterCtrlEgo, Thankful newb Link to comment Share on other sites More sharing options...
Danny35d Posted January 4, 2007 Share Posted January 4, 2007 Func getdrive() Local $idnum $drives = DriveGetDrive('all') For $x = 1 To $drives[0] $idnum = IniRead($drives[$x] & "\serial.ini","IDENTITY","SOFT_SERIAL","") If $idnum <> "" Then Return($drives[$x]) Next Return('') EndFunc Enjoy... :"> AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
alterctrlego Posted January 4, 2007 Author Share Posted January 4, 2007 Danny35d, The script worked! Thanks for helping a thankful newbie! Everyone, Thanks for all your help and input! AlterCtrlEgo 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