Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
quick mini command line
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Michael Gmail  
View profile  
 More options Mar 6 2005, 5:06 pm
From: Michael Gmail <mgr...@gmail.com>
Date: Sun, 6 Mar 2005 16:06:13 -0600
Local: Sun, Mar 6 2005 5:06 pm
Subject: quick mini command line
Most of you folks on this list are probably way too geeky to find this
interesting, but I occasionally run across comments in blogs or on
mailing lists to the effect that this or that command line tool would
be handy to have in the GUI environment, so maybe it'll be useful for
some. Personally I rarely run Terminal, but from time to time I want to
dash off a quick one-line shell command. To do so I trigger the
following AppleScript from a keyboard command defined in iKey (lots of
similar utilities should work just as well):

set frontApp to the name of (info for (path to frontmost application))
tell application frontApp to set userResponse to (display dialog "Enter
shell command:" default answer "" buttons {"Cancel", "sudo", "OK"}
default button "OK")
set userCommand to text returned of userResponse
if button returned of userResponse is "sudo" then
        do shell script ("sudo " & userCommand) with administrator privileges
        set commandResult to the result as string
else
        do shell script userCommand
        set commandResult to the result as string
end if
if commandResult is not "" then
        tell application frontApp
                display dialog commandResult buttons {"Copy", "OK"} default button
"OK"
                if button returned of the result is "Copy" then set the clipboard to
commandResult
        end tell
end if

The script pops up a dialog box with a text field where you can enter
your command. Hitting Return or clicking OK runs the command directly;
clicking the sudo button prepends sudo to your command and asks for
your password. If your command returns text, it is displayed in another
dialog and you have the option of copying it to your clipboard.

Don't use it to run a command that stays open, such as top.

I hope someone finds it useful.

Michael

--
<http://globalocal.blogspot.com/>

"Open the pod bay doors, Hal."
"I'm sorry, Dave. I'm afraid I can't do that."


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Scott Lawrence  
View profile  
 More options Mar 6 2005, 6:27 pm
From: Scott Lawrence <yor...@gmail.com>
Date: Sun, 6 Mar 2005 18:27:06 -0500
Local: Sun, Mar 6 2005 6:27 pm
Subject: Re: [43F Group] quick mini command line
Similarly, if you're on X11/X Windows, the AmiWM window manager has an
'execute command' menu item that does something similar. :)

(I've recently been doing a bunch of upgrades/hacks to AmiWM, so i've
been submersed in it recently..)

-s

( http://www.cis.rit.edu/~jerry/Software/amiwm/ )


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google