Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"Window not found" error at runtime but not when run in QM
#1
Hi,
my macro find a window, activates it and then executes some keyboard and mouse activities on its controls.
It works fine when run in QM, or when the exe is run in QM from the output window right after making it, but it fails when it's run by double clicking the executable from its folder. In the output window I can see the message:
"Error (RT) in arruola:  window not found (the handle is 0)."

the macro code is:
Code:
Copy      Help
int w=win("[A-Z]{6}\d{2}[A-Z]\d{2}[A-Z]\d{3}[A-Z]" "FNWND3115" "millewin" 0x200)
act w
0.2
key SF4         ;; MAIUSC+F4
0.2
key v70.5       ;; V 7 0 . 5
key Y           ;; INVIO
/etc...

Could you give me a hint on what's going wrong?

Many thanks
#2
Try to run as administrator. Does it work then?
#3
no, same error...

Thank you
#4
Maybe this function can help to debug this.

Function OutWinList
Code:
Copy      Help
;Shows handles classnames and names of all visible windows in QM output.

out
ARRAY(int) a
win "" "" "" 0 "" a
int i
for i 0 a.len
,outw2 a[i]
out a.len
Function outw2
Code:
Copy      Help
;/
function hwnd [$prefix] [str&sOut]

;Displays window handle, class, text (first line) and program in QM output.

;sOut (QM 2.3.5) - if used, stores text in the variable, else displays in QM output.

;REMARKS
;Colors: gray if invisible; olive if cloaked (but IsWindowVisible returns 1).


if(!hwnd) out "%s0" prefix; ret
if(!IsWindow(hwnd)) out "%s%i <invalid handle>" prefix hwnd; ret
str sc.getwinclass(hwnd); err
str st.getwintext(hwnd); err
st.trim; st.getl(st 0); st.LimitLen(100 1)
str se.getwinexe(hwnd)
int col; if(!IsWindowVisible(hwnd)) col=0x808080; else if(IsWindowCloaked(hwnd)) col=0x8080
str s=F"<><c 0x{col}><_>{prefix}{hwnd}  {sc}</_></c>  <c 0x8000><_>''{st}''</_></c>  <c 0xff0000>{se}</c>"
if(&sOut) sOut=s; else out s
#5
this is the output:

399658  DFTitleBarWindow:d4cf329f-8d19-467e-b9c8-ad5298f2258e  ""  DisplayFusion

68006  DFTaskbarStartButton:cf60f0a8-d771-4304-8cd0-4c94ff52e247  ""  DisplayFusion

263094  DFTaskbar:686e85c8-a81d-4f7f-a490-f3ae75d72cc8  ""  DisplayFusion

66058  EdgeUiInputWndClass  ""  explorer

66076  EdgeUiInputWndClass  ""  explorer

66382  Windows.UI.Core.CoreWindow  "Nuova notifica"  ShellExperienceHost

66332  Windows.UI.Core.CoreWindow  "Cortana"  SearchUI

1514200  Windows.UI.Core.CoreWindow  "Jump List per Esplora file"  ShellExperienceHost

66302  Windows.UI.Core.CoreWindow  "Start"  ShellExperienceHost

135584  Windows.UI.Core.CoreWindow  "Window"  ShellExperienceHost

66286  Windows.UI.Core.CoreWindow  "Host esperienza shell di Windows"  ShellExperienceHost

66012  ApplicationManager_ImmersiveShellWindow  ""  explorer

66504  Internet Explorer_Hidden  ""  SearchUI

65882  Shell_TrayWnd  ""  explorer

196848  TeamViewer_TitleBarButtonClass  ""  millewin

2891060  FNWND3115  "Giulia  26-01-65   < 0 esenzioni >  ABGGLI65A64B157R - 488AP924  [DR GRG ZN]"  millewin

135534  QM_toolbar  "QM TOOLBAR"  qm

135558  TeamViewer_TitleBarButtonClass  ""  qm

135448  QM_Editor  "Quick Macros - Main - [Arruola]"  qm

329838  TeamViewer_TitleBarButtonClass  ""  vivaldi

661982  DFTitleBarWindow:acc8645c-1ada-45c8-b69b-dd195fd3569c  ""  DisplayFusion

2891096  Chrome_WidgetWin_1  ""Window not found" error at runtime but not when run in QM"  vivaldi

990002  DAXParkingWindow  ""  millewin

531702  DFTitleBarWindow:294b9eaf-63f1-4bad-a2e1-16a01d1d76a7  ""  DisplayFusion

332224  TeamViewer_TitleBarButtonClass  ""  ApplicationFrameHost

332706  ApplicationFrameWindow  "Microsoft Store"  ApplicationFrameHost

267934  Windows.UI.Core.CoreWindow  "Microsoft Store"  WinStore.App

70416  ApplicationFrameWindow  ""  explorer

68010  ApplicationFrameWindow  ""  explorer

66086  DummyDWMListenerWindow  ""  explorer

66080  EdgeUiInputTopWndClass  ""  explorer

66062  EdgeUiInputTopWndClass  ""  explorer

69632  Internet Explorer_Hidden  ""  Adobe Desktop Service

990768  Internet Explorer_Hidden  ""  millewin

267874  FNWND3115  "MilleSA"  millepat

69076  WorkerW  ""  explorer

69078  WorkerW  ""  explorer

65978  Progman  "Program Manager"  explorer
38
#6
If this list is generated by the exe launched from explorer, then win should find the window, and I don't know why it doesn't.
I tested with notepad, and it works.

Macro Macro2976
Code:
Copy      Help
int w=win("" "Notepad")
_s="Giulia  26-01-65   < 0 esenzioni >  ABGGLI65A64B157R - 488AP924  [DR GRG ZN]"
_s.setwintext(w)

Macro Macro2971
Code:
Copy      Help
;/exe

int w=win("[A-Z]{6}\d{2}[A-Z]\d{2}[A-Z]\d{3}[A-Z]" "notepad" "notepad" 0x200)
outw w
act w

;BEGIN PROJECT
;exe_file  $my qm$\Macro2971.exe
;END PROJECT

Then I run the exe from explorer, and it finds the window.


Forum Jump:


Users browsing this thread: 1 Guest(s)