Substance Player automation
Sadly, Substance Player has no option for batch export - If you have a lot of .sbsar file, this might be a kind of time consuming task to open each file and do export process. Here is a simple AppleScript automation script that you can use for automate this action:
on remove_extension(this_name)
if this_name contains "." then
set this_name to (the reverse of every character of this_name) as string
set x to the offset of "." in this_name
set this_name to (text (x + 1) thru -1 of this_name)
set this_name to (the reverse of every character of this_name) as string
end if
return this_name
end remove_extension
on run {input, parameters}
repeat with afile in input
try
tell application "Finder"
set parentpath to POSIX path of (parent of afile as string)
set filename to name of (afile)
set dirname to my remove_extension(filename)
set newpath to parentpath & dirname
do shell script "mkdir -p " & quoted form of newpath
end tell
tell application "Substance Player"
launch
activate
open afile
end tell
tell application "System Events"
key code 109
repeat until (exists window "Export as Bitmap(s)" of application process "Substance Player")
delay 2
end repeat
tell process "Substance Player"
set winstuff to entire contents of front window
set menustuff to entire contents of menu bar 1
---return winstuff
end tell
tell process "Substance Player"
set value of text field 1 of group 1 of window 1 to newpath
tell pop up button 1 of group 1 of window 1
if title is not "png" then
click
delay 0.2
keystroke "p"
keystroke return
---pick menu item "png" of menu 1
end if
end tell
click button "Export" of window 1
delay 2
repeat
if (title of (get properties of button 2 of window 1)) does not contain "Wait..." then exit repeat
end repeat
click button "Close" of window 1
end tell
end tell
on error error_message
display dialog error_message
end try
end repeat
return input
end run
Comments