I would like to write a plist that would call quicklook to display a csv file containing weather data every morning at 7 AM.
How do I launch quickview on a file? Can I do it with python's subprocess.Popen?
I found the quicklook process on activity monitor but I don't know how I would call it or if its about quicklook or spotlight.
According to the formula i need to provide some code so this is the plist
<?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>com.my-script</string>
<key>ProgramArguments</key>
<array>
<string>/Users/al/Documents/wget/my-script.sh</string>
</array>
<key>StartCalendarInterval</key>
<array>
<dict>
<key>Hour</key>
<integer>7</integer>
<key>Minute</key>
<integer>01</integer>
</dict>
</array>
</dict>
</plist>
I would like the script /Users/al/Documents/wget/my-script.sh to call quicklook on my csv file
Related
I built a job by Automator to clear the downloads folder and empty the trash. When i start the created app by double click, it starts correctly. But it has to be transferred to other computer in our company and i dont want to give the user the job to launch the app.
So i created this LaunchAgent script to start the app.
<?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>com.herpag.aufraeumen.plist</string>
<key>ProgramArguments</key>
<array>
<string>/Users/hansthiele/Applications/Aufraeumen.app</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Minute</key>
<integer>45</integer>
<key>Hour</key>
<integer>13</integer>
</dict>
</dict>
</plist>
My problem is now, that the console tells me that the job is started, but nothing happens. The downloads are not cleared and the trash is still full. Also the error.log is empty.
There are 2 issues:
The Label argument must be specified without the .plist extension.
The path must represent the executable rather than the application container. In case of an Automator app the executable is named Application Stub (unlike Applet in an AppleScript app). It's assumed that hansthiele is the real short username of the current user.
Try
<?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>com.herpag.aufraeumen</string>
<key>ProgramArguments</key>
<array>
<string>/Users/hansthiele/Applications/Aufraeumen.app/Contents/MacOS/Application Stub</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Minute</key>
<integer>45</integer>
<key>Hour</key>
<integer>13</integer>
</dict>
</dict>
</plist>
I've made an Automator app that finds people that has birthdays on a given day and saves the names of those in a text-file. It runs in a bash script that also alerts me when someone has a birthday. This works fine when i initiate the script from terminal. But when it runs through my ~/Library/LaunchAgents the birthday list is always empty. Does anybody have a clue, what could be the cause of this?
this is my agent-script
<?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>dk.emmajohnsen.birthdaygreetings</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>/Users/Emma/Projects/scripts/project_happy_birthday/orchestrateBirthdayAlert</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>08</integer>
<key>Minute</key>
<integer>17</integer>
</dict>
</dict>
</plist>
I need to run an mac app daily without any user interaction using launchd, i created a .plist file and pasted it in /system/LaunchDaemons and after that how to execute the plist file, can any one please tell me the step by step working process on how to work with launchd it will helpful for me, I pasted my .plist file below.
<?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>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>myapp.restart</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/myapp.app</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>16</integer>
<key>Minute</key>
<integer>40</integer>
</dict>
</dict>
</plist>
You'll probably need the name of your program like this rather than ProgramArguments:
<key>Program</key>
<string>/Applications/myapp.app/Contents/MacOS/myapp</string>
I am trying to develop a Mac LaunchAgent and am testing with this, which should start the console:
<?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>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.depthmine.test</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/Utilities/Console.app/Contents/MacOS/Console</string>
</array>
</dict>
</plist>
The file appears to load (no errors in the Terminal) but the console does not start and there does not seem to be a process in Terminal either. I also tried a PHP script and that didn't start either.
I'd like to be able to add a file to a Textmate project (which is currently open) from the command line. Is there a way to do it (maybe via Applescript, the mate command, directly editing the project file, etc.)?
Here is a sample TextMate project file:
<?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>documents</key>
<array>
<dict>
<key>filename</key>
<string>bar.c</string>
</dict>
<dict>
<key>filename</key>
<string>foo.c</string>
</dict>
<dict>
<key>filename</key>
<string>../src/c/linkedlist.c</string>
</dict>
</array>
<key>fileHierarchyDrawerWidth</key>
<integer>265</integer>
<key>metaData</key>
<dict/>
<key>showFileHierarchyDrawer</key>
<true/>
<key>windowFrame</key>
<string>{{282, 3}, {1148, 875}}</string>
</dict>
</plist>
All you need to do is create a command-line tool which adds the following information:
<dict>
<key>filename</key>
<string>PATH_TO_FILENAME</string>
</dict>
Don't forget to replace PATH_TO_FILENAME with real path. Normally, I would write the script to illustrate my point, but since I don't have time, I can only offer this suggestion instead.