Re: What is Macintosh equivalent of relaunch handler?

2019-03-30 Thread hh via use-livecode
To summarize some of the previous advices and to
show beginners how easy it is to use applescript:

-- begin commandline
osascript -e 'tell application "LiveCode"
activate
do script "put the internet date"
end tell'

--end commandline (include the last char which is cr)

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: What is Macintosh equivalent of relaunch handler?

2019-03-29 Thread Neville Smythe via use-livecode
Bill:

I agree sockets is the way go for communication between apps. AppleScript is 
great but can be frustrating until you get the hang of it.

The recipe for setting up socket communication is briefly:

. write a small unix shell script which your LC app installs [one caveat: the 
client must allow your app to install an executable script into /usr/local/bin]
this app simply collects the input parameters, opens a socket with 
“nc   ” 
and send the the params to the socket

The 3rd part app calls this script with a shell command “/usr/local/bin 
myScript param1 param2 “ etc [multi world parameters in quotes to form a single 
string]

. on the LC side, your app on launch (or whenever) opens a socket with
“accept connections on port  with message “clientConnected”

Then whenever the shell script is called, your “clientConnected” handler will 
be invoked. 

You read the message sent with"read from socket …” and parse the message sent 
and process it.
You can also write back to the shell with "write to socket…” if you want, for 
the 3rd party to use a reply directly (or of course send data via item files)

Works great! I actually use it to send a filename as first parameter, where the 
file is an LC script, and the processing is simply ”do script ”, 
having put any extra parameters into local variables. This way I can open up 
the whole of the LC app to remote control. You can provide the client with 
prepared script files for particular jobs, without have to rewrite your LC app 
when you want to open up access to a feature. Do script could open up a 
security risk, but you could only accept encrypted files if this is a worry.

As opposed to using AppleScript, this approach will also work if the client 
runs your LC app on a Linux box.

Question for the forum: how to make this work on a Windows box — is there an nc 
equivalent in a command shell for Windows? (I am not a Windows user but some of 
my clients are) 



Neville Smythe



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: What is Macintosh equivalent of relaunch handler?

2019-03-29 Thread Mark Waddingham via use-livecode

On 2019-03-29 19:57, Bill Vlahos via use-livecode wrote:

The existing application can do 2 things.
It can send command line parameters
It can send a formatted URL

I can either catch the command line parameters - which is what I’ve
been asking for or write the application to be a server responding to
a URL sent to localhost.

The latter seems overly complicated and could introduce latency which
I don’t want.


What you want requires some sort of IPC (inter process communication) 
and local sockets are highly efficient on UNIX based OSes (being part of 
the kernel) so I wouldn't worry about latency (not unless you manage to 
find it being an issue!).


You can do what you want with AppleScript (see the 'osascript' command 
line tool - or have your app's on startup handler check for arguments 
which mean send to main app, use do as applescript then exit) - and have 
your app respond to apple events with an 'on appleEvent' handler. 
(AppleEvents probably use sockets underneath...)


Or, indeed, you could try using the httpd library which is one of the 
script libraries introduced in 9.0 (IIRC). See httpdStart in the 
dictionary - its *really* easy to use :)


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: What is Macintosh equivalent of relaunch handler?

2019-03-29 Thread Bill Vlahos via use-livecode
The existing application can do 2 things.
It can send command line parameters
It can send a formatted URL

I can either catch the command line parameters - which is what I’ve been asking 
for or write the application to be a server responding to a URL sent to 
localhost.

The latter seems overly complicated and could introduce latency which I don’t 
want.

Thanks,
Bill

> On Mar 29, 2019, at 10:50 AM, Phil Davis via use-livecode 
>  wrote:
> 
> Hi Bill,
> 
> It sounds like this is your scenario:
> You have an app with UI that is running, and you want it to occasionally 
> send/receive info to/from another invisible 'helper' app. Is that correct?
> 
> If so, can you use sockets in your environment? That would be a simple way to 
> get the interaction you want between the 2 apps.
> 
> Or maybe I misunderstand your scenario.
> 
> Best -
> Phil

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: What is Macintosh equivalent of relaunch handler?

2019-03-29 Thread Phil Davis via use-livecode
Or another approach might be to open the invisible app as a process in 
the UI app.


