Ich bin recht neu was AHK angeht und suche mir so ziemlich alles in Google zusammen, was ich brauche an Funktionen usw.
Nun bin ich aber auf ein Problem gestoßen dass ich mit Google bisher nicht lösen konnte.
Aktuell möchte ich in meinem Hauptscript einen weiteren Button hinzufügen, dieser sortiert 25 Wörter zufällig und gibt diese dann in einem 5x5 Feld aus.
Ein weiterer Knopf soll später das 5x5 Feld in einen Code einbinden und als Datei exportieren.
Code: Select all
Gui, Font, norm
Gui, Add, Edit, R5 ReadOnly y25 x8 w380 vMyEdit
Gui, Add, Button, y100 x8 w190 h40 gRando, Be Random!
Gui, Add, Button, y100 x198 w190 h40 gSave, Save
Gui, Font, norm
Gui, Show
return
Guiclose:
exitapp
Rando:
MyVar = "powder","lift1","book","byrna","ocarina","icerod","boomerang","somaria","quake","shovel","ether","flippers","bow","mushroom","bombos","firerod","hammer","cape","lamp","boots","silvers","net","pearl","mirror","hookshot"
Sort, MyVar, Random D,
GuiControl,, MyEdit,
(
[ %MyVar%, "", "", "", "" ]
[ "", "", "", "", "" ]
[ "", "", "", "", "" ]
[ "", "", "", "", "" ]
[ "", "", "", "", "" ]
)
return
Save:
FileSelectFile, SelectedFile, S3, , Save
FileDelete, %SelectedFile%
FileAppend,
(
{
"type": "array",
"background": "#ff00ff",
"margin": "0",
"content": [
{
"type": "array",
"dropshadow": false,
"orientation": "vertical",
"content": [
{
"type": "itemgrid",
"h_alignment": "center",
"item_margin": "1,2.5",
"item_size": 42,
"rows": [
[ "", "towerofhera", "", "skullwoods", "", "turtlerock" ],
[ "", "aga", "", "thievestown", "", "palaceofdarkness" ],
[ "desertpalace", "", "easternpalace", "miserymire", "swamppalace", "icepalace" ],
[ "gomode" ],
[ "sword", "shield", "", "armor", "bottle" ],
[ "" ],
[ %MyVar% ],
[ "" ],
[ "" ],
[ "" ],
[ "" ]
]
},
{
"type": "container",
"margin": "0,5,0,0",
"content": {
"type": "recentpins",
"h_alignment": "stretch",
"v_alignment": "center",
"orientation": "vertical",
"compact": true,
"num_items": 2
}
}
]
}
]
}
), %SelectedFile%
return
EDIT: Das Script ist soweit fertig, auch zum Speichern des Codes. Das einzige was noch nicht funktioniert ist aus %MyVar% die 25 Wörter gezielt einzeln rauszufiltern, um sie an die richtigen Stellen im Code einzubinden. (Code aktualisiert)
Hoffe mir kann jemand helfen.
Grüße,
Sora-MMK