
nmontec
Active Members-
Posts
25 -
Joined
-
Last visited
nmontec's Achievements

Seeker (1/7)
0
Reputation
-
Dear All, I am having some trouble in automating a window. Everything is fine is I may use the couple WinActivate/WinWaitActive but it is not working if the window is minimized. I need to click a button and I tried the following: I declared in an object a reference like this: self.autoit=win32com.client.Dispatch('AutoItX3.Control') self.autoit.AutoItSetOption('WinTitleMatchMode',2) self.autoit.AutoItSetOption("WinDetectHiddenText", 1) And a t a certain point I press the Exit button self.autoit.ControlClick('Dome','','[CLASSNN:WindowsForms10.BUTTON.app.0.378734a15]') self.autoit.ControlClick('Dome','','[NAME:ButtonExit]') self.autoit.ControlClick('Dome','','[CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:15]') Now, If the window is active and screen is not locked all is ok.But if window is minimized and/or screen is locked the command does not have any effect on the window. As far as I know controlclick should work also on these situations. Am I wrong? Thanks a lot for your help Nicola
-
Dear All, I have a UI where a users has got two buttons. one "Play" and one "Pause". When I hit "Play" the program runs Func A, but then if I hit "Pause" the function associated to"Pause" is not run until the Func "Play" is not completed and this is exactly what I don't want as I want to stop the flow and being able to keep it going again if I press "Play" again. Do you have any idea on how to do that? At the moment (not working) I have something like this: $start=GUICtrlCreateButton ( "Play", 20, 250, 70, 25) GUICtrlSetOnEvent($start, "StartButton") $stop=GUICtrlCreateButton ( "Pause", 100, -1, 70, 25) GUICtrlSetOnEvent($stop, "StopButton") Func StartButton() for $i=1 to 10 ; do something sleep (1000) next EndFunc Func StopButton() ; Pause the script EndFunc Thanks a lot for your help Nicola
-
You're right, I didn't post any code.. The array is declared Global $Sequence[5][5] Checkboxes are created with something like this for $i=0 to 4 step 1 $FilterLabel="Filter #" & $i GUICtrlCreateLabel($FilterLabel,5,$i*30+63) $Sequence[$i][0]=GUICtrlCreateCheckbox("",50,$i*30+60,20,20) Next This is the function where I get the error Func ReadExposureMatrix () for $FilterNo=0 to 4 Step 1 if (GUICtrlRead($Sequence[$FilterNo][0])==$GUI_CHECKED) Then $ExposureMatrix[$FilterNo][0]=1 Else $ExposureMatrix[$FilterNo][0]=0 EndIf $ExposureMatrix[$FilterNo][1]=GUICtrlRead ( $Sequence[$FilterNo][1] )*1000 $ExposureMatrix[$FilterNo][2]=GUICtrlRead ( $Sequence[$FilterNo][2] ) $ExposureMatrix[$FilterNo][3]=GUICtrlRead ( $Sequence[$FilterNo][3] ) $ExposureMatrix[$FilterNo][4]=GUICtrlRead ( $Sequence[$FilterNo][4] ) Next EndFunc In particular the error is pointing at this line if (GUICtrlRead($Sequence[$FilterNo][0])==$GUI_CHECKED) Then Thanks once again
-
Hello Everyone, I've got a GUI with some checkboxes and a button that executes a procedure when it's pressed. When the procedure is completed, if i hit again the button the GUI crashes saying that an array is not initialized. The array is global and it was filled with the values I got from the GUI on the first run, and because I don't clear it I would expect to have the same content on the second one, so I'm puzzled. Do you have any idea on why this happens? How do work this around? Thanks a lot! Nicola
-
Dear All, to get the handle of the Canon EOS Utility (software to remotely control a Canon EOS DSLR camera via USB cable) I use this command: $EOS_Handle = WinGetHandle("[CLASS:WindowsForms10.window.8.app.0.3553390]", "") Well, this works on my PC, but not on others. Can anyone tell me how to address correctly this window? I can't use its title as the title changes depending on the camera, so I need something general. Otherwise, Is there a general method I can use to retrieve the correct handle whatever Canon EOS Utility I have installed? thanks a lot Nicola
-
Sometimes my script hangs on a loop
nmontec replied to nmontec's topic in AutoIt General Help and Support
Hi, just to let you know that I browsed the forum a little bit digging for info and I tried also this: Func Esposizione ($qsi,$tempo,$filtro,$nomefile) Dim $Pronto $qsi.Expose ($tempo,1,$filtro) $Pronto=False Do $Pronto=$qsi.ImageReady if @error Then ConsoleWrite ( "Bad Luck!" & chr(13)) Exit EndIf Until $Pronto $qsi.SaveImage ("c:\\tmp\\" & $nomefile) ConsoleWrite ( "Fine cattura frame" & chr(13)) EndFunc Despite the @error the $Pronto=$qsi.ImageReady always hangs the program and the consolewrite inside the "@error if statement" is never reached. -
Sometimes my script hangs on a loop
nmontec replied to nmontec's topic in AutoIt General Help and Support
Thank you for your reply. I did try the timer code as you wrote and I got the same error The requested action with this object has failed at the line If $qsi.ImageReady Then What is a COM error handler? May you point me out to the related documentation? Thank you very much! Nicola -
Sometimes my script hangs on a loop
nmontec replied to nmontec's topic in AutoIt General Help and Support
I get the following error: C:\Users\betelgeuse\Documents\QSIDitheringConPHD.au3 (38) : ==> The requested action with this object has failed.: WEnd WEnd^ ERROR Line 38 is "WEnd" -
Dear All, I have written this function: Func Esposizione ($qsi,$tempo,$filtro,$nomefile) If ($qsi.Expose ($tempo,1,$filtro)) Then ConsoleWrite ( "Inizio cattura frame" & chr(13)) while (Not $qsi.ImageReady) WEnd $qsi.SaveImage ("c:\\tmp\\" & $nomefile) ConsoleWrite ( "Fine cattura frame" & chr(13)) EndIf EndFunc The script, sometimes, hangs with the error at the "Wend" statement. Unfortunately is "sometimes" and not "always" and that makes me difficult to debug this. I tried to put a sleep() inside the while loop, with different timings, but it didn't help. $qsi.ImageReady is a call to a boolean COM property. Thanks to everyone who can help me in sort this out Best regards, Nicola
-
Yes, it does work and it works with my window! Now, this is nice, but I don't understand how you reached this, I never use the WinAPI so I don't know how to use it. Can you point me out to some documentation regarding this API? I'm also relatively new to Windows...
-
yes it does work, but what's the difference between my application "PHD" and your window "PHD"? I don't understand... PS: I tried also with other windows like firefox, same thing, I don't get the event.
-
Yes, this is the intended purpose of this piece of code. It does not work anywhere within the PHD window or outside of it. Edit: I just tried to print out the GUIGetMsg() and it always returns 0. I guess this means that it never gets for any reason any event...this is weird. It's my first time to get events, but the code to me seems treally simple that I don't know where I could have mistaken. Func StoreCoordinate() WinActivate("PHD") WinWaitActive("PHD") While 1 $msg=GUIGetMsg() ConsoleWrite($msg & @CRLF) If $msg = $GUI_EVENT_PRIMARYDOWN Then $Stella = MouseGetPos() ConsoleWrite($Stella[0] & " " & $Stella[1] & @CRLF) Return $Stella EndIf WEnd EndFunc
-
No it does not work also in the way you rewrote it. This is the full code I tried: #include <GUIConstantsEx.au3> Func StoreCoordinate() WinActivate("PHD") WinWaitActive("PHD") While 1 If GUIGetMsg() = $GUI_EVENT_PRIMARYDOWN Then $Stella = MouseGetPos() ConsoleWrite($Stella[0] & " " & $Stella[1] & @CRLF) Return $Stella EndIf WEnd EndFunc AutoItSetOption("WinTitleMatchMode",2) AutoItSetOption ( "MouseCoordMode" , 0) $Stella=StoreCoordinate()
-
Hello All, I've got the following function: Func StoreCoordinate() WinActivate("PPP") WinWaitActive("PPP") while 1 $msg=GUIGetMsg () if $msg<>0 Then if $msg==$GUI_EVENT_PRIMARYDOWN Then $Stella=MouseGetPos() ConsoleWrite($Stella[0]& " " & $Stella[1] & chr(13)) ExitLoop EndIf EndIf WEnd Return $Stella EndFunc This function never ends despite I clicked with the mouse many times. Do you know why the loop never ends? Thanks for the help Nicola
-
Dear All, I'd like to get the frames from a video application to do some processing on them, is it possible? How? thanks a lot for your help Nicola