Jump to content
Sign in to follow this  
Diana (Cda)

Icon to appear only while AI performing function.

Recommended Posts

Diana (Cda)

I just can't seem to wrap my brain around this one. I'm constantly having trouble with While and Wend.

What I need is for the generic AI tray icon not to appear. Got that covered with the usual "#NoTrayIcon". Then while the script is performing the close, to have a specific icon appear. I've got the code for that, too, in "TraySetIcon". But what's needed is to ahve the icon disappear while it goes into wait mode for 10 minutes, then pop back into the systray while the script is working, that's what I can't seem to be able to do.

Here's the script as it stands now:

;
; AutoIt v3.0
;
#NoTrayIcon     ; AutoIt's icon doesn't show in systray
TraySetIcon(@ScriptDir & "\PUAC- CLOSE MSN Messenger (-snd) (loops).ico")


While 1

    ;===== Close MP3Radio.exe ======================================
    While ProcessExists ( "msmsgs.exe" )
        ProcessClose ( "msmsgs.exe" )
    WEnd
    ;===============================================================

Sleep (600000)     ; [10 minutes]  ...  Sleep for 60,000 units = 1 minute / 30,000=30 seconds / 15,000=15 seconds / 10,000=10 seconds / 5,000=5 seconds

WEnd

No matter where I end up inserting the "TraySetIcon", it either appears permanently, or not at all. So I ended up just sticking it back at the top.

I know that the process probably takes a blink of an eye, so I added a "Sleep(2500)" after the "TraySetIcon" during each test. But no matter what I do, the icon either always stays visible or doesn't appear at all in the systray.

Help!! :D

Share this post


Link to post
Share on other sites
monoceres

if you use Opt("TrayIconHide",0/1) then you can change how to trayicon is shown under execution :D


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
Diana (Cda)

Damn, damn, damn. Okay, still not getting this to work.

Thanks. A new term learned. I didn't know this code. I suspect it'll come in handy in future, _once_ I learn how to use it (esp. in While ... Wend situations).

Why isn't this working? I've put the codes every which place I can think of and although I haven't gotten errors yet, neither is it working. Here's the last test and where I put everything:

;
; AutoIt v3.0
;
;#NoTrayIcon     ; AutoIt's icon doesn't show in systray
Opt("TrayIconHide",0/1)


While 1
TraySetIcon(@ScriptDir & "\PUAC- CLOSE MSN Messenger (-snd) (loops).ico")

    ;===== MSN Messenger ============================================
    While ProcessExists ( "msmsgs.exe" )
        ProcessClose ( "msmsgs.exe" )
    WEnd
    ;================================================================

Sleep (180000)     ; [3minutes]  ...  Sleep for 60,000 units = 1 minute / 30,000=30 seconds / 15,000=15 seconds / 10,000=10 seconds / 5,000=5 seconds

WEnd
I put the "Opt("TrayIconHide",0/1)" at the top like this, and in other places, as well as changing where I put the "TraySetIcon" but still no go. In the case above, the icon shows in the systray all the time still <sigh>.

Anyway, thanks. :D

Share this post


Link to post
Share on other sites
monoceres

I wrote 1/0 because that's the options (1=show 0=hide)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
DaveF

This code:

TraySetIcon(@ScriptDir & "\PUAC- CLOSE MSN Messenger (-snd) (loops).ico")

...tells AutoIt to change the tray icon to whatever this icon file is, and so AutoIt takes it for granted that if the icon is hidden that you want to show it; with your script the way it is you're telling AutoIt to hide the tray icon at first and then immediately bring it back.


Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Share this post


Link to post
Share on other sites
Diana (Cda)

Okay, so _what_, then, can be done? I have a specific icon here and not the generic AI one which is why I'm using that particular syntax. How do I tell AI to use that icon but wink it out, then, pls in between while it's looping??

I know I know so little and the only difference between me and the average dumb user out on the street is that I continue to persevere. Call me stubborn or call me deteremined, whatever. I have come to the conclusion with AutoIt that most programming may be beyond me. Yet I can work with code once I know what it is and how to get a piece of code to work.

How can we make the above to function, pls, pls, pls????

Signed: "Frustrated as Hell, Over Here" :D

Share this post


Link to post
Share on other sites
Diana (Cda)

I wrote 1/0 because that's the options (1=show 0=hide)

Oh, just saw your message. Sorry, missed this. I looked this up in the help file and couldn't find it, so that's why I didn't know to change it. And in SciTE no prompts came up for this.

So, I changed to this:

Opt("TrayIconHide",0)     ;  options 0/1:  0 = hides, 1 = show

Still, I'm not getting this to work, so problem lies elsewhere.

Thanks.

Share this post


Link to post
Share on other sites
DaveF

When dealing with the AutoIt Opt options, the first parameter (the option name) is suggestive of what the option does ("TrayIconHide"). When you call the Opt function with a second parameter of 1 you're telling AutoIt "I want this option to apply" (hide the tray icon).

Example:

Dim $count

For $count = 1 To 10
    If Mod($count, 2) Then
        TraySetIcon(@SystemDir & "\shell32.dll", 13)
    Else
        TraySetIcon()
        Opt("TrayIconHide",1)
    EndIf
    Sleep(1000)
Next

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.