|
|
#1 |
|
Hall of Famer
Join Date: Jan 2002
Posts: 3,541
|
Script Menu and shell scripts
In Panther, I used a simple little shell script that removed styling from text on my clipboard:
#!/bin/sh pbpaste | pbcopy I stuck it in Script Menu, and it was teh awesome. Moving to Tiger, it's stopped working. I recreated the script, no change. AppleScripts work just fine. Anyone else seeing things like this? Addendum: -rwxr--r-- 1 mikey admin 26 May 2 11:37 Clipboard Rinser Looks good here. |
|
|
|
|
|
#2 | |||||||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
|
By "stopped working" I assume you mean that, while the script does run, it no longer results in the styling being removed from text on the clipboard. It seems to me that you were relying on buggy behaviour in earlier versions. I would have thought that 'pbpaste | pbcopy' would have zero net effect on the clipboard. |
|||||||||||||||||||||||
|
|
|
|
|
#3 |
|
Hall of Famer
Join Date: Jan 2002
Posts: 3,541
|
It works as a straight-up shell command, actually. It strips the styling right off.
Running from ScriptMenu, styling doesn't vanish. Weeeeird. |
|
|
|
|
|
#4 | |||||||||||||||||||||||
|
Hall of Famer
Join Date: Apr 2002
Posts: 3,315
|
I'm not sure if by "buggy behavior" you're referring his script specifically, or running shell scripts from the Script Menu in general. But Mikey-San's post is right on. Executable bash scripts used to run blind (no visible 'shell') from the Script Menu... and now they don't. As a simple example, here's one (yet unfinished) I ran easily on Panther to clear out recent items: Code:
#!/bin/sh echo 'defaults write -g AppleRecentFolders -array' defaults write -g AppleRecentFolders -array echo 'defaults write -g NSNavRecentPlaces -array' defaults write -g NSNavRecentPlaces -array cd ~/Library/Recent\ Folders/ echo 'rm -f ~/Library/Recent\ Folders/*' rm -f ~/Library/Recent\ Folders/* exit 0 Now under Tiger, it simply won't run from the GUI (Script Menu). If I fire up Terminal and ./ it from where it is... presto, it runs. Apple must have killed it. Question is: How can we get it back??? -HI- Last edited by Hal Itosis; 05-02-2005 at 07:01 PM. |
|||||||||||||||||||||||
|
|
|
|
|
#5 | ||||||||||||||||||||||||||||||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
|
As I said:
That was why I referred to buggy behaviour. I'm not using the Script menu so you'll have to explain more fully what you are seeing. |
||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
#6 |
|
MVP
Join Date: Apr 2004
Location: Hello London Calling
Posts: 1,787
|
Your right, thats a pain.
I can get mine to work in terminal and textwrangeler But not Script menu. There has got to be answer.. |
|
|
|
|
|
#7 | |||||||||||||||||||||||
|
All Star
Join Date: Jan 2002
Location: CO, USA
Posts: 908
|
Actually, first remember that an app can copy multiple formats to the [clip|paste]board when doing a copy/cut (eg, plain text, RTF, etc). pbpaste is most likely only grabbing the plain text version, then sending that back to pbcopy results in only that one format now being on the [clip|paste]board. |
|||||||||||||||||||||||
|
|
|
|
|
#8 | |||||||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
|
Yes - that makes sense. I had been imagining that pbpaste would retrieve all the available formats from the clipboard. But I guess that wouldn't make sense if the only destination for that data is 'stdout'. |
|||||||||||||||||||||||
|
|
|
|
|
#9 |
|
Hall of Famer
Join Date: Jan 2002
Posts: 3,541
|
Okay, so I'm not the only one seeing this. That's both bad and reassuring at the same time. :-)
*looks for clues* |
|
|
|
|
|
#10 | |||||||||||||||||||
|
Hall of Famer
Join Date: Apr 2002
Posts: 3,315
|
P L E A S E !
It's too early for this topic to wander. This is NOT an issue of formats or the paste board server... Script Menu has been hacked, and we want it back!!! According to my link (2 lines above):
Unfortunately, Tiger has stopped it from working with bash scripts. ![]() AppleScript.scpt files still execute as they did before. (Whether this is intentional or accidental is uncertain. Based on the quote above, it should work. So what's the deal, and what can be done about it?).
Last edited by Hal Itosis; 05-03-2005 at 12:30 AM. |
|||||||||||||||||||
|
|
|
|
|
#11 |
|
Hall of Famer
Join Date: Apr 2002
Posts: 3,315
|
Oh well. Until Apple turns the feature back on, or someone finds some
bits we can twiddle, the best soultion I've found is to use "FastScripts"; free of charge for 30 days or 100 script executions... whichever takes longer to happen. (And $15 after that). :^/ -HI- Last edited by Hal Itosis; 05-04-2005 at 02:59 PM. |
|
|
|
|
|
#12 |
|
MVP
Join Date: Apr 2004
Location: Hello London Calling
Posts: 1,787
|
I thought I may have found a work around in Automator (Automator Library Actions -> Run Shell script) But can not get it to work.
****Edit Okay changed it to the 'Run Applescript' action and entered this Code:
do shell script "~/downloadFind3.sh" This works for now. But not the same as just dumping the shell script in there. Last edited by mark hunte; 05-04-2005 at 03:50 PM. |
|
|
|
|
|
#13 |
|
MVP
Join Date: Mar 2002
Location: Elsewhere
Posts: 1,497
|
Another Workaround
Shell scripts under the Script Menu can be made to work if you:
(A) Change the name from foo to foo.command and (B) Change the first line of the script from '#!/bin/bash' to ' #!/bin/bash' (that is, include an opening space). |
|
|
|
|
|
#14 |
|
Moderator
Join Date: May 2003
Posts: 4,272
|
Great tip, but do you have any explanation for the leading space requirement?
|
|
|
|
|
|
#15 | |||||||||||||||||||||||
|
MVP
Join Date: Apr 2004
Location: Hello London Calling
Posts: 1,787
|
yes but it opens a terminal window to do this which is not ideal. the 'do shell' works without opening a terminal window, but again this is not ideal because you have two files for one script. |
|||||||||||||||||||||||
|
|
|
|
|
#16 | ||||||||||||||||||||||||||||||||||||||||||||||
|
MVP
Join Date: Mar 2002
Location: Elsewhere
Posts: 1,497
|
Arrghh! The original scripts I tried this with naturally had an associated terminal window so I did not notice this: top with a lot of special options, opening an lftp connection to a server. That is not good at all. Back to the drawing board.
No. Some of the scripts I had under the Script Menu were old double-click .command files that I had been too lazy to convert back to ordinary shell scripts. When I created them originally, the only way I had been able to get those .command files to execute upon double-clicking was to have a leading space. I'm not sure why they need them. Last edited by macmath; 05-22-2005 at 02:20 PM. |
||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
#17 |
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
|
I know this is different than having the scripts in a menu, but perhaps some of you would find the contextual menu capabilities of "OnMyCommand" useful:
http://free.abracode.com/cmworkshop/ |
|
|
|
|
|
#18 |
|
Registered User
Join Date: Jun 2005
Posts: 1
|
What about Perl
So what about perl scripts?
The whole adding a blank space is effectively the same as removing the whole line. If you try this with a perl script it attempts to execute it as a bash script - and endless errors result. So I'm totally screwed, I had a bunch of perl scripts that automate my daily tasks - and I came across this Tiger regression flaw while packaging them all for distibution to my coworkers. ... this is big enough for me - I might just go back to Panther. This is all so very disappointing. |
|
|
|
|
|
#19 |
|
All Star
Join Date: Feb 2003
Location: Chico, CA
Posts: 686
|
Beside OMC mentioned above, Launcher enables you to use any form of file launcher you want to launch shell/perl/python/tcl scripts without causing a terminal to open. Just associate the file with Launcher, and open the script from *anywhere* to cause it to be executed.
I frequently run my scripts from Dragthing buttons using Launcher, but there are many more options for running scripts with this utility installed, which might be especially useful to those left without a Script Menu by Tiger. |
|
|
|
|
|
#20 |
|
Triple-A Player
Join Date: Oct 2003
Posts: 91
|
I wonder if anyone has managed to fix this without using another app?
|
|
|
|
![]() |
|
|