-
getURL in projector
Hi, I'm working on a cross-platform CD-ROM. I want to make a link to my website on the CD. I've tried getURL, but it's extremely buggy. If my browser's already open and I click on the link, the browser window doesn't come to the front (so it looks like nothing happens). That's on the PC side. I don't know what happens on the Mac side yet.
Is there a better way to link to a website from a CD? Does anyone else have this problem? I initially had this problem when I tried to link to a PDF -- I assumed it was the PDF that caused the problem (and I learned how to get the PDFs to work). But apparently it's getURL itself that's a problem. I'm on Windows XP and using Internet Explorer 6.0.
Any suggestions?
Thanks, Phyllis
-
Banned By GMF Wannabe
Hi, download a copy of Flash Studio PRO v2 and you can use the simple flashstudio.exec FSCommand to launch any file or program you need!
-
Hi thanks. Unfortunately I won't be able to afford that one right now (and I assume that will only help on the PC side?). This is the first Flash CD-ROM I've made so have to see how well it works out before spending on improvement utilities.
I write an executable (as well as an Applescript) to get PDF's to open cross-platforum. Maybe there's a way I can write an executable to open URL's? Maybe an HTML document that's on the CD which meta refreshes to the webpage I want? Just brainstorming ways to get this to work...
Thanks! Phyllis
-
Maybe there's a way I can write an executable to open URL's? Maybe an HTML document that's on the CD which meta refreshes to the webpage I want?
Okay, this works great. Though it seems a roundabout way to open a webpage! Does anyone else have this problem?
Oh, and for Applescripting, does anyone know if I would use the same Applescript that opens PDF files to open a webpage? The Windows executable I'm using doesn't care what file type I'm opening.
Thanks,
Phyllis
-
Lifetime Friend of Site Staff
Finder should take care of the details as long as you can identify the file you want to open. So a variation of the PDF opening example should do the trick for HTML files as well.
Code:
tell application "Finder"
activate
select file "index.html" of folder "MyHTMLFiles" of disk "MyCD"
open selection
end tell
-
Wow that code looks simpler! Here's what I'm using. Is this the same thing?
Code:
--set the name of the file to open
property fileName : "homepage.html"
--get the path to the containing folder
set myPath to (path to me as string)
set AppleScript's text item delimiters to ":"
set the parentFolder to ¬
((text items 1 thru -2 of myPath) & "") as string
set AppleScript's text item delimiters to ""
-- find the flash file
try
set targetFile to alias (the parentFolder & fileName)
on error
--ie if there's no file here by this name, it will quit.
return quit
end try
tell application "Finder"
open file targetFile
end tell
Is there any reason to think that an html file that's refreshing to an Internet page would cause problems on any of the systems? I just can't think of a better way to do this. I thought I'd check out the *********** stuff, but I know that won't help me on the Mac side.
Thanks for all the help. This is a great forum!
Phyllis
-
Hah! I just realized: I don't need the refresher HTML page. The executable will take a website as is and open it (I guess it recognizes the http part). (For some reason I assumed it had to be a file that was on the CD.)
And now my question is: Will Mac do the same thing in an Applescript?
If I change the first two lines of the Applescript to read:
Code:
--set the name of the file to open
property fileName : "http://www.homepage.org/"
Will that work? I don't have a Mac to test it out today.
I'm betting I need a wholly different Applescript for the webpages. This is the one I'm using (and it's working with PDF's or other docs). It's got a lot of other stuff in it that's probably telling the Mac what folder to look in (which you wouldn't need for a webpage, though I don't know how to edit it).
Code:
--set the name of the file to open
property fileName : "thedocument.pdf"
--get the path to the containing folder
set myPath to (path to me as string)
set AppleScript's text item delimiters to ":"
set the parentFolder to ¬
((text items 1 thru -2 of myPath) & "") as string
set AppleScript's text item delimiters to ""
-- find the flash file
try
set targetFile to alias (the parentFolder & fileName)
on error
--ie if there's no file here by this name, it will quit.
return quit
end try
tell application "Finder"
open file targetFile
end tell
Any help is appreciated!
Thanks, Phyllis
Last edited by pjutter; 03-24-2004 at 07:20 PM.
-
Lifetime Friend of Site Staff
The long script you have is a little more generic than the one I showed you. Yours allows you to figure out where the applescript is and open files relative to that location. Mine assumes you're running from a CD so you can use "select file" to take a few shortcuts by directly referencing the name of the CD and the folder on the CD that you want.
-
Oh okay that makes sense. Yours I can understand. Now I need to figure out if it can work directly with a webpage. I think I saw a generic applescript for webpages somewhere. I'll see if I can locate it and post it.
Thanks, Phyllis
-
Okay I saw this simple code on a webpage (though I don't have a mac to test it right now):
Code:
tell application "Internet Explorer"
Activate
OpenURL "http://www.mywebpage.com/"
end tell
Any idea how I would modify the first line? I don't want to look for Internet Explorer -- I want to look for whatever program handles webpages by default on the person's Mac.
I would use the other script for my PDF's, but I'm thinking I need some variation of this new one for webpages (if I'm wrong, please let me know). I'd like to avoid the refresher method I was using (where I created an HTML page on the CD that refreshed to the webpage I wanted).
Unfortunately I don't know Applescripting.
I appreciate all the help!!! I've learned a lot in the past 2 weeks. This is both the first project I've tried in Flash and the first cross-platform CD I've tried to make.
Phyllis
-
Lifetime Friend of Site Staff
It's even easier than you think to open URLs..
Code:
tell application "Finder"
open location "http://www.northcode.com"
end tell
-
Wow, that IS easy.
THANKS!!! Time to go rent a Mac for a while. Wish they'd buy me one here.... (that'll never happen)
Phyllis
-
Alas, I tried this script, but in testing on the Mac, I just get the error message "Some data was the wrong type." I had no problems opening the PDF with the other script, so I think I saved them correctly. The test was on an OS X. I'll go back to the refresher page method. Or do you think Mac handles getURL better than Windows?
Thanks, Phyllis
Last edited by pjutter; 03-25-2004 at 09:08 PM.
-
Lifetime Friend of Site Staff
Odd, I wrote and tested that little script on two OS/X machines and it worked okay. They both had IE installed though. I don't know what Finder will do if IE isn't present. I know on one of those machines that IE was NOT the default but it opened IE anyway.
-
Weird. I might try it again over the weekend when I can borrow a better Mac than the hunk o' junk I've been renting. Maybe writing the script on an OS X will help (or maybe I just screwed it up somehow). I've been renting an old OS 8.6 to write these scripts. At any rate, I'll try it again.
Thanks for all your help!!! You've been a real lifesaver on this project!
Phyllis
-
Okay now I'm desperate! I tried the finder script to call the URL page. It worked on one of the OS X's I tried but not the other. I also tried using an HTML refresher page with the generic Mac file-opening script. That works fine on most of the Macs. But on OS X it caused the Mac to restart in classic mode (as OS 9).
So I've got a serious problem with my CD!!!
2 questions:
[list=1][*]Does the getURL function in the Macintosh standalone projector work better than the Windows version? On Windows, I was always having a problem with the URL opening behind the projector (and being invisible). I'm testing getURL on an OS X laptop that I borrowed right now. I don't seem to be having that problem at the moment. Maybe it's not commonly a problem with Mac? Does anyone know?
[*]Assuming that getURL *does* work on Mac in a projector (and that's a BIG assumption on my part), is there any way to rewrite the following function (by Northcode) so that it says to execute the .exe file for PC, but use the getURL command for Mac?[/list=1]
Code:
function SmartExec(target)
{
platform = $version.slice(0,3);
if (platform == "WIN") {
fscommand("exec", target + ".exe");
} else {
fscommand("exec", target + "_script");
}
}
I'm guessing the second fscommand line could change to start with getURL, but then I need some way to specify a second target (one where I'd fill in the webpage for Mac). Maybe it would be something like this (and I'm really just guessing here -- I'm not a coder):
Code:
function SmartWeb(target,target2)
{
platform = $version.slice(0,3);
if (platform == "WIN") {
fscommand("exec", target);
} else {
getURL(target2);
}
}
I know the getURL line is probably wrong. But would something like that work? And if it did, is there a way to include "target=_blank" (I've heard the CD's need that with getURL though maybe it's not that important).
Anyone know on Mac web-links?
I'm desperate. Must send this to a duplicator tomorrow!!
Thanks very much,
Phyllis
-
Lifetime Friend of Site Staff
getURL("www.flashkit.com", "_blank") should open the URL in a new browser window on either platform (as you noted, there are some glitches under Windows).
Your SmartWeb function looks fine!
If the URLs you need to open are always just the domain name, you might be able to simplify the calls a bit, like this...
Code:
function SmartWeb(target)
{
platform = $version.slice(0,3);
if (platform == "WIN") {
fscommand("exec", target + ".exe");
} else {
getURL("http://www." + target + ".com", "_blank");
}
}
So if you had an EXE called flashkit.exe for the PC and you wanted to open www.flashkit.com on both platforms, you could do something like... SmartWeb("flashkit") and let the function handle the rest.
You could also use the target parameter to lookup the real target in a list and hide all the details in the SmartWeb function, like this...
Code:
function SmartWeb(target)
{
platform = $version.slice(0,3);
if (target == "flashkit")
{
exe = "flashkit.exe";
url = "http://www.flashkit.com";
}
if (target == "northcode")
{
exe = "northcode.exe";
url = "http://www.northcode.com"
}
if (platform == "WIN") {
fscommand("exec", exe);
} else {
getURL(url, "_blank");
}
}
-
Thanks!!!
It'll beat writing all those extra webpage scripts. I don't know yet if it's working. I've borrowed an OS X laptop, but it doesn't have Internet access. However, when I try the link it does bring up the Safari toolbar which is a hopeful sign. Will have to get my boss to try it from home (it's her laptop and she has internet access at home).
I'm wonderin' if it's not just her Mac that doesn't work right. I know those scripts worked on other computers that I tried them on (including one OS). Her laptop has Internet Explorer and Safari, and it looks like Safari is the default.
Thanks for your help!!
Phyllis
-
Well now it gets even better (sigh). I rebooted and can tell you that the getURL bit DOES work (even though I can't get online I can see that the page is TRYING to boot). HOWEVER, the default browser on this laptop I'm borrowing is Safari. I notice that Safari isn't picking up the URL (it's opening the browser but just trying to open the browser's default page, not the link I've provided in getURL). I did a search on this site and found that several folks have the same problem with Safari, and there doesn't seem to be a workaround.
So. There's the newest problem with getURL. It works fine on Mac (in that it stays in the foreground) but doesn't work if the default browser is Safari.
So now I'm back to needing an Applescript!
I found that the Applescript code:
Code:
tell application "Finder"
open location "http://www.northcode.com"
end tell
works on this laptop if I only use the middle line
Code:
open location "http://www.northcode.com"
If I create that one-line application in OS X it works great. But I don't have an OS X to borrow for creating all the scripts. I have to use an OS 8.5:
If I create that same one-line application in OS 8.5 it works on the OS X also BUT it forces OS X to reboot as classic OS 9. I don't know why.
I notice that the applescript calls Internet Explorer rather than Safari (even though Safari is apparently the default on here).
I guess maybe that's the best I can hope for.
Would saving differently help? I've been saving the applescripts as applications. I could also try saving as a compiled script, but I don't know if it would make any difference.
Thanks for all the help!
Phyllis
Last edited by pjutter; 04-08-2004 at 05:21 PM.
-
WAIT, I'm wrong about that last thing. The applescript did use this laptop's default browser (Safari). Safari loads the URL just fine when it comes from the applescript. It just doesn't work with getURL.
I guess I'll settle for this since it seems to be the best I can do! I hate having the browser reboot in classic. Especially since I'm gonna distribute the OS X version of Adobe Reader on it (which won't open in classic since it's OS X specific).
Hm. What happens if you ONLY have OS X on your computer? Any ideas? Here's the script from OS 8.5 if you're willing to test it....
On second thought, maybe it's best to use getURL (thanks for the function!) and just tell the Mac users to use Internet Explorer (at least that should work with any version of OS)....
Hmmmmmm.
Thanks! Cross-platform is a headache!!
Phyllis
Last edited by pjutter; 04-08-2004 at 05:52 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|