Problem with exe file

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Problem with exe file

Post by PuzzledGreatly » 29 May 2023, 17:25

A friend of mine used an exe file I had compiled and after a while the screen froze. I have OnError("OnErrorLog") near the top of my code and am using the OnError function like this:

Code: Select all

OnErrorLog(exception) 
{  
    FileAppend % A_YYYY "-" A_MM "-" A_DD A_tab "Error on line " exception.Line ": " exception.Message "`n"
        , errorlog.txt
    return true
}
The error my friend received was this:
2023-05-26 Error on line 3272: 0x800A004C -
Source: (null)
Description: (null)
HelpFile: (null)
HelpContext: 0
2023-05-26 Error on line 3276: 0x800A004C -
Source: (null)
Description: (null)
HelpFile: (null)
HelpContext: 0
I checked the compiled exe file using resource hacker but 0x800A004C doesn't exist at line 3272. I don't know what 0x800A004C means and I have had no issue running the same exe file myself. I do know my friend is using the latest build of Windows 10 and I am not. Can anyone please suggest a course of action to track down and fix what is causing the error or suggest what might be causing it. I am at a total loss. Thanks.


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

Re: Problem with exe file

Post by gregster » 29 May 2023, 17:44

Afaics, it's a runtime error code which you can google, and not something AHK-specific that can be found literally in your script - this error seems usually related to an incorrect file path or missing file.
Potentially also related to COM automation and "Scripting.FileSystemObject", if you are using smth like that.

Edit: didn't see teadrinker's answer before, but seems to go in the same direction

User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Re: Problem with exe file

Post by PuzzledGreatly » 29 May 2023, 17:59

Thanks very much for the replies. I tried teadrinker's link and got one hit:

Name: CTL_E_PATHNOTFOUND, Type: UInt32,Value: 2148139084

I don't really understand what this means but I do have a line of code using scripting.FileSystemObject so I will investigate that. Part of the program I wrote takes words from a text file looks for pngs containing those words in directories specified by the user and displays the pngs in a gui. Could this also mean a path got corrupted in some way, perhaps the text string contained an illegal character, for example?

User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Re: Problem with exe file

Post by PuzzledGreatly » 31 May 2023, 17:17

Following is my code using Scripting.FileSystemObject. The idea is that if there is more than 1,000 megabytes in the pool of directories to search the time to process the directories will be so long that it is best to display a splash screen. Can anyone see anything wrong with the code that could bring about the 0x800A004C error or any improvements? Thanks.

Code: Select all

mbs := 0
for k, v in locs
{
	byt := ComObjCreate("Scripting.FileSystemObject").GetFolder(v).Size
	mbs := mbs + ceil(byt/1024/1024)
}
if (mbs > 1000 && !WinExist("ahk_id" Embark))
Load()

Load()
{
	Gui, Beg:New, AlwaysOnTop -caption Toolwindow -dpiscale +E0x02000000 +E0x00080000, Loading %game%
	Gui, font, s20 bold
	Gui, color, f0dfd0
	Gui, add, picture, w300 h-1 backgroundtrans, #_loading.png
	Gui, add, text, y+0 w300 cred 0x0001 vload, Hello
	Gui, show
	Winset, transcolor, f0dfd0, a
		
	settimer, Begin, -1200
	
	return
	
	Begin:
	
	if WinExist("Loading" A_space Game)
	{
		Guicontrolget, load, beg:
		if instr(load,"Hello") 
		Guicontrol, Beg:, load, loading
		else
		Guicontrol, Beg:, load, Helloo
	
		settimer, begin,  -600
	}
	return
	
	BegGuiEscape:
	
	exitapp

}

teadrinker
Posts: 4325
Joined: 29 Mar 2015, 09:41
Contact:

Re: Problem with exe file

Post by teadrinker » 31 May 2023, 18:09

Some folder might be unavailable at the moment, it might cause an error. You can try this:

Code: Select all

mbs := 0
fs := ComObjCreate("Scripting.FileSystemObject")
for k, v in locs
{
   if InStr(FileExist(v), "D") {
      try {
         byt := fs.GetFolder(v).Size
         mbs += ceil(byt/1024/1024)
      }
   }
}
fs := ""

User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Re: Problem with exe file

Post by PuzzledGreatly » 02 Jun 2023, 18:01

Thanks teadrinker. I understand what you mean and will give your code a try.

Post Reply

Return to “Ask for Help (v1)”