This won't work for a signed app, but here's how I was able to get this to work:
Create a copy of the app you're trying to modify in case something goes wrong. (⌘D in Finder) For my example here, I modified the non-app store version of VectorDesigner
In Terminal, cd /Applications/VectorDesigner.app/Contents/MacOS
mv VectorDesigner VectorDesigner\ copy
(substitute the name of your app here
pico VectorDesigner
(or your editor of choice) and add the contents of your script.
I used this script
#!/bin/sh
osascript -e "tell Application \"Finder\" to display alert \"Hello World\""
/Applications/VectorDesigner.app/Contents/MacOS/VectorDesigner\ copy
The important thing is for the last line to call the renamed executable.
chmod a+x VectorDesigner
Now, when I double-click the VectorDesigner icon, I get the "Hello World" window, then it launches the original program.
EDIT: Workflow now works with one bug: running the workflow twice results in two copies of the control file being copied
Make a new Automator SERVICE. At the beginning, for "receives selected as input" choose "documents". Add the process "set value of variable" and make a new "destination path" variable (default variable name is "destination path"). Add the process "open finder items" to the beginning to open the control file. Add the process "run applescript" to the workflow the code is the following:
on run {input, parameters}
set LineNumber to (the line in which the path is specified in the control file)
tell application "TextEdit"
set theVariable to paragraph LineNumber of document 1
set thePath to POSIX path of theVariable
set thePath to text 1 thru -2 of thePath
end tell
return thePath
end run
I don't know why this couldn't have been in the same block, but you need to add a separate AppleScript process. The code is as follows:
on run {input, parameters}
tell application "Finder"
set theFolder to POSIX path of input & "/DEBIAN"
try
make new folder in folder input with properties {name:"DEBIAN"}
end try
end tell
return theFolder
end run
Add the process "set value of variable" and make a new destination path variable (default name is "destination path 1").
Add the "get value of variable" process and get the value of the variable with the path of the input file ("destination path"). Click on "options" on this process and check "ignore this action's input".
After this, Automator has a process called "copy finder items" and this can be used to copy the input (the output of "get value of variable", which is the input file). This worked for me, hope it works for you as well. Good luck :)
Best Answer
Delete the question! I found "configure" in another directory. Apologies for asking