Run plist command every 5 seconds I have the following plist file in my User/Library/LaunchAgents folder. It presses the "g" key every 60 seconds.

My question is, how can I change this to press the "g" key every 5 seconds?  

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
 "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;key&gt;Program&lt;/key&gt;
    &lt;string&gt;/usr/bin/osascript&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;osascript&lt;/string&gt;
        &lt;string&gt;-e&lt;/string&gt;
        &lt;string&gt;tell application "System Events" to keystroke "g"&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;ServiceDescription&lt;/key&gt;
    &lt;string&gt;Auto Keypress&lt;/string&gt;
    &lt;key&gt;StartCalendarInterval&lt;/key&gt;
    &lt;dict&gt;
        &lt;key&gt;Second&lt;/key&gt;
        &lt;integer&gt;0&lt;/integer&gt;
    &lt;/dict&gt;
&lt;/dict&gt;
&lt;/plist&gt;
Change the plist to

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
 "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;G-key-pusher&lt;/string&gt;
    &lt;key&gt;Program&lt;/key&gt;
    &lt;string&gt;/usr/bin/osascript&lt;/string&gt;
    &lt;key&gt;Program&lt;/key&gt;
    &lt;string&gt;/bin/sh&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;sh&lt;/string&gt;
        &lt;string&gt;-c&lt;/string&gt;
        &lt;string&gt;while sleep 5; do /usr/bin/osascript -e 'tell application "System Events" to keystroke "g"'; done&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;ServiceDescription&lt;/key&gt;
    &lt;string&gt;Auto Keypress&lt;/string&gt;
    &lt;key&gt;KeepAlive&lt;/key&gt;
    &lt;true/&gt;
&lt;/dict&gt;
&lt;/plist&gt;


What it does, is to run a shell script that does the 5 second timer and calls osascript. The launchd plist just ensures the script is restarted if it were to die for some reason. Please note that I still haven't tested this, but I don't see any reason why it shouldn't work. Though I have had problems in the past when changing launchd items, which I fixed by changing the label. Which reminds me, you had omitted the value for the Label key in your plist.

(Edit: Explain a little, and provide a complete file instead of explaining what parts need to be changed.)