Created
November 18, 2012 12:33
-
-
Save walm/4105005 to your computer and use it in GitHub Desktop.
Run Slicy on PSD from command line using AppleScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run argv | |
set input_file to POSIX file (item 1 of argv) | |
set output_path to item 2 of argv | |
-- TODO: add some error handling :) | |
-- make sure output folder exists | |
do shell script "mkdir -p " & output_path | |
-- drop input file on Slicy app | |
tell application "Finder" | |
activate | |
open input_file using application file "Slicy.app" of folder "Applications" of startup disk | |
end tell | |
-- Save slices to output folder | |
tell application "System Events" | |
tell application process "Slicy" | |
delay 5 -- might need to set this higher depending on PSD layers | |
keystroke "s" using {command down} -- do save | |
delay 1 | |
keystroke "g" using {shift down, command down} -- set output path with go to folder | |
keystroke output_path | |
keystroke return | |
delay 1 | |
keystroke return | |
delay 2 | |
keystroke "q" using {command down} -- quit | |
end tell | |
end tell | |
end run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
osascript ~/bin/sliceit.scpt "$PWD/$1" "$PWD/$2" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put files in ~/bin (if that is in your path)
chmod +x sliceit.sh
Then run it like