Can't get inline events into osascript

I am getting an error when trying to put an inline event into osascript or osacompile
eg: <>
The single-byte brackets won’t take. Is there any way around this? Or an alternative like writing the event longhand?

Richard

Hmm… Apple’s tech note tells us that ‘do shell script’ works with UTF-8 encoding. Here is the technote:
http://developer.apple.com/technotes/tn2002/tn2065.html

When text-encoding problems occur, they suggest saving source code to a text file and then “piping” it to the osa tools.

P.S. There is a forum here called “AppleScript and the Command Line,” where these sorts of issues are usually posted to:
http://bbs.applescript.net/viewforum.php?f=9

No, I think the problem is that you are using “<<” and “>>” instead of “«” “»”. To get these proper marks, use Option- and Option-Shift- respectively.

Jon


Richard said, “The single-byte brackets won’t take…” By single-byte, I assumed he meant that he was using the chevron characters.

Thanks for the quick reponse.
I tried UTF8 and got the same result.
I tried a bunch of different ways. No luck yet.
Maybe there is an escape sequence.
(I am using the chevron)
Richard

I think this is a bug in osascript. As an example of what I think the poster is trying to do, see this code:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

I am trying to talk to an application out of PHP.
At the moment, I am using osascript and an AppleScript saved with ScriptEditor -It has to look for a text file and read in the data I want to send.

What I would really like to do is in my PHP define the data into an AppleScript and send it straight to osascript. I can NOT do this with either -e or writing out a file (not UTF-8 either), in all cases the « causes an error -unless it is saved by ScriptEditor. I think it is using a different structure for its byte-code. The inline event flag «» just doesn’t seem to work with osascript.

Richard

What is the application you are trying to talk to because what you are doing seems pretty straight forward so maybe we can approach this from a different angle. In the worst case scenario, you can do what I’ve advocated several times in the past, create either a folder action script or a stay-open app that looks to a folder and have your PHP script write the data to a file. When the file is written, the script retrieves the data and does something useful with it.

Jon

As I suspected, you can fake out the osascript limitation by using the ASCII Character command but you have to get very creative with the quotes:

So now that we are sufficiently passing the chevrons through to the osascript, we now just need to execute that script by adding a “run script” to the front of it:

or, all in one line:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

Terrific help!
I can now do what I want from the command-line. The only problem is that it seems that PHP will not allow called to osascript as Web server.
A script work fine if I use a command-line call to the CGI form of PHP, but not in normal HTTP server mode. I guess this a sercurity restriction…