Tukata Posted May 3, 2006 Share Posted May 3, 2006 Hi, I need a small project that gets the drive letter for the clipboad, or even better, recognize on which drive a CD is inserted, and create a list of all files (txt) in the working folder. Thanks for the help Tuk Link to comment Share on other sites More sharing options...
Valuater Posted May 3, 2006 Share Posted May 3, 2006 Hi,I need a small project that gets the drive letter for the clipboad...I would love to see that8) Link to comment Share on other sites More sharing options...
jvanegmond Posted May 3, 2006 Share Posted May 3, 2006 I would love to see that8)Haha same hereTo answer your question:DriveGetDrive ( "type" )Type will be CDRomDriveStatus ( "path" )Get path from DriveGetDrive and use a If DriveStatus = READYGo on from that. github.com/jvanegmond Link to comment Share on other sites More sharing options...
MadBoy Posted May 3, 2006 Share Posted May 3, 2006 (edited) Edit: something is wrong ;p wait trying to fix it. Edit2: Function has to be started with Driver letter ":" and "\" --> _CDTOTXT("F:\") Else it will get only some of dirs. I would love to see that 8) Here's little thing i cut out from my other script Some variable names might be not relevant to topic but i didn't realy wanted to play with it so much. All you gotta do now is add those functions that Manader posted. and send them to _CDTOTXT(). Also if you want better output to file modify _AddLogToFile($Text) function. Cheers expandcollapse popup#Include <Array.au3> #include <Constants.au3> #Include <Date.au3> #include <File.au3> Global $log_file = @ScriptDir & "\cd.log" _CDTOTXT("F:\") Func _CDTOTXT($path_to_cdrom) $DirOutput = Run(@ComSpec & " /c DIR /A:D /S " & $path_to_cdrom, '', @SW_HIDE, 2) Local $DirOutputOnce While 1 $DirData = StdoutRead($DirOutput) If @error Then ExitLoop If $DirData Then $DirOutputOnce &= $DirData Else Sleep(10) EndIf WEnd ; Remove spaces from output $DirOutputOnce = StringStripWS($DirOutputOnce, 3) ; Split output into array $DirSplit = StringSplit($DirOutputOnce, @CRLF,1) For $i = 1 To $DirSplit[0] If StringInStr($DirSplit[$i], $path_to_cdrom) Then $DirsLine = StringSplit($DirSplit[$i], ": ",1) If $DirsLine[0] = 2 Then; Testing amount of elements in array, if more then 2 Exits If StringInStr($DirsLine[2], $path_to_cdrom) Then; Making sure that path exists in string $cd_directories = $DirsLine[2] $search_all = FileFindFirstFile($cd_directories & "\*.*"); Searching for all files in directory If $search_all = -1 Then Else While 1 $search_file = FileFindNextFile($search_all) If @error Then ExitLoop $full_path_to_all = $cd_directories & "\" & $search_file _AddLogToFile($full_path_to_all) WEnd EndIF FileClose($search_all) EndIf EndIf EndIf Next EndFunc Func _AddLogToFile($Text) $file_log = FileOpen($log_file,1) FileWriteLine($file_log, "["& _NowTime(5) & "] - " & $Text & @CRLF) FileClose ( $file_log ) EndFunc Edited May 3, 2006 by MadBoy My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
Tukata Posted May 7, 2006 Author Share Posted May 7, 2006 Sorry for my English, I did not explain good. I simply want to know on which drive user inserted a CD. That's all. Thank you Tuk Link to comment Share on other sites More sharing options...
ChrisL Posted May 7, 2006 Share Posted May 7, 2006 list CDrom drives and status Local $cdrom For $i = 65 to 89 $Type = DriveGetType (Chr ($i) & ":") if $Type = "CDROM" then $CDROM = $CDROM & Chr ($i) & ":\ " & DriveStatus ( Chr ($i) & ":" ) & @crlf Endif Next MsgBox (0,"Cdrom drives", $CDROM) [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Tukata Posted May 9, 2006 Author Share Posted May 9, 2006 Many thanks. This was what I needed. Tuk 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