Sign in to follow this  
Followers 0
Possessed

Need some help with "Cases"

9 posts in this topic

Ok here is what I need help with. In the example below when I have a tray menu checked it will add the hot keys and everything is fine. But when I uncheck the hot keys are still in effect and the "case" is still running even when unchecked... So really all I want is when the tray icon is unchecked I want to disable or end the case thats running. I hope this makes sense to you guys. Thanks for the input.

Case $msg = $MusicS
            If TrayItemGetState($MusicS) = $TRAY_UNCHECKED + $TRAY_ENABLE Then
                TrayItemSetState($MusicS, $TRAY_CHECKED)
                $keyvar1 = IniRead("Handy_Tools Config.ini", "MusicKeys", "PlayMusic", "NotFound")
                $keyvar2 = IniRead("Handy_Tools Config.ini", "MusicKeys", "StopMusic", "NotFound")
                $keyvar3 = IniRead("Handy_Tools Config.ini", "MusicKeys", "NextMusic", "NotFound")
                $keyvar4 = IniRead("Handy_Tools Config.ini", "MusicKeys", "PreviousMusic", "NotFound")
                HotKeySet($keyvar1,"PaP")
                HotKeySet($keyvar2,"StopM")
                HotKeySet($keyvar3,"NextM")
                HotKeySet($keyvar4,"PreM")
            Else
                TrayItemSetState($MusicS, $TRAY_UNCHECKED)
                
            EndIf

Thanks again

-Possessed

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I'm not sure how you are setting up your GUI, but you need to use the GUICtrlRead() function. For example, if your checkbox is named $Check, then you could do this:

#include <GUIConstants.au3>

$Check = GUICtrlCreateCheckBox("hi")

$CheckCheck = GUICtrlRead($Check)

If $CheckCheck = $GUI_UNCHECKED Then
        ;put stuff here
EndIf

ElseIf $CheckCheck = $GUI_UNCHECKED Then
        ;put stuff here
EndIf

Sorry if that didn't make sense or diddn't help you... I tried my best. :whistle:

EDIT: Oh.. sorry. I misread your question.. I can't help you with that. =(

Edited by sandman

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites

Np man i should have said this program i am making is all tray icon based (right click or click on the tray icon to show a menu). so ya. thanks anyways man :whistle:

Share this post


Link to post
Share on other sites

Bump anyone ? help please?

Share this post


Link to post
Share on other sites

Bump anyone ? help please?

Bumping after 90 minutes is just way too early. Wait a couple of hours, or preferably at least a

day before bumping. Also, this isn't exactly the most busiest time of the day.

Share this post


Link to post
Share on other sites

Bumping after 90 minutes is just way too early. Wait a couple of hours, or preferably at least a

day before bumping. Also, this isn't exactly the most busiest time of the day.

Well if you must know i was on the 3rd page in that short time so chill out. all i want is some help.

Share this post


Link to post
Share on other sites

Well if you must know i was on the 3rd page in that short time so chill out. all i want is some help.

When you bump your topic another topic falls to the third page, so should that topic be bumped as well then,

or does that only count for you ? If you think it only counts for you then you're pretty selfish, or if it's the other

way around then then wouldn't that result in an endless spam-tournament where nobody is the winner ?

I don't know about the other folks here, but whenever I browse the forum I hit "View New Posts" which shows

all the new posts, including those on the third page (if any)... If I choose to not post in your topic, for whatever

reason that may exist, do you think I will think it's more important when it's on the first page where I then will

really try to help you out ? I think not. I will try to help you if I bother and if I can. If nobody post then that must

mean that the rest also think in the same way, meaning you should wait for others to log in to the forum. If you

haven't gotten any replies for a while then bump if you wish, but not after 90 minutes !

Btw, I was pretty chilled out if you must know. All I wanted was to inform you of how this forum works and how

most of the members here don't need a guy who bumps his topic after 90 short minutes. This time it happened to

be me who gave you this lesson, and btw.. If I wanted to say it in a more aggressive way then I would.

Hey, you know what...my post actually put your topic back on page 1 again now :whistle:

Share this post


Link to post
Share on other sites

Why don't you provide a working example scaled down model? We can only assume what you are asking (because it doesn't make much sense to me, and I'm only left to assume what you want).

Proper explanations, with working examples (by working I mean, I can put your code in SciTe and run it to see what the issue is), without us having to create a GUI ourselves to fix your problem also would get your answers quicker.

So based off my perception of what you are asking, I can only assume you are trying to disable the Hotkey for that keyword if it is unchecked:

Case $msg = $MusicS
            $keyvar1 = IniRead("Handy_Tools Config.ini", "MusicKeys", "PlayMusic", "NotFound")
            $keyvar2 = IniRead("Handy_Tools Config.ini", "MusicKeys", "StopMusic", "NotFound")
            $keyvar3 = IniRead("Handy_Tools Config.ini", "MusicKeys", "NextMusic", "NotFound")
            $keyvar4 = IniRead("Handy_Tools Config.ini", "MusicKeys", "PreviousMusic", "NotFound")
            If TrayItemGetState($MusicS) = $TRAY_UNCHECKED + $TRAY_ENABLE Then
                TrayItemSetState($MusicS, $TRAY_CHECKED)
                HotKeySet($keyvar1,"PaP")
                HotKeySet($keyvar2,"StopM")
                HotKeySet($keyvar3,"NextM")
                HotKeySet($keyvar4,"PreM")
            Else
                TrayItemSetState($MusicS, $TRAY_UNCHECKED)
                HotKeySet($keyvar1,"")
                HotKeySet($keyvar2,"")
                HotKeySet($keyvar3,"")
                HotKeySet($keyvar4,"")
            EndIf
If this isn't what you are looking for, then take the time to create a small scale workable example.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

When you bump your topic another topic falls to the third page, so should that topic be bumped as well then,

or does that only count for you ? If you think it only counts for you then you're pretty selfish, or if it's the other

way around then then wouldn't that result in an endless spam-tournament where nobody is the winner ?

I don't know about the other folks here, but whenever I browse the forum I hit "View New Posts" which shows

all the new posts, including those on the third page (if any)... If I choose to not post in your topic, for whatever

reason that may exist, do you think I will think it's more important when it's on the first page where I then will

really try to help you out ? I think not. I will try to help you if I bother and if I can. If nobody post then that must

mean that the rest also think in the same way, meaning you should wait for others to log in to the forum. If you

haven't gotten any replies for a while then bump if you wish, but not after 90 minutes !

Btw, I was pretty chilled out if you must know. All I wanted was to inform you of how this forum works and how

most of the members here don't need a guy who bumps his topic after 90 short minutes. This time it happened to

be me who gave you this lesson, and btw.. If I wanted to say it in a more aggressive way then I would.

Hey, you know what...my post actually put your topic back on page 1 again now :whistle:

Yo man whats your problem your nothing to these forums you have no admin or mod behind your name? if i want to bump my post who cares if the admin dont like it then he or she will talk to me or ban me what ever. Mind your own. And thank you i didnt see it right away but that what i am looking for thank you SmOke_N you have been a big help.

Edited by Possessed

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  
Followers 0