launching an outside file

BlitzMax Forums/BlitzMax Beginners Area/launching an outside file

julianbury(Posted 2006) [#1]
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


assari(Posted 2006) [#2]
try this http://www.blitzmax.com/Community/posts.php?topic=49359
system_ "result.txt"



EOF(Posted 2006) [#3]
I have a tutorial here:
http://www.blitzmax.com/Community/posts.php?topic=53709


julianbury(Posted 2006) [#4]
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


EOF(Posted 2006) [#5]
What about ..
proc=TProcess.Create("Notepad DirectoryListing.txt",0)

Or
proc=TProcess.Create("Explorer DirectoryListing.txt",0)



assari(Posted 2006) [#6]
This is tested to work
out:Tstream=WriteStream("c:\result.txt")
WriteLine(out,"hello")
CloseStream(out)
system_ ("notepad.exe c:\result.txt")



julianbury(Posted 2006) [#7]
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?


assari(Posted 2006) [#8]
Try this
Extern "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.


skidracer(Posted 2006) [#9]
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"