Skip to content

Commit

Permalink
Merge pull request #5 from azizshamim/reapply-4
Browse files Browse the repository at this point in the history
Add same-directory-level thumbnail folders.
  • Loading branch information
azizshamim committed Oct 28, 2015
2 parents 4cd68a3 + edd0053 commit 24f1380
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
5 changes: 3 additions & 2 deletions thumbscrew-clean
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash

NAME=${1}

NAME=${NAME##*/}
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

GTL=`git rev-parse --show-toplevel`
SAVE=$(dirname `find ${GTL} -name ${NAME}`)

/usr/bin/osascript ${DIR}/thumbscrew.scpt ${GTL} ${NAME} 2>/dev/null
(cd $SAVE; /usr/bin/osascript ${DIR}/thumbscrew.scpt ${SAVE} ${NAME} 2>/dev/null)
cat -
25 changes: 12 additions & 13 deletions thumbscrew.scpt
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
-- thumbscrew.scpt
-- usage: thumbscript.scpt <keynotePresentation>
-- usage: thumbscript.scpt <path_to_git_root_dir> <path_to_keynotePresentation>
--
-- Will create scaled thumbnails of length `thumbSize` in the directory
-- <path_to_keynotePresentation>/<thumbnailDir>
-- <path_to_presentation>
property thumbSize : 480
property thumbnailDir: "thumbnail"


on getImages(f)
tell application "Finder" to return (files of folder f) as alias list
end getImages

on run argv
set repoPath to item 1 of argv
set documentName to item 2 of argv
set documentFullName to repoPath & "/" & documentName
set savePath to item 1 of argv
set keynoteName to item 2 of argv
set thumbnailDir to keynoteName
if thumbnailDir ends with ".key" then set thumbnailDir to text 1 thru -5 of thumbnailDir

set keynoteFile to (POSIX file documentFullName) as alias
set documentPath to posix file (POSIX path of (do shell script "dirname " & quoted form of documentFullName)) as alias
set keynoteFile to (POSIX file keynoteName) as alias
set keynoteFullName to savePath & "/" & keynoteName
set savePath to posix file savePath

tell application "Finder"
if not (exists folder thumbnailDir of folder documentPath)
make new folder at folder documentPath with properties {name:thumbnailDir}
if not (exists folder thumbnailDir of folder savePath)
make new folder at folder savePath with properties {name:thumbnailDir}
end if
set the targetFolder to folder thumbnailDir of folder documentPath
set the targetFolder to folder thumbnailDir of folder savePath
set the targetFolderHFSPath to targetFolder as string
end tell

Expand Down Expand Up @@ -51,5 +51,4 @@ on run argv

close front document without saving
end tell

end run

0 comments on commit 24f1380

Please sign in to comment.