Transferring variables between AppleScript and LiveCode
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Transferring variables between AppleScript and LiveCode
Hello, everyone.
may anyone explain how I may pass a variable from Applescript to Livecode? The execution context is Applescript (e., I am not running Applescript from within Livecode).
The example I'm attempting to get working is providing a value from a service menu applescript.
I believe this could be accomplished by sending an Appleevent and then interrogating the value of the Applescript (event handler) in Livecode, but I haven't found an example.
Thank you in advance for your ideas.
may anyone explain how I may pass a variable from Applescript to Livecode? The execution context is Applescript (e., I am not running Applescript from within Livecode).
The example I'm attempting to get working is providing a value from a service menu applescript.
I believe this could be accomplished by sending an Appleevent and then interrogating the value of the Applescript (event handler) in Livecode, but I haven't found an example.
Thank you in advance for your ideas.
Re: Transferring variables between AppleScript and LiveCode
hi sipsuper,
Long ago I did some inter application communication using AppleScript. LC's AppleScript support is limited. Digging in my old AS scripts I adapted one to what I think is similar to what you have in mind.
The AppleScript script: (use apple script's ScriptEditor to trigger the AS script from outside of LC)
Create a stack "Receiver" with 1 field "fRes" with a script at the card level:
Kind regards
Bernd
Long ago I did some inter application communication using AppleScript. LC's AppleScript support is limited. Digging in my old AS scripts I adapted one to what I think is similar to what you have in mind.
The AppleScript script: (use apple script's ScriptEditor to trigger the AS script from outside of LC)
Code: Select all
set tParameter to the current date
set tParameter to " your value " & the seconds of tParameter -- a test parameter/ would be your parameter
set tStackName to "ReceiverStack" -- your stackname here
set tCommand to "foo" -- your receiver handler here at the card level or up
-- construct an AppleScript script for Livecode here
set myScript to "send \"" & tCommand & "\" && quote & \"" & tParameter & "\" & quote to current card of stack \"" & tStackName & "\""
tell application "LiveCode 10.0.4" to do script myScript -- this executes the
set x to the resultCode: Select all
on foo pParameter
beep
put pParameter into field "fRes"
end fooBernd
Last edited by bn on Thu Jun 11, 2026 11:15 am, edited 1 time in total.
Re: Transferring variables between AppleScript and LiveCode
Hi Bernd,
I'm not sure that's the what the OP is asking but may be wrong.
Looks like they're using AppleScript independent of LiveCode but want to send an AppleScript event to LiveCode with a value to be processed there.
This strikes me as the wrong way round and my understanding is about the same as yours. But I'm not sure how an AppleScript can pass an event to LiveCode when the script is not running within LiveCode, which is my understanding of the OP (happy to be corrected...)
I'm not sure that's the what the OP is asking but may be wrong.
Looks like they're using AppleScript independent of LiveCode but want to send an AppleScript event to LiveCode with a value to be processed there.
This strikes me as the wrong way round and my understanding is about the same as yours. But I'm not sure how an AppleScript can pass an event to LiveCode when the script is not running within LiveCode, which is my understanding of the OP (happy to be corrected...)
Re: Transferring variables between AppleScript and LiveCode
Hi Stam,
I am not sure what the OP has in mind either.
I figured the OP has a Livecode thing running that uses the parameter from "service menu applescript" outside of LC to process it in a Livecode stack.
That is what the example shows. The AScript would be integrated in the external process.
I am quite curious to know his use case is.
Kind reagards
Bernd
I am not sure what the OP has in mind either.
I figured the OP has a Livecode thing running that uses the parameter from "service menu applescript" outside of LC to process it in a Livecode stack.
That is what the example shows. The AScript would be integrated in the external process.
I am quite curious to know his use case is.
Kind reagards
Bernd
Re: Transferring variables between AppleScript and LiveCode
Bernd, Stam.
Is it possible the OP is talking about the form "do as AppleScript", and wants some data to return to LC?
Craig
Is it possible the OP is talking about the form "do as AppleScript", and wants some data to return to LC?
Craig
Re: Transferring variables between AppleScript and LiveCode
I think right now it is best to let the original poster explain in more detail what he wants.Is it possible the OP is talking about the form "do as AppleScript", and wants some data to return to LC?
KInd regards
Bernd
Re: Transferring variables between AppleScript and LiveCode
dunbarx wrote: Thu Jun 11, 2026 3:23 pm Is it possible the OP is talking about the form "do as AppleScript", and wants some data to return to LC?
Always possible, and as Bernd says, best to wait for the OP to clarify, but according to the initial post (emphasis mine):
The execution context is Applescript (e., I am not running Applescript from within Livecode).
Re: Transferring variables between AppleScript and LiveCode
Stam.
Right you are.
But assuming LC is running on his machine, and whatever the source of the appleScript, how would any such source pop itself into LC? Where would it land?
Craig
Right you are.
But assuming LC is running on his machine, and whatever the source of the appleScript, how would any such source pop itself into LC? Where would it land?
Craig
-
richmond62
- Livecode Opensource Backer

- Posts: 10416
- Joined: Fri Feb 19, 2010 10:17 am
Re: Transferring variables between AppleScript and LiveCode
That might be a 'clever' bot: considering it is a single post
