Mac Help Forums


Reply
Thread Tools Display Modes

help-- zip folder automator

 
New Member
Join Date: May 2007
Posts: 3
 
      27th May 2007
Hi, I was getting tired of going to the terminal to zip folders so I made an automator script so all i had to do was right click the folder and select "zip this folder" and it would be done! We'll I'm not too keen at applescript and it only works sometimes..

Sometimes it gives me an error,and when it does work, when unzipping it turnes out it ziped my USERS folder, but not the whole ting

only the original folder is there, but it put it in a whole bunch of folders:
Users>Desktop>folder

Right now this is the automator script:

1: Get Selected Finder items
Files/Folders
v
Anything
2: Run applescript
Code:
--I stole this method from apple:
--http://www.apple.com/applescript/guidebook/sbrt/pgs/sbrt.07.htm
--thanks for this handy script apple!
on replace_chars(this_text, search_string, replacement_string)
	set AppleScript's text item delimiters to the search_string
	set the item_list to every text item of this_text
	set AppleScript's text item delimiters to the replacement_string
	set this_text to the item_list as string
	set AppleScript's text item delimiters to ""
	return this_text
end replace_chars
--Start the actual run method
on run {vfolder}
	set vfolder to vfolder as string
	set verror to false
	set vfile to ""
	tell application "Finder"
		if folder vfolder exists then
			set vfile to name of folder vfolder
		else
			set verror to true
		end if
	end tell
	set vfolder to replace_chars(replace_chars(vfolder, "Macintosh HD:", ""), ":", "/")
	if verror = false then
		do shell script ¬
			("zip -r ../../" & vfolder & "../" & vfile & ".zip ../../" & vfolder)
	else
		display dialog "There was an error zipping the file:
 \"" & vfolder & "\"" buttons {"Ok"}
	end if
end run
As I said not too good at applescript so I had to use a lot of ../ which i think is causing the problem. Any help would be great!
 
Reply With Quote
 
 
 
 
Ric Ric is offline
Senior Member
Ric's Avatar
Join Date: May 2004
Posts: 4,260
 
      28th May 2007
Hi there and welcome !

I'll have a look at your code tonight...

...lots to catch up on !

regards

Ric
 
Reply With Quote
 
New Member
Join Date: May 2007
Posts: 3
 
      31st May 2007
so nobody has any answers for me ?
 
Reply With Quote
 
Ric Ric is offline
Senior Member
Ric's Avatar
Join Date: May 2004
Posts: 4,260
 
      31st May 2007
Hi there,

sorry for our sloow response !

First, why do this via terminal...or via Automator or via AppleScript...

Can you not just right click (or hold down the control key) and click the folder that you want to zip and select 'Archive..'



Regards

Ric
 
Reply With Quote
 
New Member
Join Date: May 2007
Posts: 3
 
      9th June 2007
oh haha looks like apple's already got me covered. Thanks
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting 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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automator-auto delete contents of folder Ric Mac OS X 1 27th September 2010 10:00 PM
XMenu wrinkles (folder alias inside folder) AES Mac 1 25th April 2007 02:20 AM
Automator-iTunes drop folder Ric Mac OS X 0 6th October 2005 05:31 PM
OS X: App-specific documents in the Apps folder, or the Docs folder? AES/newspost Apps 9 8th January 2005 09:10 AM
OS X: App-specific documents in the Apps folder, or the Docs folder? AES/newspost Mac 9 8th January 2005 09:10 AM


All times are GMT +1. The time now is 10:53 AM.
Mac-Help.com is an independent website and is not affiliated with Apple Inc.


Welcome!
Welcome to the Mac Help Forums
 


Latest Threads
New book about Steve Jobs << take part in it!
Arjan (1 Hour Ago, 09:37 AM)

Help! Stupid computer is automatically logging me out
Elizaboo (12 Hours Ago, 10:41 PM)

URGENT Help. Crazy talk Mac!
Joeker (13 Hours Ago, 09:42 PM)

PDF Document
yura (22 Hours Ago, 12:13 PM)

Difficulties with internet speed (nothing to do with connection)
sammethh (1 Day Ago, 06:36 AM)

 


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51