launching an outside file
BlitzMax Forums/BlitzMax Beginners Area/launching an outside file
| ||
| Coders :-) My program produces a result.txt file. It would be nice to launch it so that it is opened by the default text editor. How is this done? Julian (^_^) 69696969696969 |
| ||
try this http://www.blitzmax.com/Community/posts.php?topic=49359system_ "result.txt" |
| ||
| I have a tutorial here: http://www.blitzmax.com/Community/posts.php?topic=53709 |
| ||
| Hi assari :-) I am sorry to report that system_ "result.txt" does not work. The compiler made no complaint so it must be a proper command syntax. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Hi Jim Brown :-) proc = TProcess.Create("DirectoryListing.txt", 0) This did not work, either. I also tried it with different numbers after the filename. Thank you both for trying :-) Julian (^_^) IIIIIIIIIIIIIIIIIIIIIIIIIIII |
| ||
What about ..
proc=TProcess.Create("Notepad DirectoryListing.txt",0)
Or
proc=TProcess.Create("Explorer DirectoryListing.txt",0)
|
| ||
This is tested to workout:Tstream=WriteStream("c:\result.txt")
WriteLine(out,"hello")
CloseStream(out)
system_ ("notepad.exe c:\result.txt") |
| ||
| Hi Jim Brown :)) proc=TProcess.Create("Explorer DirectoryListing.txt",0) This came close. It did open the file - with Internet Explorer :-D It also works with NotePad.exe but I want it to open with the currently prefered text editor. In my case, that is TextPad. NotePad.exe lives in C:\WINDOWS\system32 iexplore.exe lives in C:\Program Files\Internet Explorer TextPad.exe lives in C:\Program Files\TextPad 4 So. What should I substitute for "Explorer" to distinguish the file system from the internet? |
| ||
Try thisExtern "win32"
Function ShellExecute(hwnd:Int, lpOperation$z,lpFile$z,..
lpParameters$z,lpDirectory$z, nShowCmd:Int)="ShellExecuteA@24"
End Extern
out:Tstream=WriteStream("c:\result.txt")
WriteLine(out,"hello there")
CloseStream(out)
ShellExecute(0,"open","c:\result.txt","","",3)see here for how to use ShellExecute. |
| ||
try this for size:
Extern "win32"
Function ShellExecuteA(hwnd,op$z,file$z,params$z,dir$z,showcmd)
End Extern
out:Tstream=WriteStream("c:\result.txt")
WriteLine(out,"hello")
CloseStream(out)
ShellExecuteA(0,"open","c:/result.txt","","",SW_SHOWNORMAL)
google "msdn ShellExecute" for more info arrgh lost to assari by 58seconds [edit] here's a simpler form
out:Tstream=WriteStream("c:\result.txt")
WriteLine(out,"hello")
CloseStream(out)
OpenURL "c:/result.txt"
|