i want to use this so i can make different states for my settings gui (i made some gLabels for setup 2 but i use much more in the real gui), the problem i have is that initially when my coordinates get saved it is still in a split state (separated x and y) but when i load a new set in my variables they are combined so i need to split them and then also save them in the original format as a ini file
the below is just the parts of code related to my problem this code will not run as intended i hope you get the idea it has all the parts used and on the bottom above the ini file content an example of the part i have in other gui
any pointers or help would be appreciated spend a couple days trying things and i think it is above me thank you
Code: Select all
; Settings GUI
#SingleInstance, Force
Gui,+AlwaysOnTop
Gui, Margin, 0, 0
; in my settings gui i have this from button 1 to button 78
Gui, Add, Button, x10 y10 w100 h22 vButton1 gGetCoord, BlaBla Coordinate this
Gui, Add, Edit, x112 y10 w100 h22 vCoord1 readonly
; + 76 more vButton3 + vCoord3, vButton4 + vCoord4 and so on
Gui, Add, Button, x10 y34 w100 h22 vButton78 gGetCoord, BlaBla Coordinate that
Gui, Add, Edit, x112 y34 w100 h22 vCoord78 readonly
Gui, Add, Button, x10 y58 w100 h22 gSaveSetup1, Save Setup 1
Gui, Add, Button, x10 y82 w100 h22 gReloadGUI, Reload
Gui, Add, Button, x10 y106 w100 h22 gSaveSetup2, Save Setup 2
Gui, Add, Button, x10 y82 w100 h22 gLoadSetup2, Load Setup 2
; i read the set in like this on startup in my settings gui but also use this in other gui in another way (see bottom)
; where the settings apply for a click function, the gui this is in is a one in all settings tool for all my other gui
Loop 78
{
Button := "Button" A_Index
IniRead X, Settings/Coordinates_Set1.ini, X_Coord, Coord%A_Index%, %A_Space%
IniRead Y, Settings/Coordinates_Set1.ini, Y_Coord, Coord%A_Index%, %A_Space%
If (X And Y)
GuiControl , , Coord%A_Index%, %X%`, %Y%
}
; i can see the coordinates on my vCoord* edit boxes, it saved it to ini file the moment i got them (GetCoord + Ctrl)
Gui, Submit, NoHide
Gui, Show, w921 h490
Return
GetCoord:
CoordTmp := SubStr(A_GuiControl, 7)
Tooltip , 1 -Hover Over The Location You Want To Save.`n2 - Press CTRL To Save The Location To File.
Return
CTRL::
If (CoordTmp)
{
ToolTip,
MouseGetPos X, Y
GuiControl , , Coord%CoordTmp%, %X%`, %Y%
IniWrite %X%, Settings/Coordinates_Set1.ini, X_Coord, Coord%CoordTmp%
IniWrite %Y%, Settings/Coordinates_Set1.ini, Y_Coord, Coord%CoordTmp%
}
Return
; now i also want the option to switch settings and for that i need to write all current coordinates from all 78 buttons
; to a new ini file with the same structure in gSaveSetup2 but i do not know how to write Coord1 up to Coord78
; in one go while also splitting it in x and y because at this point they are merged into (x, y) in my edit box
; so i would need to split them in x and y again but how?
SaveSetup2:
return
; after loading this i would need to save as setup 1 again after the loop in gLoadSetup2 because 1 will always be
; the setup that loads on startup or a reload but that is the same solution as what i need on SaveSetup2 just a different ini name
LoadSetup2:
Loop 78
{
Button := "Button" A_Index
IniRead X, Settings/Coordinates_Set2.ini, X_Coord, Coord%A_Index%, %A_Space%
IniRead Y, Settings/Coordinates_Set2.ini, Y_Coord, Coord%A_Index%, %A_Space%
If (X And Y)
GuiControl , , Coord%A_Index%, %X%`, %Y%
}
GoSub, SaveSetup1
return
SaveSetup1:
; save as Settings/Coordinates_Set1.ini here
return
ReloadGUI:
Reload
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end settings gui stuff ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; in other gui i have this ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#SingleInstance, Force
Coordmode,mouse,screen
SetDefaultMouseSpeed, 0
global Positions := []
loop, 78
{
xvalue:=""
yvalue:=""
IniRead,xvalue,Settings/Coordinates_Set1.ini,X_Coord,Coord%A_Index%
IniRead,yvalue,Settings/Coordinates_Set1.ini,Y_Coord,Coord%A_Index%
Positions[A_Index]:= {X: xvalue , Y: yvalue }
}
To_Perform_A_Action_Using_These_Coordinates_Example:
MouseGetPos CurX, CurY
Click_Function(Positions[1].x,Positions[1].y)
Click_Function(Positions[78].x,Positions[78].y)
MouseMove %CurX%, %CurY% ,0
return
Click_Function(input_x,input_y){
Click,%input_x% , %input_y%
}
/* The content of my ini file looks like this
[X_Coord]
Coord1=25
Coord2=1082
Coord3=1080
Coord4=1082
Coord5=1078
Coord6=1072
Coord7=1066
Coord8=1055
Coord9=1048
Coord10=1049
Coord11=1049
Coord12=1045
Coord13=1047
Coord14=1047
Coord15=1050
Coord16=1370
Coord17=1363
Coord18=1347
Coord19=1323
Coord20=1318
Coord21=1318
Coord22=1323
Coord23=1321
Coord24=1320
Coord25=1323
Coord26=1323
Coord27=791
Coord28=778
Coord29=771
Coord30=771
Coord31=812
Coord32=820
Coord33=1114
Coord34=1113
Coord35=1390
Coord36=1415
Coord37=1647
Coord38=1653
Coord39=814
Coord40=813
Coord41=811
Coord42=1098
Coord43=1115
Coord44=1114
Coord45=1378
Coord46=1370
Coord47=1376
Coord48=1652
Coord49=1661
Coord50=1656
Coord51=801
Coord52=802
Coord53=813
Coord54=810
Coord55=1112
Coord56=1114
Coord57=1114
Coord58=1109
Coord59=837
Coord60=815
Coord61=799
Coord62=805
Coord63=799
Coord64=794
Coord65=1357
Coord66=1368
Coord67=1367
Coord68=1359
Coord69=1650
Coord70=1662
Coord71=1661
Coord72=1641
Coord73=1386
Coord74=1385
Coord75=1400
Coord76=1398
Coord77=1396
Coord78=1391
[Y_Coord]
Coord1=43
Coord2=352
Coord3=373
Coord4=410
Coord5=436
Coord6=478
Coord7=491
Coord8=526
Coord9=570
Coord10=586
Coord11=623
Coord12=664
Coord13=689
Coord14=720
Coord15=751
Coord16=332
Coord17=349
Coord18=382
Coord19=436
Coord20=480
Coord21=501
Coord22=525
Coord23=563
Coord24=596
Coord25=618
Coord26=638
Coord27=358
Coord28=412
Coord29=451
Coord30=454
Coord31=281
Coord32=318
Coord33=264
Coord34=287
Coord35=267
Coord36=311
Coord37=257
Coord38=279
Coord39=436
Coord40=451
Coord41=465
Coord42=408
Coord43=398
Coord44=461
Coord45=424
Coord46=455
Coord47=492
Coord48=397
Coord49=439
Coord50=462
Coord51=628
Coord52=644
Coord53=677
Coord54=673
Coord55=593
Coord56=613
Coord57=644
Coord58=674
Coord59=265
Coord60=365
Coord61=454
Coord62=525
Coord63=615
Coord64=678
Coord65=630
Coord66=627
Coord67=634
Coord68=686
Coord69=571
Coord70=614
Coord71=639
Coord72=677
Coord73=276
Coord74=292
Coord75=411
Coord76=480
Coord77=571
Coord78=614
*/