Results 1 to 2 of 2
  1. #1


    Member Since
    Jan 30, 2009
    Posts
    48
    Use Applescript to run a terminal command
    I have a Terminal command and associated password to execute the command (a command and a password) I must run dozens of times a day. Bored of doing it hand 1 by 1.

    So, I started writing an Applescript (that I will turn into an Application so I can just click it to execute all in 1 click) that opens terminal, enters the command BUT the command is only executed if I enter the necessary password. but, that is where I am stuck. I can open terminal, have it enter the command, but I am not sure how to then follow-up with the password to execute the command when prompted. Here is what I have and it works perfect

    tell application "Terminal"
    activate
    do script "blahblahblahblahblah" in front window
    end tell


    I have tried these variations, but no luck

    do script "blahblahblahblahblah" password "passwordhere" in front window - as a means of entering script and the password in 1 shot
    do script "passwordhere" in front window - as a means of then entering the password after first script runs

    so, not sure how to get it to follow up the command at the password prompt that comes up and enter the password. Yes, I will keep working on it.. but if you can see the fix, please advise.

  2. #2


    Member Since
    Jan 30, 2009
    Posts
    48
    I was soooo close...

    what I needed was

    delay 1 -- pause for a second

    after the first command and then execute the second password command do script "passwordhere" in front window

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Add applescript to command + v to clear clipboard
    By XsTatiC1975 in forum OS X - Operating System
    Replies: 4
    Last Post: 12-01-2009, 04:45 PM
  2. Terminal vs. Applescript
    By tgaleza in forum OS X - Operating System
    Replies: 2
    Last Post: 09-25-2009, 11:08 AM
  3. Applescript vs Automator vs Unix Command
    By Thyamine in forum OS X - Development and Darwin
    Replies: 3
    Last Post: 02-25-2008, 11:23 PM
  4. Creating an application to run a terminal command on startup?
    By Starky in forum OS X - Apps and Games
    Replies: 7
    Last Post: 11-27-2007, 12:57 AM
  5. How to command+L in applescript?
    By slugzzz in forum Running Windows (or anything else) on your Mac
    Replies: 0
    Last Post: 09-11-2007, 06:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •