Jump to content

urgent-sporadic hang in autoit script


nandy12
 Share

Recommended Posts

hi, I am using a simple script to clean up chars in another app. The functions used are winactivate, send, controlcommand -none of which should be waiting but yet I have an OCCASIONAL hang where the script just does not complete execution and the target app too wont respond to any events.

Just to be clear, its not that the script hangs every time its invoked but it locks up once in a while.

Here is the script:

;clear text if any

if WinActivate("MP")==0 Then

exit 1

EndIf

;get to the panel

Send("!o")

Send("a")

Sleep(1500)

;v26Jan13. clear and activate Capture app

Send("{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}")

Sleep(1000)

WinActivate("Capture")

exit 0

--------------

I really need to resolve this ASAP so any pointers appreciated. I run on win XP SP2

Link to comment
Share on other sites

  • Moderators

nandy12,

What app are you trying to automate - there might well be a better way than using the often unreliable Send. As it seems that you could be trying to empty an input, ControlSetText might be a more useful option. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

hi m23,

I'm trying to automate the MobilePartner app (Huawei modem GUI). Unfortunately target control is a custom control-something like an editable combo box and I was not sure if controlsetText will work correctly. The finder tool just lists the window handle and the registered window class.{edit: the finder tool does not select the editable portion of the control and only shows class,instance for the listbox portion. I tried using this info with ControlSetText but it does not work]

The only explaination I have is that send is getting stuck if the target is busy and not responding to messages-but I am not even sure the target app gets to such a state!

More than anything I dont want it to be stuck, failing gracefully would be good enough so maybe sendwithTimeout would be ok too. I want to be sure its only send and that none of the other functions have possibilities of endless waits before I make any changes.

tks,

nan

Edited by nandy12
Link to comment
Share on other sites

  • Moderators

nandy12,

From what you say it sounds as if that is indeed a custom GUI and so not accessible via the Control* functions. :(

However, you can test whether the app has been activated by using WinWaitActive - this includes a timeout so that if your app does not respond you can run some code in your script to indicate that a problem has occurred.

What happens to the app GUI when you Send the ("!o") and ("a") codes? Is there a visual change such a menu opening? If so then you might be able to check that this has happened using PixelCheckSum on part of the GUI area affected. If the expected change does not occur then again you can run different code.

Does that offer enough to be going on with? Please ask if you are unsure about how to work with any of the commands I mentioned. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

m23,

The Send(!o),send(a) are meant to bring up a specific panel via menu commands. The problem is that if the app is stuck then the

first send could end up blocking. PixelgetCheckSum could help me figure if the right panel is already up but it wont tell me if the app is stuck. (pls correct me if thats wrong).

Isn't there a send with timeout -maybe sendmessagetimeout win32 fn or equivalent? Ideally I would just want to attempt a send with a timeout. i did seem to see some such code on stackoverflow but can't locate it. Plus I dont want to try my own code without understanding hidden quirks.

Link to comment
Share on other sites

  • Moderators

nandy12,

As the problem seems to be the other app not responding to your script, you might like to try checking that it is responsive using something along these lines before each Send. Then you can abort if the app is not in the mood to play after a certain time (TimerInit/Diff will help here) - assuming that you get a suitable response from the query. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...