niceguy75 Posted March 7, 2011 Share Posted March 7, 2011 (edited) I need your help guys,I am trying to write a script which first search for the myexe.exe in myfolder of pen drive and if found, run that file and if no pendrive is found it search for the same file in the same folder of CDROM.Till now I have done this:$var = DriveGetDrive( "CDROM" ) If not @error Then For $i = 1 to $var[0] Run($var[$i] & "myfolder\myexe.exe") Next EndIfBut this search only in CDROM. Edited March 7, 2011 by niceguy75 Link to comment Share on other sites More sharing options...
Shaarad Posted March 7, 2011 Share Posted March 7, 2011 $var = DriveGetDrive( "REMOVABLE" ) If $var<>"" Then For $i = 1 to $var[0] Run($var[$i] & "myfolder\myexe.exe") Next Else $var2 = DriveGetDrive( "CDROM" ) run ($var2[$i] & "myfolder\myexe.exe") EndIf try it ...see whether this works... Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
niceguy75 Posted March 7, 2011 Author Share Posted March 7, 2011 (edited) Thanks mate, currently I am at work place and I don't have Autoit installed here, I will test it at home in the eve and let you know.BTW, nice to know that you are also from India.Edit: not working mate.Error: Variable used without being declared. Edited March 7, 2011 by niceguy75 Link to comment Share on other sites More sharing options...
Cybergraph Posted March 7, 2011 Share Posted March 7, 2011 Thanks mate, currently I am at work place and I don't have Autoit installed here, I will test it at home in the eve and let you know.BTW, nice to know that you are also from India.Edit: not working mate.Error: Variable used without being declared.Then declare the variable. It's easy. Link to comment Share on other sites More sharing options...
niceguy75 Posted March 8, 2011 Author Share Posted March 8, 2011 Then declare the variable. It's easy.I am a newbie as far as autoit is concerned, and I don't know how to declare the variable. Link to comment Share on other sites More sharing options...
Varian Posted March 8, 2011 Share Posted March 8, 2011 Local $Location, $Var = DriveGetDrive("ALL") If IsArray($Var) Then For $i = 1 To $Var[0] If DriveGetType($Var[$i]) <> "REMOVABLE" And DriveGetType($Var[$i]) <> "CDROM" Then ContinueLoop ;skip Drive if not Removeable or CDROM If FileExists($Var[$i] & "\myfolder\myexe.exe") Then $Location = $Var[$i] & "\myfolder\myexe.exe" ;Finds first location of EXE file ExitLoop EndIf Next EndIf If $Location Then MsgBox(0, "Location of File", $Location) Link to comment Share on other sites More sharing options...
niceguy75 Posted March 8, 2011 Author Share Posted March 8, 2011 (edited) Thanks mate, I will try and let you know if its working or not.Edit: Its only displaying the location of the exe not playing, I want my script to run myexe.exe of myfolder, as well. Edited March 8, 2011 by niceguy75 Link to comment Share on other sites More sharing options...
Cybergraph Posted March 8, 2011 Share Posted March 8, 2011 (edited) Thanks mate, I will try and let you know if its working or not. Edit: Its only displaying the location of the exe not playing, I want my script to run myexe.exe of myfolder, as well. It's obvious that the script only shows the location because there are no instructions able to run the program. If $Location Then MsgBox(0, "Location of File", $Location) I am a newbie as far as autoit is concerned, and I don't know how to declare the variable. My friendly advice is to start reading the help manual and try to understand the meaning of commands and functions you need. I can see a bit of laziness from you in doing this. Edited March 8, 2011 by Cybergraph Link to comment Share on other sites More sharing options...
kylomas Posted March 9, 2011 Share Posted March 9, 2011 (edited) niceguy75, So far the forum members have been giving you fish. Now it's time to learn how to fish... Do a Google search on "rtfm"... kylomas Edited March 9, 2011 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill 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