MikeP Posted May 14, 2008 Posted May 14, 2008 Hi, I'll try describing my problem as precisely as possible to make sure you understand. At the start of my script I'm using #NoTrayIcon then setting up my own with SetTrayIcon(".\ico\*****.ico") what I would like to do is hiding it with TraySetState(2) if a stupid user of my application is going to the ico directory to rename the .ico file. So I tried this : $trayIco = TraySetIcon(".\ico\******.ico") MsgBox(0, "", $trayIco) If $trayIco = 0 Then TraySetState(2) Else TraySetState() EndIf The problem is, wether the script is compiled or not, If i'm changing the ico file name so that the script will fail, the Msgbox always popup with 1 .. which means TraySetIcon was successful... Any ideas?
rasim Posted May 15, 2008 Posted May 15, 2008 (edited) Mayb this? Global $check = False $IconPath = "c:\Temp\autorun1.ico" $trayIco = TraySetIcon($IconPath) While 1 If (FileExists($IconPath) = 0) And ($check = True) Then $check = False TraySetState(2) ElseIf (FileExists($IconPath) = 1) And ($check = False) Then $check = True TraySetState() EndIf Sleep(50) WEnd Edited May 15, 2008 by rasim
MikeP Posted May 15, 2008 Author Posted May 15, 2008 Nice way-around.. there's a little mistake in the initialization $check must be True , this script is not the 100% perfect solution though. For a few milliseconds the icon of the .exe file still appear in the tray.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now