• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Another Applescript noob
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another Applescript noob


  • Subject: Re: Another Applescript noob
  • From: Emmanuel LEVY <email@hidden>
  • Date: Thu, 27 May 2010 16:56:52 +0200

I'm not a specialist but I would print the shell script command that you are passing. Maybe it's better to insert a white space between the loginname and the department?

Emmanuel


I'm missing something in my applescript.

I've got the variables setup and the display dialogs seem to work, but the variables aren't being passed to the script correctly. Here's what I have so far for my applescript


property loginname : ""
display dialog "Enter your loginname without the container:" default answer loginname
set the loginname to text returned of the result
property department : ""
display dialog "Enter your Department:" default answer department
set the department to text returned of the result
do shell script ("echo " & loginname & department & " | /Users/ gvsuadmin/Desktop/adbind.sh") user name "xxxx" password "xxxx" with administrator privileges




On Wednesday, May 26, 2010, at 05:54PM, "Mark J. Reed" <email@hidden > wrote:
> _______________________________________________
>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
>
On Wed, May 26, 2010 at 3:18 PM, Emmanuel LEVY <email@hidden> wrote:
On May 26, 2010, at 9:03 PM, Mark J. Reed wrote:


You can run the script inside Terminal with 'tell application "Terminal" to do script "...."', instead of 'do shell script', and then the script can interact with the user as needed.

Or if the script just expects certain things on its input but doesn't need a terminal, you can prompt for them with 'display dialog' and then use "echo" or <<< as part of the shell command to feed the input to it.

Or you can use display dialog's output in line, like in:

-- tested
do shell script "ls " & (text returned of (display dialog "Enter directory to list:" default answer "/"))


I got the impression the OP was talking about the command reading things from its input stream, so it'd be more like

do shell script "command arguments <<<" & (quoted form of (text returned of (display dialog "Enter data:";)))

If you have to prompt for multiple data items then it's probably easier to do the display dialogs first and gather the results and then build the inputstring out of them.



Emmanuel

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript- email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users


This email sent to email@hidden



--
Mark J. Reed <email@hidden>

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript- email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users


This email sent to email@hidden

_______________________________________________ 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
References: 
 >Re: Another Applescript noob (From: Joy <email@hidden>)

  • Prev by Date: Re: Another Applescript noob
  • Next by Date: Re: Another Applescript noob
  • Previous by thread: Re: Another Applescript noob
  • Next by thread: Re: Another Applescript noob
  • Index(es):
    • Date
    • Thread