New topic: How does App get launchd ProgramArguments?
<http://forums.realsoftware.com/viewtopic.php?t=47933> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message Tom Baumgartner Post subject: How does App get launchd ProgramArguments?Posted: Tue May 21, 2013 5:57 am 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 JeremK Post subject: Re: How does App get launchd ProgramArguments?Posted: Wed May 22, 2013 6:48 am Joined: Thu Apr 10, 2008 6:03 am Posts: 292 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 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 2 posts ]
-- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
