Do Shell Script returns empty string but works in Terminal
Do Shell Script returns empty string but works in Terminal
- Subject: Do Shell Script returns empty string but works in Terminal
- From: Bob Stern <email@hidden>
- Date: Wed, 02 Aug 2017 19:47:25 -0700
I am trying to script a client/server application that has a command line
interface but no AppleScript dictionary. (In the examples below, the client
and server are on my local Mac, so I use localhost as the IP address of the
server.)
The commands shown below return the expected text result in Terminal. However,
a “do shell script” AppleScript returns only an empty string.
When I use ‘tell app “Terminal” to do script’, the command returns a reference
to the Terminal window instead of the desired text.
The “do shell script” AppleScript does cause the client/server application to
perform the specified command except that it fails to return a result.
Examples:
Terminal command:
/Applications/HQPlayerDesktop.app/Contents/MacOS/hqp-control localhost --state
Result displayed in Terminal:
state: 0 0:(9, 3, 0) -22.000000 0:0
Terminal command:
/Applications/HQPlayerDesktop.app/Contents/MacOS/hqp-control localhost
--get-info
Result displayed in Terminal:
HQPlayer Desktop/3.16.4/Mac
In AppleScript, the application performs the “volume-up" command, but returns
only an empty string from the “get-info” command:
do shell script “/Applications/HQPlayerDesktop.app/Contents/MacOS/hqp-control
localhost --volume-up”
do shell script “/Applications/HQPlayerDesktop.app/Contents/MacOS/hqp-control
localhost --get-info”
Result: empty string
tell app “Terminal” to do script
“/Applications/HQPlayerDesktop.app/Contents/MacOS/hqp-control localhost
--get-info”
Result: tab 1 of window id 2813
Any troubleshooting suggestions? Thanks!
Bob Stern
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden