Gui DropDownList help, Add Run to specific Labels

Get help with using AutoHotkey and its commands and hotkeys
capioj
Posts: 3
Joined: 19 Jan 2018, 01:30

Gui DropDownList help, Add Run to specific Labels

22 Jan 2018, 23:26

Hello guys,

I'm stuck with adding a Run command with each Label in the ListofStates list.

For example:
- When open dropdownlist, I choose Alabama - AL, it will run a page with Alabama info.
- When I choose California - CA from the DropDownList, it will run a page with California - Info
etc.

I want to add each page for each state in the list but I don't know how and couldn't find anything online.

Please help!

Here is my Gui code:

#SingleInstance, Force

ListofStates:="ALABAMA - AL|ALASKA - AK|ARIZONA - AZ|ARKANSAS - AR|CALIFORNIA - CA|COLORADO - CO|CONNECTICUT - CT|DELAWARE - DE|DISTRICT OF COLUMBIA - DC|FLORIDA - FL|GEORGIA - GA|GUAM - GU|HAWAII - HI|IDAHO - ID|ILLINOIS - IL|INDIANA - IN|IOWA - IA|KANSAS - KS|KENTUCKY - KY|LOUISIANA - LA|MAINE - ME|MARYLAND - MD|MASSACHUSETTS - MA|MICHIGAN - MI|MINNESOTA - MN|MISSISSIPPI - MS|MISSOURI - MO|MONTANA - MT|NEBRASKA - NE|NEVADA - NV|NEW HAMPSHIRE - NH|NEW JERSEY - NJ|NEW MEXICO - NM|NEW YORK - NY|NORTH CAROLINA - NC|NORTH DAKOTA - ND|OHIO - OH|OKLAHOMA - OK|OREGON - OR|PENNSYLVANIA - PA|PUERTO RICO - PR|RHODE ISLAND - RI|SOUTH CAROLINA - SC|SOUTH DAKOTA - SD|TENNESSEE - TN|TEXAS - TX|UTAH - UT|VERMONT - VT|VIRGIN ISLANDS - VI|VIRGINIA - VA|WASHINGTON - WA|WEST VIRGINIA - WV|WISCONSIN - WI|WYOMING - WY|"

Gui, +AlwaysOnTop

Gui, +Resize

Gui, Color, White

Gui, Show, x1100 y30 w500 h500, States Info

Gui, Font, cBlack

Gui, Add, Text, x10 y10, States Information

Gui, Add, Button, x63 y30 gC_Db_History, DB History

Gui, Add, Button, x123 y30 gC_Db_Population, DB State Population

Gui, Add, Button, x201 y30 gC_Db_Place_To_Visit, DB Place to Go

Gui, Add, DropDownList, xm w200 h40 vStates +R50,% ListofStates
return

C_Db_History:
Run, https://www.50states.com/, Maximize
return

C_Db_Population:
Run, http://www.enchantedlearning.com/usa/st ... tion.shtml, Maximize
return

Db_Place_To_Visit:
Run, Chttp://www.travelchannel.com/destinati ... -landmarks, Maximize
return

ESC::ExitApp
return
BoBo
Posts: 2515
Joined: 13 May 2014, 17:15

Re: Gui DropDownList help, Add Run to specific Labels

23 Jan 2018, 00:00

Code: [Select all] [Download] GeSHi © Codebox Plus

Run, Chttp://www.travelchannel.com/destinations/us/photos/50-states-50-landmarks, Maximize
This line contains a typo ...+ you've to check out :arrow: Gui, Submit
User avatar
divanebaba
Posts: 626
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: Gui DropDownList help, Add Run to specific Labels

23 Jan 2018, 00:23

You could make a list with states and websites together. With parsing this list, you can get the list for your DDL.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Your DDL needs a gLabel:

Code: [Select all] [Download] GeSHi © Codebox Plus

