GUI script conversion request Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
LAPIII
Posts: 671
Joined: 01 Aug 2021, 06:01

GUI script conversion request

Post by LAPIII » 30 Sep 2023, 15:01

@Rohwedder had helped me write this:

Code: Select all

#SingleInstance, Force
Path = C:\Users\LPIII\OneDrive\Documents\AutoHotkey\AHK Scripts\Bookmark Manager
Gui, Add, Text, gLink1, PostImages
Gui, Show
Return

Link1:
Run, PostImages.ahk, %Path%
Return
I'm missing an Event:

Code: Select all

#SingleInstance Force
#Requires Autohotkey v2.0+
Path := "C:\Users\LPIII\OneDrive\Documents\AutoHotkey\AHK Scripts\Bookmark Manager"
myGui := Gui()
File1 := myGui.Add("Text", , "PostImages")
myGui.Show()
Return

User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: GUI script conversion request  Topic is solved

Post by mikeyww » 30 Sep 2023, 16:05

Code: Select all

#Requires AutoHotkey v2.0
gui1 := Gui(, 'Test'), gui1.SetFont('s10 underline')
gui1.AddText('w200 cBlue Center', 'Click this text').OnEvent('Click', txt_Click)
gui1.Show 'x400'

txt_Click(txt, info) {
 MsgBox 123
}

LAPIII
Posts: 671
Joined: 01 Aug 2021, 06:01

Re: GUI script conversion request

Post by LAPIII » 30 Sep 2023, 16:08

Thank you very much. This is so awesome!

LAPIII
Posts: 671
Joined: 01 Aug 2021, 06:01

Re: GUI script conversion request

Post by LAPIII » 30 Sep 2023, 16:24

Can you tell me why couldn't I change it to:

Code: Select all

#Requires AutoHotkey v2.0
myGui := Gui()
myGui.SetFont('s10 underline')
myGui.AddText('w200 cBlue Center', 'Click this text')
myGui.OnEvent('Click', txt_Click)
myGui.Show 'x400'

txt_Click(txt, info) {
 MsgBox 123
}
Last edited by LAPIII on 30 Sep 2023, 16:29, edited 1 time in total.

User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: GUI script conversion request

Post by mikeyww » 30 Sep 2023, 16:27

The object you want is the text control, not the GUI itself.

Code: Select all

#Requires AutoHotkey v2.0
myGui := Gui()
myGui.SetFont('s10 underline')
txt := myGui.AddText('w200 cBlue Center', 'Click this text')
txt.OnEvent('Click', txt_Click)
myGui.Show 'x400'

txt_Click(txt, info) {
 MsgBox 123
}

Post Reply

Return to “Ask for Help (v2)”