metalsoft Posted June 15, 2006 Share Posted June 15, 2006 Hi,I want to open a txt file with my autoit script. The script produces a log file and at the end of the script I want to execute/open/run this logfile. It should just appear in the standard application that is connected with the filetype.I tried run but it only executes files like exe/bat etc ..So what can I do ?Thanks Link to comment Share on other sites More sharing options...
jvanegmond Posted June 15, 2006 Share Posted June 15, 2006 (edited) Well, opening in the standard application is not a easy thing to do. It would be best if you could just use notepad for this application. (Look in the AutoIt helpfile for Tutorial.) If you want to know what the standard application is you have do this (Untested): RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\OpenWithList", "a") Edited June 15, 2006 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted June 15, 2006 Moderators Share Posted June 15, 2006 Well, opening in the standard application is not a easy thing to do. It would be best if you could just use notepad for this application. (Look in the AutoIt helpfile for Tutorial.) If you want to know what the standard application is you have do this (Untested): RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\OpenWithList", "a")Its not that hard, just use something like this: $sPath = "path to your text file" Run("Notepad.exe " & $sPath) Link to comment Share on other sites More sharing options...
heibel Posted June 15, 2006 Share Posted June 15, 2006 (edited) Hi Just use: Run(@comSpec & " /c start "& @Scriptdir & "\" & "yourfile.txt", "", @SW_HIDE) ofcourse: change the ...@Scriptdir & "\" & "yourfile.txt"... to the proper filepath... Note: using the suggested Run("Notepad.exe "...) Remember the name of "Notepad" might be 'English-windows-versions-ONLY"... HTH Edited June 15, 2006 by heibel Link to comment Share on other sites More sharing options...
jvanegmond Posted June 15, 2006 Share Posted June 15, 2006 Lol... Keep it simple. ^^ github.com/jvanegmond Link to comment Share on other sites More sharing options...
tittoproject Posted June 15, 2006 Share Posted June 15, 2006 Run(@comSpec & " /c start "& @Scriptdir & "\" & "yourfile.txt", "", @SW_HIDE) You have to quote the file path to avoid issues with spaces: $file = 'X:\Path With Space\file.txt' Run(@comSpec & ' /c start "' & $file & '"', '', @SW_HIDE) 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