how to fix "Error: 08004005 - Unspecified error" when i write a HTMLFile object?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
wo52616111
Posts: 47
Joined: 21 Aug 2014, 04:46

how to fix "Error: 08004005 - Unspecified error" when i write a HTMLFile object?

07 Jun 2016, 12:03

Code: Select all

color := HtmlBgColor()

;// HTML to be added to a GUI:
html =
(
   <body style='background-color:%color%;overflow:auto'>
      <span id='id' style='color:black'>text color</span> example
   </body>
)

;// create a simple GUI
Gui, Add, Button, x6 y60 w55 h20, Red
Gui, Add, Button, x71 y60 w55 h20, Blue
Gui, Add, ActiveX, x0 y-5 w140 h50 vdocument, HTMLFile
document.write(html)
Gui, Show, x399 y246 w138 h86, HTML
return

GuiClose:
   Gui, Destroy
   ExitApp
ButtonRed:
ButtonBlue:
   document.all("id").style.color := SubStr(A_ThisLabel,7)
   return

HtmlBgColor() {
   Format := A_FormatInteger
   SetFormat, IntegerFast, Hex
   color := SubStr(DllCall("GetSysColor", "int",15),3)
   SetFormat, IntegerFast, %Format%
   return SubStr(color,5,2) SubStr(color,3,2) SubStr(color,1,2) ;// switch from BGR -> RGB
}
Image

Only some computer will display the error, may be they are missing some dll?
User avatar
lifeweaver
Posts: 144
Joined: 10 May 2014, 05:57
Location: OH
Contact:

Re: how to fix "Error: 08004005 - Unspecified error" when i write a HTMLFile object?

08 Jun 2016, 13:38

Hi wo52616111,

This topic might be of interest.
In short I'd try, based on the topic:

Code: Select all

;// create a simple GUI
Gui, Add, Button, x6 y60 w55 h20, Red
Gui, Add, Button, x71 y60 w55 h20, Blue
Gui, Add, ActiveX, x0 y-5 w140 h50 vdocument, HTMLFile
document.document.write(html)
Gui, Show, x399 y246 w138 h86, HTML
return
It sounds like it depends on the OS/IE version.
wo52616111
Posts: 47
Joined: 21 Aug 2014, 04:46

Re: how to fix "Error: 08004005 - Unspecified error" when i write a HTMLFile object?

10 Jun 2016, 12:23

thank you lifeweaver, but that topic seems to be no help.
i want to try to update ie, but haven't found ie11 upgrade program for win10
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: how to fix "Error: 08004005 - Unspecified error" when i write a HTMLFile object?

11 Jun 2016, 23:50

I don't think htmlfile is intended to be used as a GUI control.

Try using a WebBrowser control instead, i.e. Shell.Explorer, about:blank or about:%html%. Just keep in mind that it returns a WebBrowser object, not a document object. The WebBrowser object has a .Document property.

If you don't want to be restricted to IE7 compatibility mode (which is the default for WebBrowser controls and most likely htmlfile), you should use something like this:

Code: Select all

Gui, Add, ActiveX, x0 y-5 w140 h50 vWB, about:<!DOCTYPE html><meta http-equiv="X-UA-Compatible" content="IE=edge">
WB.Document.write(html)
I do not know whether that will solve your problem.

If the registration of the HTMLFile or Shell.Explorer ProgID or the about protocol is corrupt, the respective method won't work. Some antivirus (I forget which) actually replace one or all of those with their own "proxy" class, for whatever reason. I have come across a computer from which that antivirus had been uninstalled improperly and other software which relied on the WebBrowser control ceased to function. IIRC, the usual methods of repairing IE were insufficient and I had to manually correct registry entries which were referencing non-existent dlls (belonging to the antivirus).

This will do some basic checks:

Code: Select all

keys := [["HKCR\htmlfile\CLSID"],["HKCR\Shell.Explorer\CLSID"]
    ,["HKCR\PROTOCOLS\Handler\about","CLSID"]]
for i, key in keys
{
    RegRead CLSID, % key[1], % key[2]
    RegRead dll, HKCR\CLSID\%CLSID%\InProcServer32
    MsgBox % key[1] ":`n" dll
}
It should show mshtml.dll or ieframe.dll. The registration can differ between 32-bit and 64-bit; this will only check the registration relevant to whichever AutoHotkey.exe you are using. There are probably many other ways that IE can become corrupt.
wo52616111
Posts: 47
Joined: 21 Aug 2014, 04:46

Re: how to fix "Error: 08004005 - Unspecified error" when i write a HTMLFile object?

12 Jun 2016, 01:03

thank you, lexikos, i'll try WebBrowser.
and about you said "Why did you start a new topic?" in topic "what file is HTMLFile ActiveX depend on?", i'm sorry for that, because i thought they are two different problems.
garry
Posts: 3764
Joined: 22 Dec 2013, 12:50

Re: how to fix "Error: 08004005 - Unspecified error" when i write a HTMLFile object?

12 Jun 2016, 08:14

activeX example with html

Code: Select all

#NoEnv
SendMode Input
SetWorkingDir, %A_ScriptDir%
SetBatchLines, -1
Filename1=Philippines Weather Warnings
Gui, 2: -DPIScale
wa:=A_screenwidth
ha:=A_screenHeight
xx:=105
GW :=(wa*90)/xx    ;- GUI width
GH :=(ha*95)/xx    ;- GUI height
AW :=(wa*38.3)/xx    ;- ActiveX width
AH :=(ha*68)/xx    ;- ActiveX height

AW1 :=(wa*37)/xx    ;- html width
AH1 :=(ha*66)/xx    ;- html height

;xxa=Shell.Explorer                  ;- IExplorer
xxa=Mozilla.Browser                  ;- firefox

Gui,2: Color, 000000
Gui,2:Font,  S10 CDefault , FixedSys

Gui,2:Add,ActiveX, x10 y10 w%aw% h%ah% vWB1 ,%xxa%
Gui,2: Show,x0 y0 w%gw% h%gh%,%filename1%

gosub,weather_ph
return
;------------------------
2Guiclose:
exitapp
;------------------------


;------ weather warnings philippines ------------
Weather_PH:
;-http://weather.com.ph/swc
fx=%a_scriptdir%\weather.htm
ifexist,%fx%
  filedelete,%fx%
e5x=
(Ltrim Join`r`n
<!-- Begin weather.com.ph map -->
<div style="margin:0px;padding:0px;width:%aw1%px;height:%ah1%px;border:1px solid black;background-color: #000000;">
<a href="http://weather.com.ph" alt="Current severe weather warnings for the Philippines" title="Current severe weather warnings for the Philippines">
<img src="http://weather.com.ph/layer/warningmaps/philippines_index.png" style="border:0px;margin:0px;padding:0px;width:680px;height:680px" alt="Current severe weather warnings for the Philippines" />
</a>
</div>
<!-- End weather.com.ph map -->
)
fileappend,%e5x%`r`n,%fx%
stringreplace,fx,fx,\,/,all
f1:="file:///" . fx
WB1.Navigate(F1)
return
;---------------------

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333 and 279 guests