Generating part of a variable Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Draken
Posts: 361
Joined: 08 Dec 2022, 01:19

Generating part of a variable

27 Apr 2024, 06:11

Hello, I tried to find it in the documentation, but unfortunately. I want to generate part of a variable in the Update_Gui function, so I don't have to have a separate line of code for each Edit, if that's even possible. Thank you.

Code: Select all

#Requires AutoHotkey v2.0

FFB := [
    {var1: "65", var2: "100", var3: "100", var4: "100", var5: "100", var6: "900"},
    {var1: "75", var2: "100", var3: "100", var4: "0", var5: "0", var6: "900"},
    {var1: "75", var2: "100", var3: "100", var4: "0", var5: "0", var6: "900"},
    {var1: "75", var2: "100", var3: "100", var4: "25", var5: "25", var6: "300"},
    {var1: "75", var2: "100", var3: "100", var4: "25", var5: "25", var6: "900"},
    {var1: "75", var2: "100", var3: "100", var4: "25", var5: "25", var6: "1080"}
]

Game1N := "Assetto Corsa"
Game2N := "Assetto Corsa Competizione"
Game3N := "Dirt Rally 2.0"
Game4N := "Project Cars 2"
Game5N := "RaceRoom Racing Experience"

GameList := ["Default", Game1N, Game2N, Game3N, Game4N, Game5N]

Gui1 := Gui()
Gui1.SetFont("s12", "Calibri")
Gui1.AddDropDownList("Choose2 vDDL", GameList).OnEvent("Change", Update_Gui)
Gui1.AddEdit("xp y+10 wp vEdit1", )
Gui1.AddEdit("xp y+10 wp vEdit2", )
Gui1.AddEdit("xp y+10 wp vEdit3", )
Gui1.AddEdit("xp y+10 wp vEdit4", )
Gui1.AddEdit("xp y+10 wp vEdit5", )
Gui1.AddEdit("xp y+10 wp vEdit6", )
Gui1.Show()
Update_Gui()
return

Update_Gui(*){
    loop 6{
        Gui1["Edit" A_Index].Value := FFB[Gui1["DDL"].Value].var A_Index ;Gui1["Edit" A_Index].Value := FFB[Gui1["DDL"].Value].var1
    }
}
User avatar
boiler
Posts: 17706
Joined: 21 Dec 2014, 02:44

Re: Generating part of a variable  Topic is solved

27 Apr 2024, 08:03

Code: Select all

#Requires AutoHotkey v2.0

FFB := [
    {var1: "65", var2: "100", var3: "100", var4: "100", var5: "100", var6: "900"},
    {var1: "75", var2: "100", var3: "100", var4: "0", var5: "0", var6: "900"},
    {var1: "75", var2: "100", var3: "100", var4: "0", var5: "0", var6: "900"},
    {var1: "75", var2: "100", var3: "100", var4: "25", var5: "25", var6: "300"},
    {var1: "75", var2: "100", var3: "100", var4: "25", var5: "25", var6: "900"},
    {var1: "75", var2: "100", var3: "100", var4: "25", var5: "25", var6: "1080"}
]

Game1N := "Assetto Corsa"
Game2N := "Assetto Corsa Competizione"
Game3N := "Dirt Rally 2.0"
Game4N := "Project Cars 2"
Game5N := "RaceRoom Racing Experience"

GameList := ["Default", Game1N, Game2N, Game3N, Game4N, Game5N]

Gui1 := Gui()
Gui1.SetFont("s12", "Calibri")
Gui1.AddDropDownList("Choose2 vDDL", GameList).OnEvent("Change", Update_Gui)
loop 6
	Gui1.AddEdit("xp y+10 wp vEdit" A_Index)
Gui1.Show()
Update_Gui()
return

Update_Gui(*){
    loop 6
        Gui1["Edit" A_Index].Value := FFB[Gui1["DDL"].Value].%'var' A_Index%
}

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: boardtc, DavidP and 52 guests