jben Posted April 10, 2008 Posted April 10, 2008 Hi, Does anyone here know if its possible to search for a certain file and then run it if it exists.. Trying to work this out because I have an automated installation in place, but wanted to allow the user to insert a removable device before proceeding, which contains a file called copychart.exe. This file will be copied to the c:\something dir if its found. Anyone have any ideas. I would think that 1 thing thats important is that it doesn't search the C: drive as this is not necessary as the file will always be stored on D,E,F,G etc... thanks
ProgAndy Posted April 10, 2008 Posted April 10, 2008 (edited) 1) DriveGetDrive to get drives, use with "REMOVABLE"? 2 a) Fixed path? e.g. root of device? -> FileExists b.) Do a recursive search (look in forum for example) Edited April 10, 2008 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
Monamo Posted April 10, 2008 Posted April 10, 2008 jben said: Hi, Does anyone here know if its possible to search for a certain file and then run it if it exists.. Trying to work this out because I have an automated installation in place, but wanted to allow the user to insert a removable device before proceeding, which contains a file called copychart.exe. This file will be copied to the c:\something dir if its found. Anyone have any ideas. I would think that 1 thing thats important is that it doesn't search the C: drive as this is not necessary as the file will always be stored on D,E,F,G etc... thanksQuick and dirty - Only checks the root of the drive. You can add folder recursion with some of the other content in the help file (_FileListToArray(), etc): $sSearchFile = "file.txt" $aRemovableDrives = DriveGetDrive("REMOVABLE") If IsArray($aRemovableDrives) Then For $i = 1 To $aRemovableDrives[0] If FileExists($aRemovableDrives[$i] &"\file.txt") Then MsgBox(64,"Found it","Found the file '" &$sSearchFile &"' on drive " &$aRemovableDrives[$i]) ExitLoop EndIf Next EndIf - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]
jben Posted April 10, 2008 Author Posted April 10, 2008 Cheers dudes I will have a play with this, thanks alot
jben Posted April 10, 2008 Author Posted April 10, 2008 hmm thats interesting. I seem to have got an error box stating: Exception processing message 0xc00000a3 parameters and then a load of number/letters weird huh?
jben Posted April 10, 2008 Author Posted April 10, 2008 ahh i see why. I presume this is also checking my CD drives..Seems to show the error message a couple of times.
Monamo Posted April 11, 2008 Posted April 11, 2008 jben said: ahh i see why. I presume this is also checking my CD drives..Seems to show the error message a couple of times.Actually, there's a separate parameter to handle CD drives ("CDROM" instead of "REMOVABLE"), though I don't know offhand what would be triggering the error noted in your earlier post. - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]
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