JoeCool Posted August 11, 2005 Share Posted August 11, 2005 Hummm basic question ... I try to open file like 2click does on an icon. ( files like click an excel file or a word document .... ) I played with run command but I need the full path of the application ... Is this a command somewhere that do that ? :"> Link to comment Share on other sites More sharing options...
Josbe Posted August 11, 2005 Share Posted August 11, 2005 in the FAQorShellExecute AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
hgeras Posted August 11, 2005 Share Posted August 11, 2005 (edited) First of all, you have to know the full path....Otherwise how are you goin to indicate AutoIt where the file is? Try this and tell me : Run(@ComSpec & "/c start " & $file ,"",@SW_HIDE) Where $file is the full path of your file e.g. $file="C:\Program Files\text.txt" C ya Edited August 11, 2005 by hgeras Useful information about COM/Objects referenceMy Scripts:PapDefragNvidia Temperature Logger V3.0 with graph analyzerAutoiIt Update Checker And Downloader V1.0ArrayPush UDF Link to comment Share on other sites More sharing options...
themax90 Posted August 11, 2005 Share Posted August 11, 2005 Use the generic Run statement for com, lnk, exe(programs only) FileOpen for text files IniCreate, write, etc for Ini's besides that Shellexecute or use Larrys Au3record to doubleclick on the desired file Link to comment Share on other sites More sharing options...
JoeCool Posted August 12, 2005 Author Share Posted August 12, 2005 First of all, you have to know the full path....Otherwise how are you goin to indicate AutoIt where the file is?Try this and tell me :Run(@ComSpec & "/c start " & $file ,"",@SW_HIDE)Where $file is the full path of your file e.g.$file="C:\Program Files\text.txt"C ya<{POST_SNAPBACK}> :"> Im please that work for you ....Here I'm not able to open the file if along the path of the file I have folder name with space. run( @ComSpec & " /c start C:\Program Files\txt.txt", "", @SW_HIDE )I tried putting "" around filename but it didn't work .... run( @ComSpec & " /c start ""C:\Program Files\txt.txt""", "", @SW_HIDE )How are you doing it ? Link to comment Share on other sites More sharing options...
Valuater Posted August 12, 2005 Share Posted August 12, 2005 AutoIt Smith had it right. you do not use the run/comspec to open a text file in this example. You use the Word/excell program followed by the text file you wish to open $program_location = @ProgramFilesDir & "\Folder\program.exe" $file_location = "C:\Desktop\text.txt" Run( $program_location & " " & $file_location & "") to find the locations right click on the short-cut left click properties copy the location (ex C:\desktop\...) copy the program location to $$program_location = and the file location to $file_location = hope it helps 8) Link to comment Share on other sites More sharing options...
JoeCool Posted August 12, 2005 Author Share Posted August 12, 2005 Use the generic Run statement for com, lnk, exe(programs only)FileOpen for text filesIniCreate, write, etc for Ini'sbesides that Shellexecute or use Larrys Au3record to doubleclick on the desired file<{POST_SNAPBACK}>FileOpen is use to open a text file to read or write inside from a script .samething for IniCreate for a .ini file.That was not what I wanted to do Link to comment Share on other sites More sharing options...
JoeCool Posted August 12, 2005 Author Share Posted August 12, 2005 (edited) AutoIt Smith had it right. you do not use the run/comspec to open a text filein this example. You use the Word/excell program followed by the text file you wish to open$program_location = @ProgramFilesDir & "\Folder\program.exe" $file_location = "C:\Desktop\text.txt" Run( $program_location & " " & $file_location & "")to find the locationsright click on the short-cutleft click propertiescopy the location (ex C:\desktop\...)copy the program location to $$program_location =and the file location to $file_location =hope it helps8)<{POST_SNAPBACK}>Yes but that was what I didn't want to do :-)And, Yes you can used run comspec to simulate a double click on a file .See next message Edited August 12, 2005 by JoeCool Link to comment Share on other sites More sharing options...
Valuater Posted August 12, 2005 Share Posted August 12, 2005 in other wordsrun( @ComSpec & " /c start ""C:\Program Files\txt.txt""", "", @SW_HIDE )won't work8) Link to comment Share on other sites More sharing options...
Valuater Posted August 12, 2005 Share Posted August 12, 2005 (edited) You mean like this $program_location = @ProgramFilesDir & "\Folder\program.exe" $file_location = "C:\Desktop\text.txt" RunWait(@COMSPEC & " /c start " & $program_location & " " & $file_location & "") should work also 8) EDIT: took out a space Edited August 12, 2005 by Valuater Link to comment Share on other sites More sharing options...
JoeCool Posted August 12, 2005 Author Share Posted August 12, 2005 (edited) First some info from Bill:cmd info at :http://www.microsoft.com/resources/documen.../en-us/cmd.mspxThere's interesting info on "start" command at the bottom of that page.So now opening a file like a doubleclick How it can be do :;an excel file run( "cmd /c ""C:\Program Files\copy of xyz.xls""", "", @SW_HIDE ) ;txt file run( "cmd /c ""C:\Program Files\copy of txt.txt""", "", @SW_HIDE ) ;generic approach $d = "C:\Program Files\" $f = "blahblah.xls" run( "cmd /c " & """" & $d & $f & """", "", @SW_HIDE ) PS. double quote are important things there :-) Edited August 12, 2005 by JoeCool Link to comment Share on other sites More sharing options...
Valuater Posted August 12, 2005 Share Posted August 12, 2005 (edited) First some info from Bill:cmd info at :http://www.microsoft.com/resources/documen.../en-us/cmd.mspxThere's interesting info on "start" command at the bottom of that page.So now opening a file like a doubleclick How it can be do :;an excel file run( "cmd /c ""C:\Program Files\copy of xyz.xls""", "", @SW_HIDE ) ;txt file run( "cmd /c ""C:\Program Files\copy of txt.xls""", "", @SW_HIDE ) ;generic approach $d = "C:\Program Files\" $f = "blahblah.xls" run( "cmd /c " & """" & $d & $f & """", "", @SW_HIDE ) PS. double quote are important things there :-)<{POST_SNAPBACK}>glad you found your answer. Like i said...you do not use the run/comspec to open a text file...8) Edited August 12, 2005 by Valuater Link to comment Share on other sites More sharing options...
JoeCool Posted August 12, 2005 Author Share Posted August 12, 2005 (edited) in other wordswon't work8)<{POST_SNAPBACK}>I know, I try it and it didn"t work when you have space inside folder name ...BTW that was the solution from hgeras Edited August 12, 2005 by JoeCool Link to comment Share on other sites More sharing options...
Valuater Posted August 12, 2005 Share Posted August 12, 2005 (edited) tested... does not workrun( "cmd /c " & """" & $d & $f & """", "", @SW_HIDE )tested, corrected.... this worksrun( "cmd /c " & " " & $d & " " & $f & " ", "", @SW_HIDE )8)PS... no double quotes Edited August 12, 2005 by Valuater Link to comment Share on other sites More sharing options...
JoeCool Posted August 12, 2005 Author Share Posted August 12, 2005 (edited) tested... does not worktested, corrected.... this worksrun( "cmd /c " & " " & $d & " " & $f & " ", "", @SW_HIDE )8)PS... no double quotes<{POST_SNAPBACK}>Well it works for me I add two spaces to clean it a little. $d = "C:\Program Files\" $f = "copy of xyz.xls" run( "cmd /c " & " """ & $d & $f & """ ", "", @SW_HIDE ) Edited August 12, 2005 by JoeCool Link to comment Share on other sites More sharing options...
Valuater Posted August 12, 2005 Share Posted August 12, 2005 the problem for me is there was no space between "$d & $f". this worked(just added the space using the double quotes) run( "cmd /c " & " """ & $d & " """ & $f & """ ", "", @SW_HIDE ) 8) Link to comment Share on other sites More sharing options...
Frozenyam Posted August 12, 2005 Share Posted August 12, 2005 Hummm basic question ...I try to open file like 2click does on an icon.( files like click an excel file or a word document .... )I played with run command but I need the full path of the application ...Is this a command somewhere that do that ? :"><{POST_SNAPBACK}>I'm bored, so I'll try writing a script to query a few reg keys or a Windows .dll to try and get that to work through AutoIt. I thought I saw a reg key the other day while roaming the registry that might be of use. Check back with me in a few days if I haven't re-posted here. "... and the Lord said to John, "Come forth and ye shall receive eternal life," but instead John came fifth and won a toaster." Link to comment Share on other sites More sharing options...
JoeCool Posted August 12, 2005 Author Share Posted August 12, 2005 I'm bored, so I'll try writing a script to query a few reg keys or a Windows .dll to try and get that to work through AutoIt. I thought I saw a reg key the other day while roaming the registry that might be of use. Check back with me in a few days if I haven't re-posted here.<{POST_SNAPBACK}>Thanks but I found what I need $d = "C:\Program Files\" $f = "copy of xyz.xls" run( "cmd /c " & " """ & $d & $f & """ ", "", @SW_HIDE )some info there from Billhttp://www.microsoft.com/resources/documen.../en-us/cmd.mspx 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