earl82 Posted January 12, 2011 Share Posted January 12, 2011 Hey does any one know what the command is to run an .exe file on the CD-ROM no matter what the drive letter is. I can't figure it out. Any help will be appreciated. Thanks and GOD Bless. Link to comment Share on other sites More sharing options...
shanet Posted January 12, 2011 Share Posted January 12, 2011 If the script is on the drive, you would just run from the current directory, however if not, i do not believe it is possible, sorry. [font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS: %programfiles%/AutoIt3/autoit3.chm Link to comment Share on other sites More sharing options...
whim Posted January 12, 2011 Share Posted January 12, 2011 (edited) Give something like this a try ; let's say your executable is in {CDROM-drive}\myfolder\myexe.exe $myexe = "\myfolder\myexe.exe" $drives = DriveGetDrive("CDROM") If $drives = "" Then MsgBox(0, "Error", "no CD/DVD drives found !") Else $found = False For $i = 1 To $drives[0] Local $fp = $drives[$i] & $myexe If FileExists($fp) Then Run($fp) $found = True ExitLoop EndIf Next If Not $found Then MsgBox(0, "Error", $myexe & " not found on any of your " & $drives[0] & " CD/DVD drives") EndIf Note: not tested - don't have an optical drive available hope that helps, whim Edited January 12, 2011 by whim Link to comment Share on other sites More sharing options...
earl82 Posted January 12, 2011 Author Share Posted January 12, 2011 Give something like this a try ; let's say your executable is in {CDROM-drive}\myfolder\myexe.exe $myexe = "\myfolder\myexe.exe" $drives = DriveGetDrive("CDROM") If $drives = "" Then MsgBox(0, "Error", "no CD/DVD drives found !") Else $found = False For $i = 1 To $drives[0] Local $fp = $drives[$i] & $myexe If FileExists($fp) Then Run($fp) $found = True ExitLoop EndIf Next If Not $found Then MsgBox(0, "Error", $myexe & " not found on any of your " & $drives[0] & " CD/DVD drives") EndIf Note: not tested - don't have an optical drive available hope that helps, whim Thanks I will give this a try when I get home. Link to comment Share on other sites More sharing options...
GEOSoft Posted January 12, 2011 Share Posted January 12, 2011 When doing things like this always make sure to include a few checks along the way so you can at least make the script exit gracefully. Opt("MustDeclareVars", 1) Local $aDrives = DriveGetDrive("cdrom") If NOT @Error Then For $Drive in $aDrives If IsNumber($Drive) OR DriveStatus($Drive) <> "ready" Then ContinueLoop If NOT FileExists($Drive & "\setup.exe") Then ContinueLoop ShellExecute($Drive & "\setup.exe") Next EndIf George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
niceguy75 Posted March 6, 2011 Share Posted March 6, 2011 (edited) I am new to Autoit though I have registered few months back but I am more concered about customizing OS' acutally I am looking for a script which first look for the removable drive if found it runs a "myexe.exe" which is in "myfolder" and if the removable drived is not found it go on to search for CDROM and run the same exe in the same folder without giving any msg and without showing any window or so.I have done this so far:$var = DriveGetDrive( "CDROM" ) If not @error Then For $i = 1 to $var[0] Run($var[$i] & "myfolder\myexe.exe") Next EndIfPlease someone help me out. Edited March 6, 2011 by niceguy75 Link to comment Share on other sites More sharing options...
Shaarad Posted March 11, 2011 Share Posted March 11, 2011 I am new to Autoit though I have registered few months back but I am more concered about customizing OS' acutally I am looking for a script which first look for the removable drive if found it runs a "myexe.exe" which is in "myfolder" and if the removable drived is not found it go on to search for CDROM and run the same exe in the same folder without giving any msg and without showing any window or so. I have done this so far: $var = DriveGetDrive( "CDROM" ) If not @error Then For $i = 1 to $var[0] Run($var[$i] & "myfolder\myexe.exe") Next EndIf Please someone help me out. I do not find any problem, the script should run....by the way which os are you using, friend ?? 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...
GEOSoft Posted March 11, 2011 Share Posted March 11, 2011 Are you sure that DriveGetDrive( "CDROM" ) is correct?. Try with DriveGetDrive("Removable") George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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