Gui, Add, DropDownList, xm w200 h40 vStates +R50 gStatesLabel,% ListofStates
Then, after choosing your state with the DDL, you have to parse again to find the state you have choosen with your DDL.

Code: [Select all] [Download] GeSHi © Codebox Plus

StatesLabel:
GuiControlGet, myStates,, States
Loop, parse, ListOfAll, `n, `r
{
ifinstring, A_LoopField, %myStates%
...
}
return
This is a possible way.

[Starklichtbirne IQ >> 250!!] Dank deutscher Lehrerempfehlung, nur Süperdepp und Hartz4-Bezieher, statt Abitürient und Einkommensbezieher.
[Strong light bulb IQ >> 250!!] Thanks to german teacher's recommendation, willful and welfare recipient, instead of high school graduate and moneymaker.

Entering high school for foreign children is not prohibited in GERMANY, it's only made nearly impossible by government.
Virtually the only way - visiting high school abroad.
BoBo
Posts: 2515
Joined: 13 May 2014, 17:15

Re: Gui DropDownList help, Add Run to specific Labels

23 Jan 2018, 01:14

divanebaba wrote:You could make a list with states and websites together. With parsing this list, you can get the list for your DDL.
Warum dann nicht gleich ein array?
Your DDL needs a gLabel
Nicht zwingend. Denn der variableninhalt der DDL ist auch ohne eigene sprungmarke abfragbar.
Then, after choosing your state with the DDL, you have to parse again to find the state you have choosen with your DDL.
Nö. Die variable 'States' sollte doch bereits den ausgewählten eintrag enthalten
User avatar
divanebaba
Posts: 626
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: Gui DropDownList help, Add Run to specific Labels

23 Jan 2018, 01:55

divanebaba wrote:
BoBo wrote:
divanebaba wrote:
BoBo wrote:
divanebaba wrote:You could make a list with states and websites together. With parsing this list, you can get the list for your DDL.
Warum dann nicht gleich ein array?
[Why not an array right away?]

Wer bei einer solchen Aufgabenstellung ins Schleudern gerät, wird bei Arrays bestimmt umfallen.
[Whoever gets into a spin with such a task will definitely fall over with arrays.]

Your DDL needs a gLabel
Nicht zwingend. Denn der variableninhalt der DDL ist auch ohne eigene sprungmarke abfragbar.
[Not necessarily. Because the variable contents of the DDL can also be queried without its own jump mark.]

Aber zwingend nach der Aufgabenstellung: "When open dropdownlist, I choose Alabama - AL, it will run a page with Alabama info"
[But mandatory according to the task: "When open dropdownlist, I choose Alabama - AL, it will run a page with Alabama info"]

Then, after choosing your state with the DDL, you have to parse again to find the state you have choosen with your DDL.
Nö. Die variable 'States' sollte doch bereits den ausgewählten eintrag enthalten
[Nope. The variable 'States' should already contain the selected entry.]

Sie ist aber nicht enthalten. Jetzt komme ich mir vor wie ein AUDI-Manager. Die Physik sagt, es geht nicht, der Vorgesetzte will (kann) davon nichts wissen.
[It is not included. Now I feel like an AUDI manager. Physics says it can not be done, the supervisor does not want to know (better: isn't able not know) about it.]
... gähn ... :mrgreen: :mrgreen:

Blue font -> BoBo [Translation into english by divanebaba - Google Translator]
Black and green -> divanebobo divanebaba

[Starklichtbirne IQ >> 250!!] Dank deutscher Lehrerempfehlung, nur Süperdepp und Hartz4-Bezieher, statt Abitürient und Einkommensbezieher.
[Strong light bulb IQ >> 250!!] Thanks to german teacher's recommendation, willful and welfare recipient, instead of high school graduate and moneymaker.

Entering high school for foreign children is not prohibited in GERMANY, it's only made nearly impossible by government.
Virtually the only way - visiting high school abroad.

Return to “Ask For Help”

Who is online

Users browsing this forum: Flipeador, Itzdlg, lp230889 and 21 guests