Re: tell syntax - specifying the APPL with a preset string
Re: tell syntax - specifying the APPL with a preset string
- Subject: Re: tell syntax - specifying the APPL with a preset string
- From: Doug McNutt <email@hidden>
- Date: Thu, 8 Nov 2001 06:34:32 -0700
At 13:20 -0800 11/6/01, Christopher Nebel wrote, and it is appreciated:
There are two ways around this. First, you can use raw codes, as JJ
suggested:
open location aURL given <<class dest>>:aFile
You only need one truly raw code, because the "open location"
addition has the same code as GetURL.
on process(aURL, aFile, aBrowser)
tell application aBrowser
open location aURL given << class dest >>:aFile
end tell
end process
The results from the log window:
GetURL "
https://www.jnl.com/*******.html"
--> iCab got an error: Can't make some data into the expected type.
It works OK with Netscape but Netscape doesn't return results the way
iCab does.
I searched for "class dest" and for "OPTION\" in AppleScript help
but, as you can surely guess, I found nothing. ASLG explains that the
<<>> stuff is for inserting "raw code" but it is silent on what the
raw code "class dest" is all about. "Open location" does not appear
in the iCab dictionary. URL Access Scripting doesn't talk about it
either. So. . . I'm pretty much lost in terms of mucking with the
<<>> syntax. Is there a procedure for extracting raw code syntax from
an application's resource fork?
The other way is to use "using terms from", which was designed to
solve this exact problem -- you compute an application name at run
time, but you need to know at compile time what terms to use.
tell application theBrowser
using terms from application "iCab"
GetURL aURL to file aFile
end
end
This one fails to run as I tried it below. Something about "can't
convert aBrowser to correct type".
on process(aURL, aFile, aBrowser)
tell application aBrowser
using terms from application aBrowser
GetURL aURL to file aFile
end using terms from
end tell
end process
Of course if I replace 'aBrowser' with '"iCab"' in the 'using terms
from' line it works OK but the concept of changing the designated
browser programmatically (which one is currently up and running?) is
completely lost. I might as well just not use variable 'aBrowser' at
all.
Next step, I guess, is to try sending short scripts from MacPerl or
MPW which will be compiled each time they are executed. That way the
browser selection can be made on the fly. Surely the extra time will
not be noticed. Can I ask an AppleScript applet to read a source file
as text, compile it, and execute it without user interaction?
Methinks I expect way too much from AppleScript.
--
--> Love your country. But don't trust its government. <--