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 :)
I went through the exact same process back when I was playing around with logKext. The unix command you may want to explore is /usr/bin/expect.
It can get complex quickly, but basically what it does is act as a mediator between you and the programs you're running so it can provide answers that you would normally have to type. As an example, I built this script so I could automate the process of printing the logKext output. You should recognize all of the commands you'd normally type to logkextClient yourself...
#!/usr/bin/expect -f
spawn logkextClient
expect "logKext Password:"
send "mylogkextpassword\r"
expect "logKextClient > "
send "print\r"
expect "logKextClient > "
send "quit\r"
close
Back in 10.5 and 10.6 this worked well for me for outputting the logKext print so I could pipe it into an email and send it. However, I was running this logged in as root to terminal, so it was simple.
Theoretically, if you weren't logged in as root, you could instead say
#!/usr/bin/expect -f
spawn sudo -k logkextClient
expect "Password:"
send “myrootpassword\r”
expect "logKext Password:"
send "mylogkextpassword\r"
expect "logKextClient > "
send "print\r"
expect "logKextClient > "
send "quit\r"
close
(note that I used sudo -k
intentionally to be consistent and require a password every time)
So you could use your favorite command line editor to create this script, do a chmod +x
to it and drag it to the dock for launching... Theoretically.
But I have been having problems in Mavericks getting /usr/bin/expect to behave properly with sudo, so this isn't working for me in other scripts like it should. And I don't have logKext installed at all anymore for testing anyway.
But I think this is the direction you may want to head.
Good luck!
Best Answer
Testing this under macOS Sierra 10.12.6, I did not find it necessary to use the
sudo
command to runCumulusMX.exe
usingmono
.At a minimum, the following example AppleScript code can be used in Script Editor to create an AppleScript application that you can add to your Login Items.
To use the example AppleScript code, copy and paste the code into a new document in Script Editor and then save it as an application, e.g.: Cumulus MX
Then add Cumulus MX to: System Preferences > Users & Groups > $USER > Login Items
I’d like to mention that if I was doing this on my system the CumulusMX folder would not be on my Desktop, as IMO that’s not an appropriate place to put it. Also, in testing the example AppleScript code, I did not find it necessary to use the
sudo
command to runmono
, however if for some reason you need to do that, then additional steps would need to be taken but not recommended to automate.Note: The example AppleScript code is just that and does not include any error handling as may be appropriate/needed/wanted, the onus is upon the user to add any appropriate error handling for any example code presented.