Script error "Error: Can;t load icon."

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
gazmoz17
Posts: 72
Joined: 14 Mar 2018, 09:37

Script error "Error: Can;t load icon."

Post by gazmoz17 » 27 Sep 2022, 02:59

Hi,

How do I correct this script please?

Automate my task script error.PNG
Automate my task script error.PNG (32.61 KiB) Viewed 361 times

Many Thanks
Gareth

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Script error "Error: Can;t load icon."

Post by swagfag » 27 Sep 2022, 04:18

by not making up imaginary file extensions .iconfile

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

Re: Script error "Error: Can;t load icon."

Post by gregster » 27 Sep 2022, 12:54

I think this wasn't meant as a file extension, but the OP wants to access the associative array named script which we can also see in the error message, so my guess would be:

Code: Select all

Menu, Tray, Icon, % script.iconfile

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Script error "Error: Can;t load icon."

Post by swagfag » 27 Sep 2022, 13:59

in that case the error dialog doesnt make any sense. filepath-accepting command parameters shouldnt support expressions by default(and im pretty sure Menu tray, Icon in this case doesnt), and yet script.iconfile is not interpreted literally but dereferenced(ive just noticed). either the error dialog doesnt report %s that actually exist in the code or idk whats going on. ill have to add this to my evergrowing list of reasons not to use v1.. ever.

post the actual code. even so, u wont be able to debug the error since the only error reporting these icon functions do amounts to "it didnt work". ull have to either run the script under the visual studio debugger and step through ahk's source or u can try replicating the source with DllCalls and implement ur own error check. but most probably, its because the icon file doesnt exist(eg ur antivirus has already deleted it from appdata/roaming)

Post Reply

Return to “Ask for Help (v1)”