On 3/29/19 10:50 AM, Phil Davis via use-livecode wrote:

Hi Bill,

It sounds like this is your scenario:
You have an app with UI that is running, and you want it to 
occasionally send/receive info to/from another invisible 'helper' app. 
Is that correct?


If so, can you use sockets in your environment? That would be a simple 
way to get the interaction you want between the 2 apps.


Or maybe I misunderstand your scenario.

Best -
Phil


On 3/29/19 10:41 AM, Bill Vlahos via use-livecode wrote:
Doing this on startup works perfectly but I don’t see how my app can 
get notification any other way while it is running.


I’ve tried openCard, preOpenCard, openStack, preOpenStack, and 
resumeStack but no luck.


Bill



On Mar 29, 2019, at 12:14 AM, Richard Gaskin via use-livecode 
 wrote:


To get the args, just know that any word is an arg, and a quoted 
string counts as one word, so this:


on startup
   put $1 & $2 & $3
end startup

...when call from:

  ./myapp ThisIsArg1 "And this is a multi-word arg" "this,is,delimited"

...would give you:

   ThisIsArg1
   "And this is a multi-word arg"
   "this,is,delimited"

 From there you can parse to your heart's delight.

That is, once we figure out how your app will get notification...


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-livecode




--
Phil Davis


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: What is Macintosh equivalent of relaunch handler?

2019-03-29 Thread Phil Davis via use-livecode

Hi Bill,

It sounds like this is your scenario:
You have an app with UI that is running, and you want it to occasionally 
send/receive info to/from another invisible 'helper' app. Is that correct?


If so, can you use sockets in your environment? That would be a simple 
way to get the interaction you want between the 2 apps.


Or maybe I misunderstand your scenario.

Best -
Phil


On 3/29/19 10:41 AM, Bill Vlahos via use-livecode wrote:

Doing this on startup works perfectly but I don’t see how my app can get 
notification any other way while it is running.

I’ve tried openCard, preOpenCard, openStack, preOpenStack, and resumeStack but 
no luck.

Bill




On Mar 29, 2019, at 12:14 AM, Richard Gaskin via use-livecode 
 wrote:

To get the args, just know that any word is an arg, and a quoted string counts 
as one word, so this:

on startup
   put $1 & $2 & $3
end startup

...when call from:

  ./myapp ThisIsArg1 "And this is a multi-word arg" "this,is,delimited"

...would give you:

   ThisIsArg1
   "And this is a multi-word arg"
   "this,is,delimited"

 From there you can parse to your heart's delight.

That is, once we figure out how your app will get notification...


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


--
Phil Davis


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: What is Macintosh equivalent of relaunch handler?

2019-03-29 Thread Bill Vlahos via use-livecode
Doing this on startup works perfectly but I don’t see how my app can get 
notification any other way while it is running.

I’ve tried openCard, preOpenCard, openStack, preOpenStack, and resumeStack but 
no luck.

Bill



> On Mar 29, 2019, at 12:14 AM, Richard Gaskin via use-livecode 
>  wrote:
> 
> To get the args, just know that any word is an arg, and a quoted string 
> counts as one word, so this:
> 
> on startup
>   put $1 & $2 & $3
> end startup
> 
> ...when call from:
> 
>  ./myapp ThisIsArg1 "And this is a multi-word arg" "this,is,delimited"
> 
> ...would give you:
> 
>   ThisIsArg1
>   "And this is a multi-word arg"
>   "this,is,delimited"
> 
> From there you can parse to your heart's delight.
> 
> That is, once we figure out how your app will get notification...


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: What is Macintosh equivalent of relaunch handler?

2019-03-29 Thread Richard Gaskin via use-livecode

Bill, I wonder if the reopen Apple event will do what you need:

https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_handle_AEs/SAppsHandleAEs.html#//apple_ref/doc/uid/20001239-BBCBCIJE

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: What is Macintosh equivalent of relaunch handler?

2019-03-29 Thread Richard Gaskin via use-livecode

Bill Vlahos wrote:

>> On Mar 28, 2019, at 2:54 PM, Richard Gaskin wrote:
>>
>> Bill Vlahos wrote:
>> > I want my application to be able to catch parameters sent to it via
>> > the command line.
>>
>> Ah, much simpler problem.
>>
>> macOS is a certified Unix.  It works just like Linux.
>>
>> On startup, you can check $# for the number of args passed in the
>> command line, or $1, $2, etc. to get the value of any one of them.
>>
>> If you need really sophisticated command-line argument handling, 
check out the getOpt function Peter Brett added for that:

>>
>> https://livecode.fandom.com/wiki/Getopt
>>
>
> GetOpt looks exactly like what I want.

But it's just a function. First we have to figure out which message 
you'll use to call it from.



> The docs specify on startup is only sent when the application is
> opened. This won’t work for me as I want to catch command line
> parameters ongoing while my application stays open.

True, but you're running from command line, yes?  That's usually used 
for faceless apps, with appleEvents used for GUIs.


But I understand: the app you want to call your LC-made app doesn't send 
AE, but can make command line calls - is that correct?


That's an interesting case I've never explored. I wonder if your app 
still gets 'odoc' events, or some other event, when receiving arguments 
to a running Mac app from the command line.  Maybe worth trying.



> What would the syntax be if I want to catch 3 items some of which
> could contain multiple words with a space between them?

If you post a few examples we can come up with parsers, but you know 
your way around chunk expressions so you could probably do that part 
better than most on your own.


To get the args, just know that any word is an arg, and a quoted string 
counts as one word, so this:


on startup
   put $1 & $2 & $3
end startup

...when call from:

  ./myapp ThisIsArg1 "And this is a multi-word arg" "this,is,delimited"

...would give you:

   ThisIsArg1
   "And this is a multi-word arg"
   "this,is,delimited"

From there you can parse to your heart's delight.

That is, once we figure out how your app will get notification...

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: What is Macintosh equivalent of relaunch handler?

2019-03-28 Thread Bill Vlahos via use-livecode
Richard,

GetOpt looks exactly like what I want.

The docs specify on startup is only sent when the application is opened. This 
won’t work for me as I want to catch command line parameters ongoing while my 
application stays open.

What would the syntax be if I want to catch 3 items some of which could contain 
multiple words with a space between them?

Thank you,
Bill



> On Mar 28, 2019, at 2:54 PM, Richard Gaskin via use-livecode 
>  wrote:
> 
> Bill Vlahos wrote:
> 
> > I want my application to be able to catch parameters sent to it via
> > the command line.
> 
> Ah, much simpler problem.
> 
> macOS is a certified Unix.  It works just like Linux.
> 
> On startup, you can check $# for the number of args passed in the command 
> line, or $1, $2, etc. to get the value of any one of them.
> 
> If you need really sophisticated command-line argument handling, check out 
> the getOpt function Peter Brett added for that:
> 
> https://livecode.fandom.com/wiki/Getopt 
> 
> 
> -- 
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> 
> ambassa...@fourthworld.com 
> http://www.FourthWorld.com 

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: What is Macintosh equivalent of relaunch handler?

2019-03-28 Thread Richard Gaskin via use-livecode

Bill Vlahos wrote:

> I want my application to be able to catch parameters sent to it via
> the command line.

Ah, much simpler problem.

macOS is a certified Unix.  It works just like Linux.

On startup, you can check $# for the number of args passed in the 
command line, or $1, $2, etc. to get the value of any one of them.


If you need really sophisticated command-line argument handling, check 
out the getOpt function Peter Brett added for that:


https://livecode.fandom.com/wiki/Getopt

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: What is Macintosh equivalent of relaunch handler?

2019-03-28 Thread Martin Koob via use-livecode
Here is probably a better link to the Apple Documentation for the LiveCode
documentation.  

https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_handle_AEs/SAppsHandleAEs.html#//apple_ref/doc/uid/20001239-1117769


It has a higher level explanation events and talks about standard events
that all applications received:
open application (or launch)
reopen
open (or open documents)
print (or print documents)
open contents
quit (or quit application)

Martin





Martin Koob via use-livecode wrote
> Sorry there was a typo in the second link.  It should be:
> 
> https://developer.apple.com/documentation/coreservices/appleevent
> 
> It picked up a period at the end.
> 
> Martin Koob
> 
> 
> Martin Koob via use-livecode wrote
>> I checked the LiveCode dictionary in my hot off the press PDF version to
>> see
>> if there was more info on what data request AppleEvent data could give.  
>> I
>> found a reference to
>> 
>> For more information about Apple events, see Apple Computer's technical
>> documentation, Inside Macintosh: Interapplication Communication, located
>> at
>> http://developer.apple.com/documentation/mac/IAC/IAC-2.html.
>> 
>> Once I saw 'Inside Macintosh' I suspected this is a dead link.  I found
>> that
>> is already noted in bugzilla -
>> https://quality.livecode.com/show_bug.cgi?id=20022
>> 
>> I did a quick search on and found this in Apple's documentation 
>> https://developer.apple.com/documentation/coreservices/appleevent. 
>> Should
>> this be the link for that dictionary entry?
>> 
>> 
>> Martin Koob
>> 
>> 
>> Bob Sneidar via use-livecode wrote
>>> Hi Bill,
>>> 
 I want my application to be able to catch parameters sent to it via
 the command line.
 
 The relaunch handler does that for Windows applications and also
 doesn’t open another instance of the application. You are correct that
 Mac apps run in a single instance by default and that is the behavior
 I want.
 
 I don’t want to open a document…I want to do something with the
 command line parameters sent to my app.
>>> 
>>> The simple answer is that there isn't an equivalent.
>>> 
>>> The relaunch mechanism on Windows was added to make it easy to add 
>>> single-instance like behavior on Windows (just as macOS has).
>>> 
>>> However remember that macOS has the AppleEvent system for making it easy 
>>> to do inter-process communication, so on Mac you could use that.
>>> 
>>> i.e. Make the command-line tool use AppleScript (either by do ... as 
>>> applescript) or the 'send to program' syntax to send apple events to 
>>> instruct the main app.
>>> 
>>> Warmest Regards,
>>> 
>>> Mark.
>>> 
>>> -- 
>>> Mark Waddingham ~ 
>> 
>>> mark@
>> 
>>>  ~ http://www.livecode.com/
>>> LiveCode: Everyone can create apps
>>> 
>>> ___
>>> use-livecode mailing list
>> 
>>> use-livecode@.runrev
>> 
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> 
>> 
>> 
>> --
>> Sent from:
>> http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html
>> 
>> ___
>> use-livecode mailing list
> 
>> use-livecode@.runrev
> 
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> 
> 
> 
> --
> Sent from:
> http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html
> 
> ___
> use-livecode mailing list

> use-livecode@.runrev

> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





--
Sent from: 
http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: What is Macintosh equivalent of relaunch handler?

2019-03-28 Thread Martin Koob via use-livecode
Sorry there was a typo in the second link.  It should be:

https://developer.apple.com/documentation/coreservices/appleevent

It picked up a period at the end.

Martin Koob


Martin Koob via use-livecode wrote
> I checked the LiveCode dictionary in my hot off the press PDF version to
> see
> if there was more info on what data request AppleEvent data could give.  
> I
> found a reference to
> 
> For more information about Apple events, see Apple Computer's technical
> documentation, Inside Macintosh: Interapplication Communication, located
> at
> http://developer.apple.com/documentation/mac/IAC/IAC-2.html.
> 
> Once I saw 'Inside Macintosh' I suspected this is a dead link.  I found
> that
> is already noted in bugzilla -
> https://quality.livecode.com/show_bug.cgi?id=20022
> 
> I did a quick search on and found this in Apple's documentation 
> https://developer.apple.com/documentation/coreservices/appleevent.  Should
> this be the link for that dictionary entry?
> 
> 
> Martin Koob
> 
> 
> Bob Sneidar via use-livecode wrote
>> Hi Bill,
>> 
>>> I want my application to be able to catch parameters sent to it via
>>> the command line.
>>> 
>>> The relaunch handler does that for Windows applications and also
>>> doesn’t open another instance of the application. You are correct that
>>> Mac apps run in a single instance by default and that is the behavior
>>> I want.
>>> 
>>> I don’t want to open a document…I want to do something with the
>>> command line parameters sent to my app.
>> 
>> The simple answer is that there isn't an equivalent.
>> 
>> The relaunch mechanism on Windows was added to make it easy to add 
>> single-instance like behavior on Windows (just as macOS has).
>> 
>> However remember that macOS has the AppleEvent system for making it easy 
>> to do inter-process communication, so on Mac you could use that.
>> 
>> i.e. Make the command-line tool use AppleScript (either by do ... as 
>> applescript) or the 'send to program' syntax to send apple events to 
>> instruct the main app.
>> 
>> Warmest Regards,
>> 
>> Mark.
>> 
>> -- 
>> Mark Waddingham ~ 
> 
>> mark@
> 
>>  ~ http://www.livecode.com/
>> LiveCode: Everyone can create apps
>> 
>> ___
>> use-livecode mailing list
> 
>> use-livecode@.runrev
> 
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> 
> 
> 
> --
> Sent from:
> http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html
> 
> ___
> use-livecode mailing list

