Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Nov 18, 2017 8:57 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: How does App get launchd ProgramArguments?
PostPosted: Tue May 21, 2013 5:57 am 
Offline

Joined: Tue May 01, 2007 7:04 am
Posts: 66
Location: Lanark, Ontario
There is a gap in my understanding of how launchd and Xojo (might as well get used to the new name) communicate.

If my launchd plist is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
<dict>
<key>Label</key>
<string>myApp Launcher</string>
<key>ProgramArguments</key>
<array>
<string>~/Applications/myApp</string>
<string>-f</string>
</array>
.....


How do I get my app to receive the "-f" program argument when it is started by launchd?

_________________
Regards,

Tom Baumgartner
RS 2012r2 Pro on Intel Core i5 iMac with Mac OS X 10.8.2


Top
 Profile  
Reply with quote  
 Post subject: Re: How does App get launchd ProgramArguments?
PostPosted: Wed May 22, 2013 6:48 am 
Offline

Joined: Thu Apr 10, 2008 6:03 am
Posts: 303
Location: Paris-La Défense, France
Hello,

The app gets the ProgramArguments using the "System.CommandLine" property.

This is the code I use in one of my programs.
The command() property then has all commands sent to the App.

Dim commands() As String
Dim FoundQuote As Boolean
Dim SplitCommand() As String
SplitCommand = Split((Trim(System.CommandLine).Replace(chr(34) + " " + chr(34), chr(34) + chr(34))), "")
Dim index As Integer
Dim tempStr As String

//List of commands
// -w #### : output width
// -h #### : output height
// -r simple | browser | smart | border : resize type
// -nostop : do not display error messages
// -bfontsize ## : output text size in browser

For each letter as String in SplitCommand
Select case letter
Case " "
If not FoundQuote then
index = index + 1
commands.Append tempStr
tempStr = ""
else
tempStr = tempStr + letter
End If
Case chr(34)
If not FoundQuote then
commands.Append tempStr
tempStr = ""
End If
FoundQuote = not FoundQuote
else
tempStr = tempStr + letter
End Select
Next
commands.Append tempStr

commands.Remove(1)

_________________
Check my Website for high quality custom controls and classes (no plugins) for Windows, Mac OS and Linux
REALBasic 2012 R2 on Win 7 & Mac OS X


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group