简体   繁体   中英

How do I retrieve the filename of the current script in AutoHotkey?

I would like to retrieve the filename of the currently running script in AutoHotkey and save it to a variable.

For example, if my script were named sample-script.ahk , I would like to display a message saying " The current script is sample-script.ahk ".

How do I retrieve the filename of the currently active script in AutoHotkey?

Use: A_ScriptName The filename of the current script, without its path, eg MyScript.ahk.

MsgBox, The current script is %A_ScriptName%

See: https://autohotkey.com/docs/Variables.htm#BuiltIn

and more particularly, https://autohotkey.com/docs/Variables.htm#ScriptName

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM