Trying to automate a Terminal command with a password

Hi,
I'm a long time Mac user, but not a Terminal expert.
I've come upon a simple hack that enables me to run two instances of Skype simultaneously. This enables me to use it with two different user names.
The idea is to create another user on the computer and run the other Skype like this:
sudo -u user "/Applications/Skype.app/Contents/MacOS/Skype"
In order to simplify this for daily use, I'd like to create a small applet which runs this terminal command.
Trying to do so with Automator's +Run Shell Script+ fails with an execution error, probably due to the fact that this sudo command requires an admin password.
Is there any way to accomplish this?
Thanks

hmm... I'm afraid that didn't do the trick. It now opens the Terminal window and launches Skype with the message "another copy of Skype is already running".
Maybe I should add another step to workflow instead?
Thanks again, I really appreciate your help.
Guy

Similar Messages

  • Creating/running Terminal command with Automator

    I am using Parallels Desktop on my iMac. Occasionally after I shutdown Parallels Desktop/Windows the ram it used is not released back, for example, depending on what I'm running in Parallels Desktop I can use upto around 16GB or ram. Ocassionally when I shutdown Windows and in doing that Parallels Desktop too, this ram level does not go back down. I find that going into Terminal and entering the purge command puts the ram level down to what it was before I loaded up Parallels Desktop.
    I was wondering if its possible to use Automator to create a shortcut that I could then either place on my Desktop or Dock and when needed I could just double click on it and it would then load Terminal and then the purge command?
    Or is there another way that I could automate the purge command?

    I managed to work it out for myself.
    I done the following:
    In Automator I chose Application/Run Shell Script. In the box that appeared in the right side I entered purge. I then saved it to my desired location and I then dragged it onto the Dock for easy access.

  • Terminal commands with automator and Safari

    Hey guys, I'm trying to create an automator that will open safari, enable private browsing, go to my site, and log myself in. The problem is I need a terminal command line that will ensure private browsing is enabled. Any tips / help is appreciated. Thanks

    Terminal and Unix queries are best posted to the Unix forum under OS X Technologies.

  • Terminal commands with automator

    So I am not really used to scripts and the script language nor in automator, I only made a few apps with automator like resize picture and show/hide hidden files.
    Now I am about to make an app which cleans my OS, I would like to run all these commands with one click, rather then copy pasting them into terminal one- by-one.
    sudo rm -rf /private/var/log/*
    sudo rm -rf /private/var/folders/
    cd /private/var/tmp/; rm -rf TM*
    cd ~/Library/Caches/; rm -rf ~/Library/Caches/*
    this would clean my mac caches and logs, like i would run it every week as im a power user.
    Please someone tell me how to put all these into automator and try to be detailed. Thanks for the support!

    Thanks for both positive, useful and sarcastic responses. The main reason is why I want to do this is becasuse I use different browsers, and all the cache they make is 2-3GB/day, as I use the web the most.
    I see the reason why NOT TO clear it and I do understand it, but after a week it is 10-15GB for me.
    And no, there isnt anyone else using my Mac, and the logs which I would nuke at every start and only keep the last and updated logs. I only need the startup and boot log.
    @barney-15E yes it would be fun though
    So then, I wont do anythings, as it cannot be done the way I wanted. I'll keep using Onyx.

  • Fatal error when trying to execute a dml-command with OLAP API

    Hi,
    when I created an OracleConnection using the jdbc thin driver. The connection works fine.
    But when I try to execute any dml-command with an SPLExecutor the following fatal error occurs:
    oracle.express.idl.util.OlapiException: ORA-37118: Message 37118 not found; product=RDBMS; facility=ORA
    ORA-06512: at "SYS.GENCONNECTIONINTERFACE", line 66
    ORA-06512: at line 1
    Any Suggestions ?

    Hi Priya,
    1.The entries for the initialization in the BW system are contained in the RSSDLINIT table for the DataSource/source system combination. Compare these with the entries in the ROOSPRMSC table in the OLTP system.
    2. If there are NO entries in the RSSDLINIT table in BW, use transaction RSA7 to delete the delta queue for this DataSource/BW application combination in the source system (OLTP).
    3.Once you deleted all the entries,In Infopackage scheduler option,delete all the init selections to proceed further.
    In which system u r going to do this.....Quality or production.(Better,you check with basis to delete the entries.)
    Regards
    Kumar

  • Terminal Command with Automator

    ok i want to use the automator to run a script so that i can view my hidden files without going through the terminal
    defaults write com.apple.finder AppleShowAllFiles FALSE
    KILLALL Finder
    these are the command but i cant get automator to run them please help

    Hi,
    What do you mean when you say you can't get Automator to run them? I created a workflow with a Run Shell Script action, put the 2 lines in the body of the action, and it seemed to work just fine.

  • Running Windows XP - uninstalled Firefox 3.X - downloaded Firefox 9 - only one account on computer (administrator - me) - repeatedly tried to sign in as administrator with my password, but the sign-in window just fades out and nothing happens

    Have downloaded the setup file from your site and from another - slight difference in file names - yours ends with (1) at the end - magazine version does not have that. All extraneous programs closed during attempt.

    Have downloaded the setup file from your site and from another - slight difference in file names - yours ends with (1) at the end - magazine version does not have that. All extraneous programs closed during attempt.

  • What does DE want when it asks for Adobe user name and unlock code? I have tried my acct ID, user name with my password but that does not work.

    This is the screen I get when I want to add a book to digital editions.
    All I want to know is what they are asking for. I thought it was my user name and password but all kinds of combos or scr name, acct name, login name and password does not open the book

    Maybe this.
    Fix iPhone Apps Stuck "Waiting" During Installation
    Try update the apps one at a time

  • Using Applescript to execute a Terminal command

    I've looked at the possible answers that come up when I ask this question here, but none really fit my question.
    I want to automate the Terminal command that cleans out obsolete entries in my right-click "Open with" menu, which I have to do often. Rather than copying the command each time I want it, then opening Terminal, pasting it in, etc., is there a way to automate this with Applescript?  Thanks!

    Thanks for the fast reply, Niel. I understand this is a newbie Applescript question, but over the years I have just never used Applescript and other than this one thing, probably won't again.  So rather than take hours to learn it, I hope you don't mind the additional question regarding this.  Do I just put the following into the main Applescript editor?
    do shell script "ls -l ~"
    /System/Library/Frameworks/CoreServices.framework//Versions/A/\
    Frameworks/LaunchServices.framework/Versions/A/Support/lsregister \
    -kill -r -domain local -domain user;
    killall Finder

  • Multiple entries in 'Open Width'using the above terminal command

    /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.fram ework/Support/lsregister -kill -r -domain local -domain system -domain user
    I tried using the above terminal command to reset launch services but it does not seem to work. I still have multiple entries. What am I doing wrong?

    You may have to clarify. Multiple entries in Open With can be normal. For example if you have multiple versions of an application for whatever reason, they will all show. Plus, any applications that report being able to open a file type will show (had an annoyingly long list for text files on my old machine as some apps that didn't even handle documents such as games reported being able to open them).

  • Terminal Commands for Identifying  Apps as 32-Bit, 64-Bit, or Both

    I posted a prior topic on this matter, but cannot find it. I have seen these what I am asking about, but can't locate them. I am trying to identify the terminal commands noted in my subject.
    Message was edited by: donv (The Ghost)
    Message was edited by: donv (The Ghost)

    This is what I was looking for:
    In terminal, type: file /Applications/Safari.app/Contents/MacOS/Safari
    What is returned is below. The second/third line identifies Safari as a universal binary with two architectures. The fourth/fifth line identifies the architectures as 32 bit and 64 bit. I am not sure what the sixth/seventh line does unless it identifies Safari as being compatible with PowerPC.
    xxxx-MacBook-Pro:~ donv1$ file /Applications/Safari.app/Contents/MacOS/Safari
    /Applications/Safari.app/Contents/MacOS/Safari: Mach-O universal binary with 2
    architectures
    /Applications/Safari.app/Contents/MacOS/Safari (for architecture x86_64):
    Mach-O 64-bit executable x86_64
    /Applications/Safari.app/Contents/MacOS/Safari (for architecture i386): Mach-O
    executable i386
    For any wondering. If SL is started in 64-bit kernel mode, then it will run Safari as a 64-bit program. The same will happen if SL is started in 32-bit mode. Leopard also will run Safari as a 64-bit program. Suppose one has a purely 64-bit program. The same things will happen. Note also that some 32-bit programs will run in 64-bit mode, and, at least in some cases, they will run faster in 64-bit mode. On the other hand, some 32-bit programs will not run in 64-bit mode.
    Thus, at this time, the benefits from being able to start in 64-bit mode are minimal. That is, one might be able to run some 32-bit programs slightly faster than in 32-bit mode. On the other hand, this minor benefit would, IMO, be offset by not being able to run certain 32-bit or 64-bit programs simultaneously. I'll be sticking with 32-bit mode.
    If there currently is more to the story than I have told, then please pile on. I am always interested in avoiding misinformation.
    Message was edited by: donv (The Ghost)
    Message was edited by: donv (The Ghost)
    Message was edited by: donv (The Ghost)
    Message was edited by: donv (The Ghost)
    Message was edited by: donv (The Ghost)

  • Using Terminal Commands and Maintenance

    I am trying to use the terminal commands as indicated in this article -
    http://support.apple.com/kb/HT2319?viewlocale=en_US - however, the response I get is "no such directory." While I used to be able to run this maintenance command in Tiger with no problems, I cannot do it with Leopard for some reason. Suggestions?

    this article doesn't apply to leopard. if you want to force periodic tasks from terminal run
    sudo periodic daily
    etc. to run them all at once run
    sudo periodic daily weekly monthly
    However, leopard does a better job than tiger at running them and unless your mac is shut down at night every night it will run the tasks itself.

  • Can't seem to sync my phone with iCal because I get a message that says:No writable calendar. I tried the suggestions I found in Help including a Terminal command to no avail.

    Can't seem to sync my phone with iCal because I get a message that says:No writable calendar. I tried the suggestions I found in Help including a Terminal command to no avail.

    I can only suggest you now need to somehow link your mobile to sync with the new calendar 'On my Mac'.
    I have a work Blackberry whose calendar I sync with an iCal calendar 'On my Mac' using a usb lead and the Blackberry Desktop Manager for Mac. This free piece of software from Blackberry, automatically starts up as soon as I connect the usb to the iMac and it then prompts me to select which calendar 'On the iMac', which is writable, that I want my Blackberry to sync to.

  • Automate terminal command

    I figured out how to run multiple copies of skype by launching the .app file from different osx user accounts in terminal.  What I'm trying to do now is script this or automate opening terminal and typing the line with automator.  The following is the line that I use.
    su user2 -c "/Applications/Skype.app/Contents/MacOS/Skype && exit"
    And I just change user2 to user3 for a third instance of skype and so on.  Can someone show me how ot automate this process?  Thanks.? Thanks.

    i want to keep the password though,  I'm thinking about just using keystroke to have it put the password in each time.  something like:
    This is doable, but is also an incredibly bad idea. You see, for the most part, keystroke is blind - it doesn't care (or know) where it's typing and you'd be blindly typing each user's password with no idea of where it's going. Is it going to Terminal.app? maybe, maybe not. Even if it is there's no guarantee that it's typing in the right window, or that the window is even expecting a password.
    It's also entirely reasonable (probable, even) that you're not in Terminal.app. Nothing in the script activates Terminal.app, so you could be in another application at the time, or the user could have switched applications while the script is running - the script will continue to launch Terminal.app windows and scripts in the background while keystroke happily types the password into whatever frontmost app is around.
    OK, this is over-simplified, because it is possible to target an application to receive the keystrokes, but my aim is to illustrate the point.
    In either case, I wouldn't use keystroke at all. It would be better to use a second do script command - remember, do script does little more than type the text into a terminal window.... the difference is that at least you know you're in Terminal.app. The trick is getting to know where you're typing. The trick here is that do script will return a reference to the window/tab where the command was executed, so you can capture this after your first command (to launch Skype) and use that as the target for subsequent commands/typing in the same window, e.g. (untested):
    set theUsers to {"user2", "user3", "user8", "user11", "user4", "user5", "user6", "user7", "user9"}
    set thePWs to {"aaaa", "bbbb", "cccc", "dddd", "eeee", "ffff", "gggg", "hhhh", "iiii"}
    repeat with i from 1 to count theUsers
              set eachUser to item i of theUsers
              set eachPW to item i of thePWs
              tell application "Terminal"
                        set myWindow to do script "su " & eachUser & " -c /Applications/Skype.app/Contents/MacOS/Skype"
      delay 1 -- optional - allow time for Terminal.app to do its thing
      do script eachPW in myWindow
                        do script "exit" in myWindow
              end tell
    end repeat
    In thie way, do script has the command to launch skype and passes back the window/tab reference. After a short delay the password is typed in that window/tab, followed by the 'exit' to close the window.
    Incidentally, the use of sudo, as suggested above, obviates the need to type each user's password in a shell and avoids this issue altogether.

  • #30 | can i run the Terminal Command to stop Snapshots with no problems?

    i am somewhat surprised to find out that the 75 GB of "Backups" that are taking up space on my MBP may be due to some "feature" in Mavericks or the new OS's or whatever and i have had to MOVE all my data off my laptop as a consequence of this over the last two months because i have no more space on my Hard Drive.
    is it legit and OK to follow the terminal commands in #30 without having any problems?
    i am on a mid 2009 MBP running Mavericks and i have a 2 TB Time Capsule that i am wirelessly backing up my data.
    as some kind of sadistic test in advance of running this terminal command - can i plug my laptop into the Time Capsule, unplug the laptop from the time capsule, restart and see how much space got recaptured on my HD for my data?
    i mean, well - i must be missing something but i mean i am hoping i can get this to stop so i can get my data back on my laptop. i'm walking around with an external HD of all my Mac Pro information just so i can get work done when i go to a coffee shop or something.

    for those suffering through this:
    https://discussions.apple.com/message/24878591#24878591
    In Terminal:
         sudo tmutil disablelocal
    Turn off local Time Machine snapshots and trigger automatic cleanup of accumulated local snapshot data. Requires root privileges.
    (use sudo tmutil enablelocal to turn back on)
    this got rid of my 75 GB backup file (!!) and now i am going to move my data back to my laptop...
    not sure if there is an apple tech article to link to regarding this issue but it would be good to post if there is one.

Maybe you are looking for