Jump to content

How to debug hanging Script?


MaxU77
 Share

Recommended Posts

I have created a script that is supposed to proceed in off-time.

It is definetely not bullet proof one because the part of software script should interact with has no controls recognized with <Autoit Window Info>.

Thus nothing I can do but go through softwares interface. I'm ve set hotkey (Ctrl+Shift+1) within the software itself that starts the window with controls for further process. Then I'm waiting for the window to appear.

.......
Send ("^+1")
WinWait (".......

When I run script manually - everything goes well and I'm getting the result I want.

But in real usage it hangs on exact that place.

When I go to office and unlock my PC I see autoit-sign in the tray. If I then press Ctrl+Shift+1 the window waited appears and script processes the rest of work just fine.

The only difference I could imagine - PC is in the locked condition. And yes I can reproduce it by adding Sleep for a while in begining and locking PC just after running script manually.

Is there any ways to fight this?

Link to comment
Share on other sites

  • Developers

double check the WinWait parameters that you have exact information in there. It sounds like something changes after a few seconds when you say you can replicate the issue by putting a sleep between Send() and WinWait().

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

double check the WinWait parameters that you have exact information in there. It sounds like something changes after a few seconds when you say you can replicate the issue by putting a sleep between Send() and WinWait().

Jos

Sorry. There is probably misunderstanding.

I put sleep not "between ...." but at the begining of the script.

I do it in order to have time to lock PC before the real action begin.

Link to comment
Share on other sites

  • Developers

Sorry. There is probably misunderstanding.

I put sleep not "between ...." but at the begining of the script.

I do it in order to have time to lock PC before the real action begin.

so you are sure it is hanging on the WinWait() ?

To double check just add the following line at the top:

Opt("TrayIconDebug", 1)

.. and hover over the autoit trayicon to display the line the script is waiting for.

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Now I almost sure it has direct relation to the FAQed question you've referenced.

There is "frobidden" <WinActivate> in script before the issued place:

.....
WinActivate ("AAA", "")
Send ("^+1")
WinWait (".......

Debug claims <WinWait> to be haging string

After I've added <WinWaitActive> like

.....
WinActivate ("AAA", "")
WinWaitActive ("AAA", "")
Send ("^+1")
WinWait (".......

Things have changed a bit:

Script still hangs but now it is enough to log-in to un-hang it (no need to press hotkey).

All-in-all it is not exactly what I want.

The software hotkey is the almost the only way I could imagine to get to the control that initiates the target child window.

Pity there is no somewhat <WinSend> command in AutoIt.

I quess the software I'm struggling with don't have command menu (It does have command menu, but that menu is probably not the standard windows object, also control which runs the child window is not in that menu, but it is rather drop-down option in some area that I'd call "auxiliary command menu") otherwise I'd use <WinMenuSelectItem>.

I should probably need to try combination of Window Management and Mouse Management...

Edited by MaxU77
Link to comment
Share on other sites

As the aforementioned FAQ states, when the station is locked no window will ever be active, so WinWaitActive will always "hang" on a locked station. When you unlock it, the window can be active again and if it is the script continues. So all in all, if your script actually depends on a window being active, it just won't work in a locked situation. You can send stuff to controls by ControlSend...

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...