Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > simple applescript problem

simple applescript problem
Thread Tools
Fresh-Faced Recruit
Join Date: Nov 2001
Status: Offline
Reply With Quote
Nov 20, 2001, 03:10 PM
 
I'm really new to Macs, never really done much with them. I need to be able to use applescript to call a specific browser, in this case Netscape Communicator 4.78 and open an html file with it. The will have to install this browser if they don't have it, but they will get to choose where it is installed.
Basically I need to be able to make it open an html page. Any script that anyone has would be greatly appreciated.
Thanks.
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Nov 20, 2001, 04:33 PM
 
Originally posted by hillemania:
<STRONG>I'm really new to Macs, never really done much with them. I need to be able to use applescript to call a specific browser, in this case Netscape Communicator 4.78 and open an html file with it. They will have to install this browser if they don't have it, but they will get to choose where it is installed.
Basically I need to be able to make it open an html page. Any script that anyone has would be greatly appreciated.
Thanks.</STRONG>
If you have a specific file that you want to open then do this:


tell application "Netscape Communicator"
  activate
  open file "Macintosh HDesktop Folder:file.html"
end tell


If you want to prompt the user for a file do this:


tell application "Netscape Communicator"
  activate
  open file (choose file with prompt "Choose an HTML file.")
end tell


And one more thing, it seems that you want to distribute this script... more people use Internet Explorer.. but you can never be sure which browser that person uses. So if you want to open the file with their default browser, whether it be Explorer, Netscape, iCab, Opera etc... do this:

open location "file:///Macintosh HD/Desktop Folder/file.html"


And it will open that file with their default browser.

[ 11-20-2001: Message edited by: Synotic ]
     
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status: Offline
Reply With Quote
Nov 21, 2001, 02:48 PM
 
Originally posted by Synotic:
<STRONG>
tell application "Netscape Communicator"
  activate
  open file "Macintosh HD esktop Folder:file.html"
end tell

snip...
</STRONG>
and if the file isn't local (i.e. it's on a remote server):

tell application "Netscape Communicator"
  activate
  GetURL "http://www.server.net/path/to.html"
end tell

(GetURL works in both Netscape and Explorer)
Gods don't kill people - people with Gods kill people.
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Nov 21, 2001, 06:42 PM
 
Camelot, are you using my script to convert the clipboard to UBB? I made it so that you no longer get stuff like:

[b]this[/b] [b]is[/b] [b]my[/b] [b]test[/b]

insetad it cleans up the tags so it will be like:

[b]this is my test[/b]

It also makes it so that you can put in :D and not make you check off "disable smilies"

Edit: It took me forever to make the UBB code above look right but not actually execute, but the script itself doesn't work right.. just download it from
here.

[ 11-21-2001: Message edited by: Synotic ]
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:14 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2