Gui Add ActiveX and hard-coded values

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
joefiesta
Posts: 497
Joined: 24 Jan 2016, 13:54
Location: Pa., USA

Gui Add ActiveX and hard-coded values

21 Nov 2018, 16:35

I have a script that opens a .GIF file in a GUI. It uses Gui, Add, ActiveX.
The problem is the "Gui, Add, Activex" command. When I hard-code values for the Width and Height of the Gui, there is no problem. The script opens the .GIF fine. However, when I try to use a variable value in the specificationn of the Width and Height the GUI, while it shows,it is not the right size and doesn't show the .GIF.

Here is my script (with both the GOOD and BAD Gui, Add, ActiveX commands). Any ideas as to why the non-hardcoded values for Wnnnn and Hnnnn fail would be appreciated.

Code: Select all

fid_act := "C:\Users\Joey\Documents\autohotkey_scripts\gif\test.gif"
  gosub get_dimensions
  Gui, Add, ActiveX, x0 y0 w265 h206 vWB, shell explorer                        
; Gui, Add, ActiveX, x0 y0 w%Pic_w% h%Pic_h% vWB, shell explorer
  wb.Navigate("about:blank")
  html := "<html>`n<title>name</title>`n<body>`n<center>`n<img src=""" fid_act """ >`n</center>`n</body>`n</html>"
  wb.document.write(html)
  Gui, show, AutoSize Center
  msgbox gui shown
exit

get_dimensions:
   splitpath, fid_act, filefnft, filedir, fileext                                                                                 
   objFolder := ComObjCreate("Shell.Application").Namespace(FileDir . "")
   objFile := objFolder.Parsename(filefnft)
   pic_w  := trim(objFolder.GetDetailsOf(objFile, 162))
   pic_w  := substr(pic_w,1,strlen(pic_w)-7)     ; remove " pixels"
   pic_h := trim(objFolder.GetDetailsOf(objFile, 164))
   pic_h := substr(pic_h,1,strlen(pic_h)-7)     ; remove " pixels"
   objFolder := "", objFile := ""
   return
]

Notes: 1. I think I read somewhere that this method of displaying a Gif in a Gui only works with Firefox installed. Not sure.
2. Can I attach my TEST.GIF file here? Otherwise, you need to have your own .GIF and learn it's size. Although, when hard-coding the Width and Height parameters, they need not be the exact values of the file.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: RandomBoy, scriptor2016 and 355 guests