Monday, July 16, 2018

#1 2005-08-29 01:18:17 pm

bob
Member
Registered: 2005-08-29
Posts: 25

how to paste with pbpaste

Hello,

Working on a Automator workflow witch does the following

Have a folder with al .tga that are compressed to .tga.gz

normaly you can do this uncompressing by typing cd and then drag the whole folder with all compressed tga.gz fiels to get the path. Then type gunzip *.gz to unpack all images.

You get my point I guess. This must be easier to do so want to make a workflow where the user only have to select the folder with al the tga.gz files

1) want to copy the folder path - let say /Users/johndoe/Desktop/tree to the clipboard
2) past this path behind a cd command in the terminal

so what I came up (after studying several discussions ) with is a automator workflow with apple script that has the following;

1) folder choose by user
2) the get path from folder and copy to clipboard (have also trouble with this part)

3) and now the most important step, the applescript in the automator workflow;

Applescript:

on run {input, parameters}
   tell application "Terminal"
       do shell script "cd; pbpaste"
       do shell script "gunzip *.gz"
   end tell
   
   return input
end run

But this does not work...someone has a suggestion?

Tried several options and also looked at apple tech do shell information site but for now my brain is overheaded....and perhaps soem of you has a quick sollution.

Thanks!

Greetings

Bob


Filed under: terminal

Offline

 

#2 2005-09-07 03:48:25 pm

Bruce Phillips
Administrator
Registered: 2004-07-16
Posts: 2649

Re: how to paste with pbpaste

Make an Automator workflow that contains a single AppleScript:

Applescript:

choose folder
get quoted form of POSIX path of result

do shell script "cd " & result & "; gunzip *.gz"

Offline

 

#3 2005-09-07 03:58:06 pm

bob
Member
Registered: 2005-08-29
Posts: 25

Re: how to paste with pbpaste

Hello Bruce

It works great thanks you very much!

Bob

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)