Jump to content

Need some help with "Cases"


Recommended Posts

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

Link to comment
Share on other sites

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]

Link to comment
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.

Link to comment
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:

Link to comment
Share on other sites

  • Moderators

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.

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.

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...