Re: Convert Terminal commands to Apple Script
Re: Convert Terminal commands to Apple Script
- Subject: Re: Convert Terminal commands to Apple Script
- From: Roger Howard <email@hidden>
- Date: Tue, 7 Dec 2010 15:37:44 -0800
On Dec 7, 2010, at 3:19 PM, Doug McNutt wrote:
> At 11:14 -0800 12/7/10, Roger Howard wrote:
> do shell script "Applications/hp/ca/agent/Radskman \"CAT=PROMPT,ULOGON=N,CONTEXT=M,HREBOOT=Y,ASK=Y,MNAME=RADIA,DNAME=SOFTWARE,IP=RRWIN-CAET01,UID='&(ZCONFIG.DNSHOSTN)',STARTDIR=SYSTEM,LOG=CONNECT_MACHINE.LOG,LOGSIZE=2048000,COP=Y,MNT=Y"
>
> At 13:00 -0600 12/7/10, Jeffrey Madson wrote:
> I want to create an AppleScript that will issue a Terminal command to a specific folder in the Applications folder. I can do it in Terminal by doing a: cd Applications/hp/ca/agent and then by inserting this command and hitting return: ./Radskman "CAT=PROMPT,ULOGON=N,CONTEXT=M,HREBOOT=Y,ASK=Y,MNAME=RADIA,DNAME=SOFTWARE,IP=RRWIN-CAET01,UID='&(ZCONFIG.DNSHOSTN)',STARTDIR=SYSTEM,LOG=CONNECT_MACHINE.LOG,LOGSIZE=2048000,COP=Y,MNT=Y"
>
>
> That first cd may be the problem. Each "do shell script" command invokes a new shell. Your change of directory will be ignored.
>
> You can script Terminal.app by telling it to cd in a named window after which you can execute ./Radskman.
>
> You might also be able to combine the cd and the call to ./Radskman on the same line with a semicolon syntax.
>
> You can also create a file with the commands in it. Make it executable and just pass the name of the file to do shell script.
Note, I didn't use cd in my example - if the application can be called directly, and doesn't depend on the current working directory, then my example will work fine. Except I made a typo and missed the first forward slash... should have read:
do shell script "/Applications/hp/ca/agent/Radskman \"CAT=PROMPT,ULOGON=N,CONTEXT=M,HREBOOT=Y,ASK=Y,MNAME=RADIA,DNAME=SOFTWARE,IP=RRWIN-CAET01,UID='&(ZCONFIG.DNSHOSTN)',STARTDIR=SYSTEM,LOG=CONNECT_MACHINE.LOG,LOGSIZE=2048000,COP=Y,MNT=Y"
As you mention, the poster could also include the cd in the command... like so:
do shell script "cd /Applications/hp/ca/agent/; ./Radskman \"CAT=PROMPT,ULOGON=N,CONTEXT=M,HREBOOT=Y,ASK=Y,MNAME=RADIA,DNAME=SOFTWARE,IP=RRWIN-CAET01,UID='&(ZCONFIG.DNSHOSTN)',STARTDIR=SYSTEM,LOG=CONNECT_MACHINE.LOG,LOGSIZE=2048000,COP=Y,MNT=Y" _______________________________________________
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