Home > mac > Run AppleScript on startup (background)

Run AppleScript on startup (background)

January 23Hits:7
Advertisement

I want to run a apple-script on Mac OS X on startup. The script shall run during the complete lifetime of the user session.

What is the best solution to do this?

My Script:

on idle     do shell script "/usr/local/bin/wol -p 9 0:1d:63:19:b7:32"     delay 120 end idle 

Any help will be very appreciated.

Answers

When saving the script in the script editor, save as an application bundle, then add it to the startup items in login system preferences:

Run AppleScript on startup (background)

If you want it to run in the background, you can use iBackground Scripts, a free tool to make applescripts run in the background.

Run AppleScript on startup (background)

I know your question is about running an Apple Script, but if all the script is doing is running /usr/local/bin/wol every 2 minutes, a simpler solution might be to use a launch daemon?

Either in /Library/LaunchDaemons if it's to run continuously even without a user logged in, or in ~/Library/LaunchDaemons to run per user (bearing in mind there could be more than one instance running if you've got more than one user logged in).

At least you don't have to worry about popup windows getting in the way.

As an alternative to the AppleScript way, I typically use launchd for handling things like this. launchd is customizable and very powerful.

http://developer.apple.com/MacOsX/launchd.html

To prevent the 'do you want to run...' dialog: As you're saving your script as an application bundle, untick the 'Startup Screen' checkbox in the Save As dialog.

Related Articles

  • Run AppleScript on startup (background)

    Run AppleScript on startup (background)January 23

    I want to run a apple-script on Mac OS X on startup. The script shall run during the complete lifetime of the user session. What is the best solution to do this? My Script: on idle do shell script "/usr/local/bin/wol -p 9 0:1d:63:19:b7:32" delay

  • How can I run mongod in the background on unix (mac osx)?July 6

    I would like to run mongod in the background as an always present sort of thing. What would be the best way to do this? Kind of like the way I can run MySQL on startup and it's just always there running in the background. Maybe it's just some bash sc

  • Custom daemon script: works, but does not run at boot / startupApril 10

    this is Ubuntu 10.10 Maverick. I have the following shell script in init.d that I want to run as a "daemon" (background service with start/stop/restart really) at system startup. There is a symlink in rc3.d. I tried 4 and 5 too. (Ideally this wo

  • How to run Dropbox daemon in background?April 3

    I'm using Debian 6 and Dropbox. I followed these commands to install it. When I run ~/.dropbox-dist/dropboxd - Dropbox works and stuff. Problem is that when I close terminal or, even worse, - reboot... Dropbox stops to work and I need to run that dea

  • Run applescript as a serviceOctober 5

    I have the following applescript bundled as .app (using Platypus) and starting on user logon (12.4 MB for each user) #!/usr/bin/osascript -- INICIO DAS FUNCOES EXTRAS set app_path to path to current application set app_name to get name of me set myPa

  • Run Program on Startup?March 31

    How is it possible to have an executable run automatically on startup? Is it possible by having a shortcut to the .exe in the startup folder in the All programs section of the start menu? If that is correct, what is the full directory of the startup

  • how to run conky on startup?i am using ubuntu lucid lynx i386August 30

    i haved configured my conky, and i want to run it on startup, i did found some tuts on internet, i haved put my conky in the startup, but in the screen, it just show just a second and gone..so how will i resolve that? --------------Solutions---------

  • How to run Wireshark in the background without the GUI?December 31

    I am trying to run Wireshark on Mac OS X in the background. I installed the command line utilities, and so I am able to start Wireshark and capture packets using the command line. The only thing I want now is to run it in the background, without the

  • How to run Applescript on Disk mountFebruary 9

    I want to run an Applescript when I mount a specific disk. It isn't if the script is located on the disk or not, it should just run when OS X mounts the disk. I tried to accomplish this with folder actions, but it looks like it isn't possible to do i

  • Running program on startupOctober 18

    I wrote a program in Bash, and now I want to run it on startup for all users so that nobody can cancel it, except for root. How can I do it? --------------Solutions------------- Maybe something like... A question How to run a script with the root rig

  • Running programs in the background from terminalFebruary 22

    How do I run a program in the background of a shell, with the ability to close the shell while leaving the program running? Lets say my UI is having problems or for some reason, I need to boot up a program from the terminal window, say, nm-applet: nm

  • How do I enable Firestarter to run at Ubuntu startupMay 28

    Firestarter does not appear to have an option to enable it to run at Ubuntu startup. Is their a specific setting in Ubuntu that I need to edit to enable this? --------------Solutions------------- The linux firewall is actually a feature of the kernel

  • Run XMonad's startup hook only on initial startupFebruary 12

    I have the following startupHook in my xmonad.hs , startupHook = spawn "~/.xmonad/autostart" I am starting many apps and daemons in this script and it is written to run only once on startup. But this is being run everytime I hit Mod-q, i.e., to

  • Running thousands of curl background processes in parallel in bash scriptNovember 7

    I am running thounsand of curl background processes in parallel in the following bash script START=$(date +%s) for i in {1..100000} do curl -s "http://some_url_here/"$i > $i.txt& END=$(date +%s) DIFF=$(( $END - $START )) echo "It too

  • Auto-login to aws ec2 instance running windows on startupMarch 3

    I'm trying to run a service on startup of a windows instance on amazon. So far it is a manual process where I have to start rdp in, log in and then start the process. I'd like it when the instance loads for us to be able to bypass the login so it can

  • How do i run node save in background processMarch 19

    I have created drupal website for ecommerce store. Issue: After node save i will redirect to thankyou (destination) page for tracking but it takes long time to complete. Customer may skip if it takes long time to complete the process. How do i run no

  • Running a program in background using command-line August 25

    This question already has an answer here: Running programs in the background from terminal 5 answers How do I run a program in the background from a shell, with the ability to close the shell while leaving the program running which should not disturb

  • How to run a command in background always?January 26

    the below command when I run from the terminal will keep posting the output to message.log cf logs broker-analytics > /var/www/cfbrokerlogs/message.log However, if i close my terminal it will stop working. How do i make it run in the background all t

  • Running Sysprep from startup repairJune 22

    My laptop's charging port recently broke, and I bought a new laptop and moved the old hard drive into the new laptop. The old hard drive was running windows 7. The hard drive boots, but it crashes during startup and allows me to access Startup Repair

  • What does it mean to run a process in background? July 22

    This question already has an answer here: what is a background process? 2 answers What exactly does it mean to run a process in the background? The difference between $program and $program&: Is it just that the input file descriptor is not inherited

Copyright (C) 2018 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.657 s.