Jump to content

Recommended Posts

Posted

Hi,

I've made a script that uses a program called "Onguard" to get certain information. The only thing I really do is activate it and active a certain window to get some data. The problem is that sometimes I get an error (Sever Busy, Switch To or Retry), but not always. I don't really think this should overload the software. Anyone a clue what I'm doing wrong?

$handle = "OnGuard ICMS 2.6 - "
winactivate ($handle)

Sleep (1500)
controlclick ($handle, "", "msvb_lib_toolbar2", "Left", 1, 59, 13)

$infohandle = "Debiteur details (1000)"
winwaitactive ($infohandle)
$debnr = Controlgettext ($infohandle, "", "ThunderRT6TextBox30")
$bedrijfsnaam = Controlgettext ($infohandle, "", "ThunderRT6TextBox29")
Controlclick ($infohandle, "", "SSTabCtlWndClass1", "Left", 1, 171, 32)
Sleep (500)
$telnr1 = Controlgettext ($infohandle, "", "ThunderRT6TextBox14")
$telnr2 = Controlgettext ($infohandle, "", "ThunderRT6TextBox13")
$telnr3 = Controlgettext ($infohandle, "", "ThunderRT6TextBox12")
winkill ($infohandle)

Thank you in advanche!

  • 2 weeks later...
Posted (edited)

Hi.

does this one give you better results?

$TitleMain = "OnGuard ICMS 2.6 - "

While 1
WinActivate($TitleMain)
If WinActive($TitleMain) Then ExitLoop
Sleep(50)
WEnd

ControlClick($TitleMain, "", "msvb_lib_toolbar2", "Left", 1, 59, 13) ; do you really need to click a certain position within that control?

$TitleInfo = "Debiteur details (1000)"
WinWait($TitleInfo)
While 1
WinActivate($TitleInfo)
If WinActive($TitleInfo) Then ExitLoop
Sleep(50)
WEnd

$debnr = ControlGetText($TitleInfo, "", "ThunderRT6TextBox30")
$bedrijfsnaam = ControlGetText($TitleInfo, "", "ThunderRT6TextBox29")
ControlClick($TitleInfo, "", "SSTabCtlWndClass1", "Left", 1, 171, 32) ; same question as above. Usually the default (click control's center) is OK.
Sleep(500) ; is this wait time sufficent?
$telnr1 = ControlGetText($TitleInfo, "", "ThunderRT6TextBox14")
$telnr2 = ControlGetText($TitleInfo, "", "ThunderRT6TextBox13")
$telnr3 = ControlGetText($TitleInfo, "", "ThunderRT6TextBox12")
WinKill($TitleInfo) ; do you really need to close this window forcibly? -> WinClose() ??

Regards, Rudi.

<edit> missed to tidy the code </edit>

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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
×
×
  • Create New...