> use-livecode@.runrev

> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





--
Sent from: 
http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: What is Macintosh equivalent of relaunch handler?

2019-03-28 Thread Martin Koob via use-livecode
I checked the LiveCode dictionary in my hot off the press PDF version to see
if there was more info on what data request AppleEvent data could give.   I
found a reference to

For more information about Apple events, see Apple Computer's technical
documentation, Inside Macintosh: Interapplication Communication, located at
http://developer.apple.com/documentation/mac/IAC/IAC-2.html.

Once I saw 'Inside Macintosh' I suspected this is a dead link.  I found that
is already noted in bugzilla -
https://quality.livecode.com/show_bug.cgi?id=20022

I did a quick search on and found this in Apple's documentation 
https://developer.apple.com/documentation/coreservices/appleevent.  Should
this be the link for that dictionary entry?


Martin Koob


Bob Sneidar via use-livecode wrote
> Hi Bill,
> 
>> I want my application to be able to catch parameters sent to it via
>> the command line.
>> 
>> The relaunch handler does that for Windows applications and also
>> doesn’t open another instance of the application. You are correct that
>> Mac apps run in a single instance by default and that is the behavior
>> I want.
>> 
>> I don’t want to open a document…I want to do something with the
>> command line parameters sent to my app.
> 
> The simple answer is that there isn't an equivalent.
> 
> The relaunch mechanism on Windows was added to make it easy to add 
> single-instance like behavior on Windows (just as macOS has).
> 
> However remember that macOS has the AppleEvent system for making it easy 
> to do inter-process communication, so on Mac you could use that.
> 
> i.e. Make the command-line tool use AppleScript (either by do ... as 
> applescript) or the 'send to program' syntax to send apple events to 
> instruct the main app.
> 
> Warmest Regards,
> 
> Mark.
> 
> -- 
> Mark Waddingham ~ 

> mark@

>  ~ http://www.livecode.com/
> LiveCode: Everyone can create apps
> 
> ___
> use-livecode mailing list

> use-livecode@.runrev

> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





--
Sent from: 
http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: What is Macintosh equivalent of relaunch handler?

2019-03-28 Thread Bill Vlahos via use-livecode
Mark,

That is unfortunate. The 3rd party middleware tool I’m using to send command 
line parameters doesn’t support AppleEvents. It only supports sending command 
line parameters.

Please consider adding a feature that will let me catch the command line 
parameters for Mac apps like relaunch does for Windows.

I noticed the following command line reference in the 9.0.4 rc 1 release notes. 
Isn’t this the kind of thing I’m asking for? If so, how does it work?
> It is also possible to deactivate LiveCode with:
> deactivate
> LiveCode 9.0.4-rc-1 Release Notes 3/28/19
> Since LiveCode is actually a GUI application, it needs to be run slightly 
> differently from other command-line programs.
> On Windows, the command is:
> start /wait  activate -file LICENSE -passphrase SECRET start /wait 
>  deactivate
> On Mac OS X, you need to do:
> /Contents/MacOS/LiveCode activate -file LICENSE -passphrase SECRET 
> /Contents/MacOS/LiveCode deactivate


Thank you,
Bill Vlahos

