OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Basic: How to: Open web browser from inside macro ?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
richhill
OOo Advocate
OOo Advocate


Joined: 16 Jun 2004
Posts: 418
Location: Mesa, AZ

PostPosted: Thu Oct 06, 2005 7:36 am    Post subject: Basic: How to: Open web browser from inside macro ? Reply with quote

I hope there is a simple way (ie 1 line) to dothis :

Something like openwebbrowser("www.oooforum.org")

Thanks in advance - I'll pay it forward!
_________________
OOo Calc tips: http://www.openofficetips.com
Back to top
View user's profile Send private message Visit poster's website
probe1
Super User
Super User


Joined: 18 Aug 2004
Posts: 2060
Location: Chonburi Thailand Asia

PostPosted: Thu Oct 06, 2005 7:42 am    Post subject: Reply with quote

Do you mean a OOo function of
Code:

shell( "/path/to/firefox www.openoffice.org" )


Not that I'm aware of.

HTH
_________________
Cheers
Winfried
My Macros
DateTime2 extension: insert date, time or timestamp, formatted to your needs
Back to top
View user's profile Send private message Visit poster's website
richhill
OOo Advocate
OOo Advocate


Joined: 16 Jun 2004
Posts: 418
Location: Mesa, AZ

PostPosted: Thu Oct 06, 2005 8:00 am    Post subject: Reply with quote

Probe,

That is what I'm looking for! Just one thing regarding your example - does OOo have some env variable for /path/to/firefox - like BROWSERPATH or something? This needs to be
platform/browser independent - whether it is IE on WinXP or Firefox on Linux

Thanks again!
_________________
OOo Calc tips: http://www.openofficetips.com
Back to top
View user's profile Send private message Visit poster's website
9point9
Moderator
Moderator


Joined: 31 Aug 2004
Posts: 3904
Location: UK

PostPosted: Thu Oct 06, 2005 8:26 am    Post subject: Reply with quote

One way I can think of:

Code:
Shell ("about:blank")


This should start up the default web browser with a blank page. Unfortunately mine keeps going to IE for some terrible reason.
_________________
Arch Linux
OOo 3.2.0

OOoSVN, change control for OOo documents:
http://sourceforge.net/projects/ooosvn/
Back to top
View user's profile Send private message Visit poster's website
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 4021
Location: Lawrence, Kansas, USA

PostPosted: Wed Oct 12, 2005 8:07 am    Post subject: Reply with quote

Funny, I just had to code a macro this morning for one of my co-workers. (on Windows)
Code:
Sub Main
   ' This opens an internet browser.
   Shell( "cmd.exe /cStart http://www.digg.com" )
   
   ' This opens a document on the disk
   cQuote = Chr(34)
   Shell( "cmd.exe /c" + cQuote + "C:\Documents and Settings\dbrewer\Desktop\util.pdf" + cQuote )
End Sub


What I had to code was much larger than this. My coworker had a Base document. One of its fields was a text field with either a URL or a pathname to a document on a fileserver. I had to add two kickable buttons to the database form which would open the document or open a browser to a url.
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
lesguilw
Power User
Power User


Joined: 09 Nov 2005
Posts: 57
Location: Frenchy in Sevilla, Spain

PostPosted: Mon Nov 20, 2006 6:10 am    Post subject: Reply with quote

If someone has a code for Unix I am interested, if it includes the system detection (whether Windows or Unix) it would be even better.

Cheers,
William
Back to top
View user's profile Send private message
probe1
Super User
Super User


Joined: 18 Aug 2004
Posts: 2060
Location: Chonburi Thailand Asia

PostPosted: Mon Nov 20, 2006 6:39 am    Post subject: Reply with quote

for Unix: use a "shell" command like the example above.

for detecting the operating system see runtime function
Code:
GetGUIType
(F1 help)

Does this help?
_________________
Cheers
Winfried
My Macros
DateTime2 extension: insert date, time or timestamp, formatted to your needs
Back to top
View user's profile Send private message Visit poster's website
lesguilw
Power User
Power User


Joined: 09 Nov 2005
Posts: 57
Location: Frenchy in Sevilla, Spain

PostPosted: Tue Nov 21, 2006 4:39 am    Post subject: Reply with quote

Yes this helped, it put on the track of this very useful post: http://www.oooforum.org/forum/viewtopic.phtml?t=32575&view=previous

But unfortunately I cannot find any Unix shell command to achieve to open a default browser window. Google is not very comprehensive with my query and my favorite Unix experts don't have a clue.

Any simple idea on that?
Back to top
View user's profile Send private message
probe1
Super User
Super User


Joined: 18 Aug 2004
Posts: 2060
Location: Chonburi Thailand Asia

PostPosted: Tue Nov 21, 2006 7:45 am    Post subject: Reply with quote

I'm afraid there is no Unix standard browser....

If you have a defined environment, you could issue a command, but if you don't....
_________________
Cheers
Winfried
My Macros
DateTime2 extension: insert date, time or timestamp, formatted to your needs
Back to top
View user's profile Send private message Visit poster's website
lesguilw
Power User
Power User


Joined: 09 Nov 2005
Posts: 57
Location: Frenchy in Sevilla, Spain

PostPosted: Tue Nov 21, 2006 2:26 pm    Post subject: Reply with quote

Well... then I guess my Unix users will have to copy/cut the url from a custom message box and that will be it Wink

Cheers,
William
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group