Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > iKey and Unix commands

iKey and Unix commands
Thread Tools
Mac Elite
Join Date: Mar 2001
Location: Provo, UT
Status: Offline
Reply With Quote
Oct 7, 2003, 12:52 PM
 
I'd posted this to the software forum but didn't get a response. I'm trying out iKey as it seems like a great way to combine scripts written in Python or Perl with macros. Sort of like what you can do with Services, only in a more robust fashion.

However...

OK, I've been trying to figure this out and I can't. I have a python script in ~/bin which does a bit of reformatting of text in the clipboard so I can paste it into a mail message. (Basically a fancy formatter)

I created a Unix shortcut in iKey so I could associate this with a key. The shortcut is as follows:

pbpaste | /Users/clarkgoble/bin/format_paragraph 2 55 "|" | pbcopy

Now in iKey this does nothing to the clipboard. But if I do this as a line in Terminal then it works fine, converting the clipboard.

Any ideas of what might be happening? I've tried putting full paths to pbpaste but to no avail.
     
Senior User
Join Date: Oct 2000
Location: Midwest
Status: Offline
Reply With Quote
Oct 7, 2003, 03:29 PM
 
Weeelllll.......

If you run it in the Terminal you are using a shell to communicate. If you run it as an iKey where are you sending it? What is going to be the vehicle for interaction? I'm scratching my head, maybe I don't understand the question.

There is an option in iKey's Unix group to Run in Terminal, but I am guessing that you saw that and it does not fit your need.

Craig
     
Mac Elite
Join Date: Mar 2001
Location: Provo, UT
Status: Offline
Reply With Quote
Oct 7, 2003, 03:44 PM
 
I saw that, tried that, and it doesn't work.

The basic problem is that if that line is run, in any fashion, by iKey, it doesn't work. If I manually run it in the shell, it does.

At first I thought it might be that my .tcshrc isn't being run and paths aren't right. But I put explicit paths everywhere. I just don't know why iKey isn't running it. It is very confusing to me.
     
Mac Enthusiast
Join Date: Nov 2001
Location: Adelaide, South Australia
Status: Offline
Reply With Quote
Oct 7, 2003, 07:58 PM
 
While I've never upgraded to iKey I do still have "Youpi Key" lying around fallow. I made a new item of type "run unix commands" and entered the following command:

/usr/bin/pbpaste | /usr/bin/fmt | /usr/bin/pbcopy

Worked exactly as it should: reformatted the text in the clipboard and then pasted it back there. So I think you can narrow it down to your python script (assuming that the above also works in iKey).

Cheers,
Paul
     
Mac Elite
Join Date: Mar 2001
Location: Provo, UT
Status: Offline
Reply With Quote
Oct 7, 2003, 09:55 PM
 
I played around with it more and it appears like iKey does not like arguments passed to the script. I don't know why.
     
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status: Offline
Reply With Quote
Oct 8, 2003, 03:52 PM
 
Did you try
sh -c '/usr/bin/pbpaste | /Users/clarkgoble/bin/format_paragraph 2 55 "|" | /usr/bin/pbcopy'

perhaps it's doing an exec rather than a system() ?
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:35 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2