Author Topic: Chapter 17 Working with APIs - AutoClick  (Read 1246 times)

Offline qtpmgrossman

  • Newbie
  • *
  • Posts: 18
Chapter 17 Working with APIs - AutoClick
« on: June 09, 2010, 01:13:30 pm »

I'd like to know if you can provide a solution for two issues regarding your Autoclick.vbs example:

#1: What would be the appropriate way to allow some sleep time in the While Wend loop. I have a 5 second wait but would a sleep be better?

        While Not AutoClickButton(sWindowName, sWindowButton)
   wait 5

#2 What if Autoclick.vbs never finds it's window and button and we call it repeatedly? How can we avoid a situation where lots of WshShells are left running? Can the function be modified to send a message to kill to it neatly? I have a function to kill processes, but I'm wondering if there is a more "elegant" solution?



Offline Tarun Lalwani

  • Administrator
  • Hero Member
  • *****
  • Posts: 3084
    • KnowledgeInbox
Re: Chapter 17 Working with APIs - AutoClick
« Reply #1 on: June 09, 2010, 01:38:53 pm »
Wait time is dependent on your scenario. You can tweak it to what works best for you.

For the 2nd issue the best way is to have final timeout where a script will only try for say max 10 iterations of the loop. If the object is still not there it will exit
KnowledgeInbox Administrator

KnowledgeInbox" style="border:0