Global Variable Code Error

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
dgbt
Posts: 2
Joined: 26 May 2022, 13:32

Global Variable Code Error

Post by dgbt » 26 May 2022, 13:55

I am using if WinExist() and I am getting an error saying
Warning: this variable has not been assigned a value
specifically: CabinetWClass (a global variable)

what am I doing wrong?

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
;SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
;SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#singleinstance, force

SetTitleMatchMode, 2

if winexist(ahk_class CabinetWClass, "Work Orders")
{
	winclose
}
else
{
	run, "\\CCDTAFSW3P\DothanUtilities\ELECTRIC\JAMES CURTIS\Work Orders"
}

ExitApp
^#x::
ExitApp

RussF
Posts: 1269
Joined: 05 Aug 2021, 06:36

Re: Global Variable Code Error

Post by RussF » 26 May 2022, 14:23


dgbt
Posts: 2
Joined: 26 May 2022, 13:32

Re: Global Variable Code Error

Post by dgbt » 26 May 2022, 17:05

Gotcha. It's all supposed to be in quotes for the class... I'm new and there is just a lot of inconsistency with what needs quotes and what doesn't. Thanks for the help.

User avatar
boiler
Posts: 16962
Joined: 21 Dec 2014, 02:44

Re: Global Variable Code Error

Post by boiler » 26 May 2022, 17:37

dgbt wrote: I'm new and there is just a lot of inconsistency with what needs quotes and what doesn't.
That's typically the most confusing thing to those new to AHK. Study Expressions, Legacy Syntax, and Expressions vs Legacy Syntax.

Post Reply

Return to “Ask for Help (v1)”