Liberty BASIC Community Forum
« How would a person Launch a HTML File in Liberty ? »

Welcome Guest. Please Login or Register.
Sep 19th, 2017, 1:53pm


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: How would a person Launch a HTML File in Liberty ?  (Read 213 times)
michael
Guest
question How would a person Launch a HTML File in Liberty ?
« Thread started on: May 27th, 2015, 5:06pm »

I made a program previously that would generate a HTML file. Then you would open the "Myweb.HTML" file and it would open the internet page and display the generated web page.. I changed the save location to C:\ to make it a default location on most computers.

If I try to use
Run "C:\Web.html" - I get an error
If I try to use :
DB$= "C:\Programfiles (x86)\Internet Explorer\iexplorer.exe C:\Web.html"
Run DB$
It says Runtime error: Error opening file
But if I right click the HTML file and OPEN it, it works fine..

Please help. If I get the answer to this ( and there is a solution) then I can continue on my HTML/ CSS Page generator program.
« Last Edit: May 27th, 2015, 5:42pm by michael » User IP Logged

Chris Iverson
Administrator
ImageImageImageImageImage


member is offline

Avatar

20% Cooler


Homepage PM

Gender: Male
Posts: 2278
question Re: How would a person Launch a HTML File in Liber
« Reply #1 on: May 27th, 2015, 7:37pm »

If any paths include spaces, they need to be quoted, or the system won't be able to figure out what exactly is supposed to be executed. (Spaces are dividers between arguments to programs; without quotes to specify what's what, paths with spaces in them become ambiguous. The system doesn't know if a space is a delimiter or part of a path.)

Code:
DB$= chr$(34) + "C:\Programfiles (x86)\Internet Explorer\iexplore.exe" + chr$(34) + " " + chr$(34)+ "C:\Web.html" + chr$(34)
'Run DB$
print DB$ 'to see the resulting string 


That said, instead of opening it in one browser or another, you should use the Windows Shell to open it, because the shell will direct to whatever internet browser the user has set as default.

Code:
run "explorer.exe " + chr$(34) + path$ + chr$(34) 



EDIT: Also, just noticed, Internet Explorer's executable is named IEXPLORE.EXE, not IEXPLORER.EXE. I've fixed that in my example.
« Last Edit: May 27th, 2015, 7:39pm by Chris Iverson » User IP Logged

"Do you believe in destiny?" - Pyrrha Nikos, RWBY
"With what wish will your Soul Gem shine?" - Kyubey, Puella Magi Madoka Magica
michael
Guest
xx Re: How would a person Launch a HTML File in Liber
« Reply #2 on: May 28th, 2015, 1:31pm »

That unfortunately didn't work.. Thanks for trying though.. After many hours of troubleshooting, I finally got it figured out that SPACES make all the difference in the world..
I moved "Myweb.HTML" directly into the same folder as iexplorer.exe and made this code..
(Keep in mind that you need ADMINISTRATOR permission to paste the file there. but now that the problem is fixed, I can properly launch a file anywhere. )
There are many HTML editors out there that can launch HTML files, BUT the idea is to make it so that CUSTOM creations can be easily created using Subs in LIBERTY BASIC and Launched within the program..

If you make any mistake with the following code, it can mean the difference between finding a file and not finding it. You wouldn't believe how similar this is to the code that DIDN'T work.

HERE IS THE CODE THAT WORKS : :)
What a relief !

Code:
navigator$ ="C:\Program Files (x86)\Internet Explorer\iexplore.exe"
db$ = navigator$+" "+"C:\Program Files (x86)\Internet Explorer\Myweb.html"
run db$  ' to actually launch this ( enable this line to see what it does
end

 
« Last Edit: May 28th, 2015, 1:55pm by michael » User IP Logged

Chris Iverson
Administrator
ImageImageImageImageImage


member is offline

Avatar

20% Cooler


Homepage PM

Gender: Male
Posts: 2278
question Re: How would a person Launch a HTML File in Liber
« Reply #3 on: May 28th, 2015, 2:02pm »

Oops, also my fault. There was another problem with the original code that I duplicated.

You're correct that spaces are important. Especially in the names of folders.

It's "C:\Program Files (x86)", not "Programfiles". "Program files" is two words, not one.

Fix that in my example and I bet it will launch.
« Last Edit: May 28th, 2015, 2:02pm by Chris Iverson » User IP Logged

"Do you believe in destiny?" - Pyrrha Nikos, RWBY
"With what wish will your Soul Gem shine?" - Kyubey, Puella Magi Madoka Magica
michael
Guest
xx Re: How would a person Launch a HTML File in Liber
« Reply #4 on: May 28th, 2015, 2:10pm »

It launches nicely. it actually was as simple as keeping the string assignment layout with no spaces and I'm guessing the directory isn't much different. You'll notice how I tightened up the string assignment in the code..
You wouldn't believe it was just a couple spaces... and it wasn't in the string directory assignment..
I was totally baffled!
I guess I have to be VERY strict with the spaces in everything, including in string assignment.
The following line... This is the part that saved my code:
Code:
db$ = navigator$+" "+"C:\Program Files (x86)\Internet Explorer\Myweb.html"
        '^^no spaces^^^'
 
« Last Edit: May 28th, 2015, 2:48pm by michael » User IP Logged

michael
Guest
xx Re: How would a person Launch a HTML File in Liber
« Reply #5 on: May 28th, 2015, 2:48pm »

As for the Chr$(34) inserts, I tried 6 different combinations of that type of layout and it didn't work.. The CHR$(34) actually added to the actual directory description string.

That was the first 3 hours of trial and error in the morning. And then I had a thought to try and pull out a program that I made to make a quick launch for this site and compared it to my code... and the solution was found !!.
And even when I compared the layout initially, it looked almost IDENTICAL .. That's why I am so worked up about it.
« Last Edit: May 28th, 2015, 2:48pm by michael » User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls