title: Applescript doesn't work on OSX startup
body: <p>I wrote my applescript app to hide the window of my wifi card.
  I ran into some problem checking if the window is visible or not (to avoid the command+h keypress have no effect), so I decided to use a <code>delay 15</code> to make (not at all) sure the window pops up. If I run the script from the editor or by double-click on the app file, it works, but if I set it to start at the login of the user (under Settings>Account>Login Elements), it doesn't work!
  I tried to change the checkbox in the <code>Save as...</code> page of applescript editor: I tried both setting for <code>only execute</code>, but anything change.
  With the <code>start screen</code> option in fact it works, but it ask me a confirmation and I don't want it (I'll prefere to press cmd+h instead).
  Anyone can explain me why I have this issue?</p>
  
  <pre><code>tell application "System Events"
  set progList to (name of every process)
  set cond to false
  repeat while cond is false
      if (progList contains "WirelessUtilityCardbusPCI") is true then
          delay 5
          activate application "WirelessUtilityCardbusPCI.app"
          tell application "System Events" to keystroke "h" using [command down]
          set cond to true
      else
          delay 5
          set progList to (name of every process)
      end if
  end repeat
  end tell
  </code></pre>
  
  <p>EDIT: Now it seems to work! I forgot to re- <code>set progList to (name of every process)</code>. Now the code is correct.</p>