Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

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!

iMac, OS X Mavericks (10.9)

Posted on Feb 6, 2014 8:40 AM

Reply
24 replies

Feb 6, 2014 11:41 AM in response to Larry McJunkin

Niel, I appreciate the help, but this still isn't working and I don't want to bother you any further. This time I got the following error:


error "Finder got an error: Connection is invalid." number -609


...and again, the Finder killed everything on my desktop. Only way I could get it back was to run the following original command in Terminal:


/System/Library/Frameworks/CoreServices.framework//Versions/A/\

Frameworks/LaunchServices.framework/Versions/A/Support/lsregister \

-kill -r -domain local -domain user;

killall Finder

Apr 30, 2014 5:39 AM in response to Larry McJunkin

Hi, sorry to bother you, this is a different topic. I am a complete ignorant when it comes to running terminal. Only, i had troubles with pinch zoom a month ago, and after hours found a post here that told me to run a line in terminal (forgive the imprecise vocabulary), and it solved everything. Now, pinch doesnt work again, and after hours looking for that post, i couldn't find it, nor could i find another solution. I looked in my terminal history, and this is what i found

ipconfig /flushdns

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchSe rvices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user

(i can't remember if ipconfig /flushdns is part of what i typed)


the command i ran contained kill -r, and was used to reset the system that manages the pad if i remember correctly. Based on the text, is it possible to find out what the command i ran was, and then run it again?

Thanks a lot!

Using Applescript to execute a Terminal command

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.