ExecFile Help

Blitz3D Forums/Blitz3D Beginners Area/ExecFile Help

mintybreath(Posted 2008) [#1]
Hi everyone. Been busy the last few weeks, and have finals this week, so ive been gone from coding for a little while. Im trying to get back into it though, and was playing around with the execfile command, when i decided i needed help. I tried to do a simple program, where you press the enter button, and it opens up Internet Explorer. Well that didnt work.
I might just be a little rusty, but could anyone offer some help?

I think this is where the problem would be, and if that looks like it checks out, then ill just post the whole thing.
If KeyHit(28) Then
	ExecFile("C:\Program Files\Internet Explorer\iexplore.exe")
EndIf



Hotshot2005(Posted 2008) [#2]
I think Blitzplus can do internet open files but I am not sure about Blitz 3D....


Gabriel(Posted 2008) [#3]
Try:

ExecFile("http://www.google.com")


It will then use your default browser and won't care if your browser is installed in a non-standard folder or drive.


mintybreath(Posted 2008) [#4]
Oh that makes much more sense. Although, i was just testing using a internet browser. If i were to insert, a file destination or something, will it open the file?


Zethrax(Posted 2008) [#5]
It will shell execute the file (open it in whatever progam is set as the default to open that filetype) the same as if you had double clicked on the file's icon. If you specify a web page address on the internet ( http://yoursite.com/yourpage.html ), it will attempt to open that address in your default browser

Also, if you want to open a file that has spaces in the filepath you should wrap the filepath in double quotes.

eg.
ExecFile( Chr$( 34 ) + "C:\Program Files\Internet Explorer\iexplore.exe" + Chr$( 34 ) )

Most programs that can open other files will accept the path of the file to open as a commandline parameter, so you can have execfile start a program and then have that program open a specified file.

eg.
ExecFile( Chr$( 34 ) + "C:\Program Files\Internet Explorer\iexplore.exe" + Chr$( 34 ) + " " + Chr$( 34 ) + "yourwebpagefilepath/yourwebpagefile.html" + Chr$( 34 ) )


Nike(Posted 2008) [#6]
lol i tried that and the execfile("www.google.com")
works but it wont quit.
code is

repeat
if keyhit(28) then
execfile("www.google.com")
endif
forever


Mortiis(Posted 2008) [#7]
Because it repeats forever. Try just this line;

ExecFile("http://www.google.com")


or if you want a loop there (its not needed though)

Repeat
Until KeyHit(28)

ExecFile("www.google.com")