Re: Simple apple script - Beginner Problem
Re: Simple apple script - Beginner Problem
- Subject: Re: Simple apple script - Beginner Problem
- From: Philip Aker <email@hidden>
- Date: Tue, 14 Jul 2009 04:40:29 -0700
On 2009-07-14, at 03:15:37, James Bensley wrote:
set UNC to (do shell script "dscl localhost read /Active Directory/All Domains/Users/" & user_name & " homeDirectory | awk 'BEGIN{FS=\":\"};{print $3}'") display dialog UNC
Pretty simple really. There are two things to note here; The spaces in "Active Directory/All Domains" did have an escaping \ in them when I wrote the line in a shell script but the apple script editor doesn't like them?
You would normally use AppleScript's 'quoted form of' to quote a command (or portion thereof) for 'do shell script' or simply use a unix hard quote (apostrophe) for the portions of the command line where spaces need to be preserved. Something like:
set user_name to "bob" set cmnd to quoted form of "dscl localhost read /Active Directory/All Domains/Users/" & user_name & " homeDirectory" set unc to (do shell script cmnd)
I don't have an Active Directory thingme to test with but I think you'll be able to figure out the form given the info aboveā¦
HTH,
Philip Aker echo email@hidden@nl | tr a-z@. p-za-o.@ Democracy: Two wolves and a sheep voting on lunch.
|
_______________________________________________
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