Hi. I am trying to have a toggle function using WheelUp and WheelDo
The following script is the best I can come up with so far, and just does nothing. Please help.
Toggle Script Not Working (Warning: Non-Coder)
Toggle Script Not Working (Warning: Non-Coder)
Last edited by blad4 on 30 Apr 2017, 15:25, edited 1 time in total.
Re: Toggle Script Not Working (Warning: Non-Coder)
Well, for a non-coder, you have come up with some very clever syntax! I really like your use of ++index and --index in the if statements to create a bounded range for the value of index.
Looking it over, the only thing that jumps out at me is that I'm not sure why you made MessageList a two-dimensional array? Wouldn't it make more sense to just do static MessageLife := [1, 2, 3, 4] and then reference MessageList[Index]?
Also, SendMessage itself is kinda outside my area of expertise, but have you tested the SendMessage commands on their own to make sure they work as written?
Looking it over, the only thing that jumps out at me is that I'm not sure why you made MessageList a two-dimensional array? Wouldn't it make more sense to just do static MessageLife := [1, 2, 3, 4] and then reference MessageList[Index]?
Also, SendMessage itself is kinda outside my area of expertise, but have you tested the SendMessage commands on their own to make sure they work as written?
Re: Toggle Script Not Working (Warning: Non-Coder)
I am not able to read excecly what you want to do. Let me get this clear, You want:
- Select a message number with the WheelUp and WheelDown.
- Send the message by pressing E and disable the WheelDown/Up hotkeys so they can be used normaly again?
I did not test your SendMessage command, the rest seems to work as I expect.
About the ‘sequence:’ label: This line is not doing anything at the moment, maybe this is the part where the code does something you don't want. What should be the function of the this label?
- Select a message number with the WheelUp and WheelDown.
- Send the message by pressing E and disable the WheelDown/Up hotkeys so they can be used normaly again?
I did not test your SendMessage command, the rest seems to work as I expect.
About the ‘sequence:’ label: This line is not doing anything at the moment, maybe this is the part where the code does something you don't want. What should be the function of the this label?
Re: Toggle Script Not Working (Warning: Non-Coder)
Your sendmessage 3rd parameter is a 0 in the function and in your post you want it to be a 1?
Re: Toggle Script Not Working (Warning: Non-Coder)
I take no credit whatsoever for any 'syntax' ! Thanks to the amazing people like kon, dyatactic et al I just cut and paste things together. They are the clever coders here!MaxAstro wrote:Well, for a non-coder, you have come up with some very clever syntax! I really like your use of ++index and --index in the if statements to create a bounded range for the value of index.
Looking it over, the only thing that jumps out at me is that I'm not sure why you made MessageList a two-dimensional array? Wouldn't it make more sense to just do static MessageLife := [1, 2, 3, 4] and then reference MessageList[Index]?
Also, SendMessage itself is kinda outside my area of expertise, but have you tested the SendMessage commands on their own to make sure they work as written?
Re: Toggle Script Not Working (Warning: Non-Coder)
Thank you, correct! I'm not sure why it is a 0Xtra wrote:Your sendmessage 3rd parameter is a 0 in the function and in your post you want it to be a 1?
Re: Toggle Script Not Working (Warning: Non-Coder)
Yep so this was taken from a time script which had me interrupting the timer with a similar toggle. Now I am just trying to adapt it to a toggle only, with no timer function.DyaTactic wrote:I am not able to read excecly what you want to do. Let me get this clear, You want:
- Select a message number with the WheelUp and WheelDown.
- Send the message by pressing E and disable the WheelDown/Up hotkeys so they can be used normaly again?
I did not test your SendMessage command, the rest seems to work as I expect.
About the ‘sequence:’ label: This line is not doing anything at the moment, maybe this is the part where the code does something you don't want. What should be the function of the this label?
This is also linked to the pressing of E. In the original script E was pressed to begin the timer, aka sequence. Now it is not needed but I was reading the code as if E needs to still be pressed in order to activate the WheelUp/Down toggle!
So really all I want to do is what you said in the first point, which was 'Select a message number with the WheelUp and WheelDown.'
And this is always 1,2,3 or 4. If WheelDown then -1, if WheelUp then +1. If we are at 1, then -1 is 4. If we're at 4, then +1 is 1 etc
Re: Toggle Script Not Working (Warning: Non-Coder)
Yep I use these SendMessage commands already so they work, luckily! Regarding the two-dimensional array, this must be because in the script I am cutting from, we had INdex 1 and Index 2. Therefore, is this what you mean?:MaxAstro wrote:Well, for a non-coder, you have come up with some very clever syntax! I really like your use of ++index and --index in the if statements to create a bounded range for the value of index.
Looking it over, the only thing that jumps out at me is that I'm not sure why you made MessageList a two-dimensional array? Wouldn't it make more sense to just do static MessageLife := [1, 2, 3, 4] and then reference MessageList[Index]?
Also, SendMessage itself is kinda outside my area of expertise, but have you tested the SendMessage commands on their own to make sure they work as written?
Code: Select all
static MessageList := [1, 2, 3, 4]
Code: Select all
static MessageList := [[1], [2], [3], [4]]
Also I have utilised the WheelOnOff functions incorrectly, and now my #IfWinActive has stopped working. That is to say the hotkeys are working all over the place, regardless of which window is open.
Re: Toggle Script Not Working (Warning: Non-Coder)
I have rewritten your code. Now pressing E toggles the ScrollWheelhotkeys On (they are already On on startup). You can select an Index (made a nice tooltip indicating which is selected) by scrolling. Press E again to Execute the SendMessage and disable the ScrollWheelhotkeys.
Pressing E again enables the scrollhotkeyskeys etc...
Is this what you seached for?
Personaly I would make pressing E enable the scrollkeys and releasing E execute the SendMessage with the index chosen when E was held down. Tell me if you need any help.
Pressing E again enables the scrollhotkeyskeys etc...
Is this what you seached for?
Code: Select all
index := 0
ToggleVar := 0
e::
If ToggleVar
{
ToggleVar := 0
WheelOnOff("Off")
CustomMessage(++index)
} Else {
ToggleVar := 1
WheelOnOff("On")
}
Return
#If ; When using IfWinActive here, the hotkey commands in the function need this ‘Hotkey, IfWinActive’ command two.
WheelUp::
if (++index > 3) ; Add one to Index and check it's upper boundry.
index := 3
ToolTip, % Index + 1
SetTimer, ToolTipOff, -1000 ; Hide the tooltip after 1000ms (minus means once, not again every second.)
return
WheelDown::
if (--index < 0) ; Substract one from Index and check it's bottom boundry.
index := 0
ToolTip, % Index + 1
SetTimer, ToolTipOff, -1000 ; Hide the tooltip after 1000ms (minus means once, not again every second.)
return
ToolTipOff:
ToolTip
Return
WheelOnOff(State := "Off")
{
Hotkey, WheelUp, %State%
Hotkey, WheelDown, %State%
}
CustomMessage(Index)
{
static MessageList := [[1], [2], [3], [4]]
SendMessage, 0x1330, MessageList[Index, 1], 0, SysTabControl322, Sierra ;TCM_SETCURFOCUS = 0x1330
}
return
Re: Toggle Script Not Working (Warning: Non-Coder)
Thank you sir! What you wrote works fine except from when tooltip1 comes about and wheeldown is pressed, it does not go to 4. It just stays at one. And vice versa when trying to go from 4 to 1.
Last edited by blad4 on 30 Apr 2017, 15:26, edited 1 time in total.
Re: Toggle Script Not Working (Warning: Non-Coder)
It took some time to get what you ment. It sounded like something was wrong in the script.
I belive this is the change you asked for: If (index = 1) > WheelDown > Index becomes 4
And If (Index = 4) > WheelDown > Index becomes 1
See if this script fills your needs.
With the ‘#IfWinActive’ version you need a button or other condition on which to send the message. This could be the ToolTipOff label I see now.
I belive this is the change you asked for: If (index = 1) > WheelDown > Index becomes 4
And If (Index = 4) > WheelDown > Index becomes 1
See if this script fills your needs.
Code: Select all
index := 0
ToggleVar := 0
WheelUp::
if (++index > 3) ; Add one to Index and check it's upper boundry.
index := 0
ToolTip, % Index + 1
SetTimer, ToolTipOff, -1000 ; Hide the tooltip after 1000ms (minus means once, not again every second.)
return
WheelDown::
if (--index < 0) ; Substract one from Index and check it's bottom boundry.
index := 3
ToolTip, % Index + 1
SetTimer, ToolTipOff, -1000 ; Hide the tooltip after 1000ms (minus means once, not again every second.)
return
ToolTipOff:
ToolTip
Return
WheelOnOff(State := "Off")
{
Hotkey, WheelUp, %State%
Hotkey, WheelDown, %State%
}
CustomMessage(Index)
{
static MessageList := [[1], [2], [3], [4]]
SendMessage, 0x1330, MessageList[Index, 1], 0, SysTabControl322, Sierra ;TCM_SETCURFOCUS = 0x1330
}
return
Re: Toggle Script Not Working (Warning: Non-Coder)
Thanks so much man!
(And for the last one too )
(And for the last one too )