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 delay 15 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 Save as... page of applescript editor: I tried both setting for only execute, but anything change.
With the start screen 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?
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
EDIT: Now it seems to work! I forgot to re- set progList to (name of every process). Now the code is correct.