{SLVED} error with musedrag script activated by a dropdown list Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Tactical Shrimp
Posts: 31
Joined: 11 Nov 2015, 22:29

{SLVED} error with musedrag script activated by a dropdown list

08 Jul 2016, 22:27

Code: Select all

Gui, Add, DropDownList, x-8 y0 w370 h50 ,Solstice||Pulsar C||Orion||
Gui, Show, x356 y116 h452 w373, New GUI Window
Return
#SingleInstance, Force
 
 
GuiClose:
ExitApp
 

DDL_Changed:
Gui,Submit,Nohide
If (DDL_Text = "Solstice")
{
	Hotkey,~LButton,LButton,On
}
else
	Hotkey,~LButton,LButton,Off
return

LButton:
while(GetKeyState("LButton"))
{
	MouseMove,10,10,,R
}
return
so when the dropdown has Solstice selected i would like a script to activate that drags the mouse while lmousbutten is held the end result is to have each dropdown item different scripts with different movements
however this script doesnt work even for just Solstice
Last edited by Tactical Shrimp on 09 Jul 2016, 10:19, edited 1 time in total.
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: error with musedrag script activated by a dropdown list

09 Jul 2016, 03:31

You don't have the variable DDL_Text defined anywhere in your code. It will contain an empty string, and never be equal to "Solstice", so your hotkey is always off.

Also you have not assigned the Label DDL_Changed to be called by the DropDown control.
Tactical Shrimp
Posts: 31
Joined: 11 Nov 2015, 22:29

Re: error with musedrag script activated by a dropdown list

09 Jul 2016, 09:26

so i need to add somthing like

Code: Select all

string DDL_Test = "randomefillersoprogramdoesntcrashifthisisneccisary"
i had somthing like this however i was told to delete the variable but how can i asign the variablw to that particular dropdown list is there an option i need to add to the gui add line or somthing thanks for the help though
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: error with musedrag script activated by a dropdown list

09 Jul 2016, 09:42

Tactical Shrimp wrote:... how can i asign the variablw to that particular dropdown list is there an option i need to add to the gui add line or somthing thanks for the help though
To assign a variable to a DropDown control use vVarName.
To assign a label to a DropDown control use gLabelName.

Please compare to my example in your previous thread

Code: Select all

...
Gui, Add, DropDownList, w200 vDDL1_Text gDDL1_Changed, Solstice|Pulsar C|Orion
Gui, Add, DropDownList, w200 vDDL2_Text gDDL2_Changed, Example|Stuff|Test
...
Tactical Shrimp
Posts: 31
Joined: 11 Nov 2015, 22:29

Re: error with musedrag script activated by a dropdown list

09 Jul 2016, 09:47

oh i see it now thank you im sorry im not used to this code language I do c++ and am not sure what ahk is most similar to
Tactical Shrimp
Posts: 31
Joined: 11 Nov 2015, 22:29

Re: error with musedrag script activated by a dropdown list

09 Jul 2016, 09:54

Code: Select all

Gui, Add, DropDownList, w370 vDDL_Text gDDL_Changed, Solstice|Pulsar C|Orion
Gui, Show, x356 y116 h452 w373, New GUI Window
Return
#SingleInstance, Force
 
 string DDL_Changed;
 
GuiClose:
ExitApp
 
 
DDL_Changed:
{
	if (){
		
		
		
	}
	else if(){
		
	
	
	}
	
	
	
	
	
}
so i have this can i use a switch statement as i have lots of things to put in this DDL
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: error with musedrag script activated by a dropdown list  Topic is solved

09 Jul 2016, 10:07

The braces are not needed for the DDL_Changed: routine, but it needs a Return command.

There is no Switch statement in AHK.
There are many ways to achieve the goal that a Switch statement would achieve, e.g. cascading If - Else If - Else statements.
Like you already have there.
Tactical Shrimp
Posts: 31
Joined: 11 Nov 2015, 22:29

Re: error with musedrag script activated by a dropdown list

09 Jul 2016, 10:18

alright thats a shame switch statements are the best :( however i have implemented the code and it works great thank you everyone who helped me out this seems like C if anything which is a meh language

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, Mateusz53, peter_ahk, Rohwedder and 173 guests