Hello,
I want to create an agent that would launch a certain script when iTunes is launched. Obviously, with the traditional set of properties such as KeepAlive and RunAtLoad it will resume endlessly as soon as the default 10-sec interval elapses which is not the desired behaviour as I need it running the script at iTunes' launch time and only once per launch session. I'm not a programmer, so my knowledge is not first-hand, but I'm aware of the notions of file descriptors, ports and files opened by a Mac application. In Activity Monitor I see those but I don't know which of them could be useful. If it's a path than I'd experiment with it by setting either WatchPaths, PathState or QueueDirectories but I don't even have a clue what paths and ports are indicative of the launched process or if it's some other properties of Launchd.plist.
My job is as follows:
NOTE. "Run targeted iTunes script.scpt" is the script that targets (runs) another AppleScript script.
I want to create an agent that would launch a certain script when iTunes is launched. Obviously, with the traditional set of properties such as KeepAlive and RunAtLoad it will resume endlessly as soon as the default 10-sec interval elapses which is not the desired behaviour as I need it running the script at iTunes' launch time and only once per launch session. I'm not a programmer, so my knowledge is not first-hand, but I'm aware of the notions of file descriptors, ports and files opened by a Mac application. In Activity Monitor I see those but I don't know which of them could be useful. If it's a path than I'd experiment with it by setting either WatchPaths, PathState or QueueDirectories but I don't even have a clue what paths and ports are indicative of the launched process or if it's some other properties of Launchd.plist.
My job is as follows:
XML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.smartsolutions.addtracks</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/osascript</string>
<string>/Users/me/Documents/Run Targeted iTunes Script.scpt</string>
</array>
<key>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>/Users/me/Documents/MyLaunchd_Logs/Addtracks-out.log</string>
<key>StandardErrorPath</key>
<string>/Users/me/Documents/MyLaunchd_Logs/Addtracks-err.log</string>
</dict>
</plist>
NOTE. "Run targeted iTunes script.scpt" is the script that targets (runs) another AppleScript script.
Last edited: