Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on extensionSplitter(file_name)
- set savedDelimiters to AppleScript's text item delimiters
- set AppleScript's text item delimiters to "."
- set splitted_text to every text item of file_name
- if (count of items of splitted_text) is greater than 1 then
- set my_result to {fname:items 1 through -2 of splitted_text as text, extension:last item of splitted_text}
- else
- set my_result to {fname:splitted_text as text, extension:missing value}
- end if
- set AppleScript's text item delimiters to savedDelimiters
- return my_result
- end extensionSplitter
- -- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- on zipIt(path_one, path_two, archive_name)
- do shell script "zip -j " & archive_name & ".zip " & path_one & " " & path_two
- end zipIt
- -- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- on run
- -- Config
- set first_extension to {"jpg", "jpeg"}
- set secondExtension to "eps"
- tell application "Finder"
- set the_folder to (choose folder with prompt "Vyber složku se soubory")
- set all_files to every file of the_folder where name extension is in first_extension
- repeat with ifile in all_files
- set first_file_breakdown to my extensionSplitter(name of ifile)
- set second_file_name to fname of first_file_breakdown & "." & secondExtension
- if second_file_name is in (name of every file of the_folder) then
- set ipath to POSIX path of the_folder
- my zipIt(ipath & name of ifile, ipath & second_file_name, ipath & fname of first_file_breakdown)
- end if
- end repeat
- end tell
- end run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement