Msgbox syntax help

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
pgeugene
Posts: 34
Joined: 27 Jun 2019, 04:36

Msgbox syntax help

Post by pgeugene » 19 Apr 2024, 05:50

Code: Select all

MsgBox("'A_ScriptName' 'updated'", "Notice", "T1")
I am trying to use A_ScriptName variable in Msgbox to show the script name as text
But below is the wrong result
image.png
(4.04 KiB) Downloaded 42 times

gregster
Posts: 9073
Joined: 30 Sep 2013, 06:48

Re: Msgbox syntax help

Post by gregster » 19 Apr 2024, 06:01

In expressions, which you have a lot in v2, you should only quote strings (literal text) - but if you want to evaluate a variable, you shouldn't quote its name.

Code: Select all

MsgBox(A_ScriptName " updated", "Notice", "T1")
Btw, that's a general rule for expressions and not specific to msgboxes.
See also: concatenations in expressions

Post Reply

Return to “Ask for Help (v2)”