> On Mar 28, 2019, at 8:34 AM, Mark Waddingham via use-livecode 
>  wrote:
> 
> Hi Bill,
> 
>> I want my application to be able to catch parameters sent to it via
>> the command line.
>> The relaunch handler does that for Windows applications and also
>> doesn’t open another instance of the application. You are correct that
>> Mac apps run in a single instance by default and that is the behavior
>> I want.
>> I don’t want to open a document…I want to do something with the
>> command line parameters sent to my app.
> 
> The simple answer is that there isn't an equivalent.
> 
> The relaunch mechanism on Windows was added to make it easy to add 
> single-instance like behavior on Windows (just as macOS has).
> 
> However remember that macOS has the AppleEvent system for making it easy to 
> do inter-process communication, so on Mac you could use that.
> 
> i.e. Make the command-line tool use AppleScript (either by do ... as 
> applescript) or the 'send to program' syntax to send apple events to instruct 
> the main app.
> 
> Warmest Regards,
> 
> Mark.
> 
> -- 
> Mark Waddingham ~ m...@livecode.com  ~ 
> http://www.livecode.com/ 
> LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: What is Macintosh equivalent of relaunch handler?

2019-03-28 Thread Mark Waddingham via use-livecode

Hi Bill,


I want my application to be able to catch parameters sent to it via
the command line.

The relaunch handler does that for Windows applications and also
doesn’t open another instance of the application. You are correct that
Mac apps run in a single instance by default and that is the behavior
I want.

I don’t want to open a document…I want to do something with the
command line parameters sent to my app.


The simple answer is that there isn't an equivalent.

The relaunch mechanism on Windows was added to make it easy to add 
single-instance like behavior on Windows (just as macOS has).


However remember that macOS has the AppleEvent system for making it easy 
to do inter-process communication, so on Mac you could use that.


i.e. Make the command-line tool use AppleScript (either by do ... as 
applescript) or the 'send to program' syntax to send apple events to 
instruct the main app.


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: What is Macintosh equivalent of relaunch handler?

2019-03-28 Thread Bill Vlahos via use-livecode
Sorry if I wasn’t clear.

I want my application to be able to catch parameters sent to it via the command 
line.

The relaunch handler does that for Windows applications and also doesn’t open 
another instance of the application. You are correct that Mac apps run in a 
single instance by default and that is the behavior I want.

I don’t want to open a document…I want to do something with the command line 
parameters sent to my app.

Bill

> On Mar 27, 2019, at 8:01 PM, Richard Gaskin via use-livecode 
>  wrote:
> 
> Bill Vlahos wrote:
> 
> > I want to receive command line parameters in my application.
> >
> > The relaunch pCommandLineArguments works perfectly in Windows apps.
> >
> > What is the equivalent handler for MacOS X apps?
> 
> There's no direct equivalent because Mac apps run in a single instance by 
> default.
> 
> If you want to open a document use this:
> 
> on appleEvent theClass,theID
>   if theClass is "aevt" and theID is "odoc" then
>  request appleEvent data
>  put it into theFiles
>  if theFiles is not "not found" and theFiles is not empty then
> ## code to open theFiles
>  end if
>   else
>  pass appleEvent
>   end if
> end appleEvent
> 
> 
> If you want to emulate the Windows experience by having an app run in a 
> separate process each time it's opened, there's a command line option for 
> that (I can't recall what it is, but last time I looked it up it did take 
> long).
> 
> -- 
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> 
> ambassa...@fourthworld.comhttp://www.FourthWorld.com
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: What is Macintosh equivalent of relaunch handler?

2019-03-27 Thread Richard Gaskin via use-livecode

Bill Vlahos wrote:

> I want to receive command line parameters in my application.
>
> The relaunch pCommandLineArguments works perfectly in Windows apps.
>
> What is the equivalent handler for MacOS X apps?

There's no direct equivalent because Mac apps run in a single instance 
by default.


If you want to open a document use this:

on appleEvent theClass,theID
   if theClass is "aevt" and theID is "odoc" then
  request appleEvent data
  put it into theFiles
  if theFiles is not "not found" and theFiles is not empty then
 ## code to open theFiles
  end if
   else
  pass appleEvent
   end if
end appleEvent


If you want to emulate the Windows experience by having an app run in a 
separate process each time it's opened, there's a command line option 
for that (I can't recall what it is, but last time I looked it up it did 
take long).


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


What is Macintosh equivalent of relaunch handler?

2019-03-27 Thread Bill Vlahos via use-livecode
I want to receive command line parameters in my application.

The relaunch pCommandLineArguments works perfectly in Windows apps.

What is the equivalent handler for MacOS X apps?

Thanks,
Bill Vlahos
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode