Jump to content

loop getting stuck...sometimes


Recommended Posts

I don't see what I'm missing here...though I know I will get laughed at by the other folks here.

$g = 1 
  While 2   
  $g = $g + 1   
  $search1 = IniRead("bin\unplus.ini", @UserName, "searchincident", "")
  $aa = StringLen($search1)
  $info = string(ClipGet())
  $bb = StringLen($info)
  if $search1 = $info then 
   if $aa = $bb then
   ExitLoop
  Elseif $g = 10 then
   ExitLoop 
  Else
   _F3_chk1()
  EndIf
  Endif  
  wend

For some reason this gets stuck sometimes. not sure why. I think $g isn't being added to, but I think its right...need coffee..... :D

Edited by vollyman
Link to comment
Share on other sites

Hi,

i dont know if this works but maybe

$g = 1
While 2
    $g = $g + 1
    $search1 = IniRead("bin\unplus.ini", @UserName, "searchincident", "")
    $aa = StringLen($search1)
    $clip = ClipGet()
    $info = string( $clip )
    $bb = StringLen($info)
    if $search1 = $info then
        Select
            Case $aa = $bb or $g = 10
                ExitLoop
            Case Else
                _F3_chk1()
        EndSelect
    Endif
wend

It's also looking nicer ^^

--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Link to comment
Share on other sites

$g is being added to ($g = $g + 1 // $g += 1 )

but i think that sometimes $search1 = $info isn't true and then it skips the check of $g being 10 and you're in a never ending loop

Funny script though, i wonder what it does :D

[edit]

$g = 1 
While 2   
    $g = $g + 1   
    $search1 = IniRead("bin\unplus.ini", @UserName, "searchincident", "")
    $aa = StringLen($search1)
    $info = string(ClipGet())
    $bb = StringLen($info)
    If $g = 10 Then
        ExitLoop
    EndIf
    if $search1 = $info then 
        if $aa = $bb then
            ExitLoop
        Else
            _F3_chk1()
        EndIf
    Endif  
wend

Func _F3_chk1()
    
EndFunc

OR

$g = 1 
While 2   
     
    $search1 = IniRead("bin\unplus.ini", @UserName, "searchincident", "")
    $aa = StringLen($search1)
    $info = string(ClipGet())
    $bb = StringLen($info)
    if $search1 = $info then 
        $g = $g + 1  
        if $aa = $bb then
            ExitLoop
        Elseif $g = 10 then
            ExitLoop 
        Else
            _F3_chk1()
        EndIf
    Endif  
wend

Func _F3_chk1()
    
EndFunc
Edited by Manadar
Link to comment
Share on other sites

Its a function to click a field in a window. When I designing it, I ran into several problems. Controls with no IDs, and the entire app is written in Java. The method works pretty well, but it does get stuck sometimes. This is the entire function in it's current form. It is somewhat messy.

Func _F3_Func(); Search Incident
 $INIin = IniRead("bin\unplus.ini", @UserName, "speed", "")
 If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then
  WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.")
 ElseIf $INIin == "normal" Then
  iniwrite("bin\unplus.ini",@UserName, "action", "1")
  $mschk1 = PixelSearch(1, 70, 1000, 300, 0x9CC6E7, 5)  
  ;MsgBox(0, "","X =" & $mschk1[0] & "  Y = " & $mschk1[1])
  $xm = $mschk1[0]+453
  $xm1 = $mschk1[0]+381
  $xn = ($XM + 97)
  ControlSend("Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "!e", 0)
  Sleep(5)
  ControlSend("Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "i", 0)
  WinWait( "Unicenter ServicePlus Service Desk", "Opening", 1)
  Sleep(200)
  WinWait( "Unicenter ServicePlus Service Desk - Incident Search", "Done", 3)
  $x = 1
  while 7 
   WinActivate("Unicenter ServicePlus Service Desk - Incident Search", "Done")
   $colorwin = PixelSearch($xm1, 400, $xm1 + 30, 416, 14079694, 10)
   ;MsgBox(0, "","X =" & $colorwin[0] & "  Y = " & $colorwin[1])
   if @error = 1 then 
    sleep(2)
   Else
    ExitLoop
   EndIf 
  WEnd
  BlockInput(1)
  ;sleep(10)
  $mschk = MouseGetPos()
  MouseMove($xm , 263,0)
  sleep(3)
  MouseClick("left", $xm , 263, 1, 0)
  sleep(5)
  mousemove($mschk[0], $mschk[1], 0) 
  _F3_chk1()
  $g = 1 
  While 2   
  $g = $g + 1   
  $search1 = IniRead("bin\unplus.ini", @UserName, "searchincident", "")
  $aa = StringLen($search1)
  $info = string(ClipGet())
  $bb = StringLen($info)
  if $search1 = $info then 
   if $aa = $bb then
   ExitLoop
  Elseif $g = 10 then
   ExitLoop 
  Else
   _F3_chk1()
  EndIf
  Endif  
  wend
  sleep(100)
  send("!s")
  BlockInput(0)
  iniwrite("bin\unplus.ini",@UserName, "action", "0")
 Else

  ;method 2 of accessing field. User can select it via options panel
  iniwrite("bin\unplus.ini",@UserName, "action", "1")
  RunWait("alert1")
  BlockInput(1)
  ControlSend("Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "!e", 0)
  Sleep(300)
  WinActivate("Unicenter ServicePlus Service Desk", "[url="http://usdp/CAisd/pdmweb.exe"]http://usdp/CAisd/pdmweb.exe[/url]")
  ControlSend("Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "i", 0)
  Sleep(3000)
  WinActivate("Unicenter ServicePlus Service Desk", "[url="http://usdp/CAisd/pdmweb.exe"]http://usdp/CAisd/pdmweb.exe[/url]")
  ControlSend("Unicenter ServicePlus Service Desk - Incident Search", "", "Internet Explorer_Server1", "{RIGHT}", 0)
  WinActivate("Unicenter ServicePlus Service Desk", "[url="http://usdp/CAisd/pdmweb.exe"]http://usdp/CAisd/pdmweb.exe[/url]")
  Sleep(20)
  WinActivate("Unicenter ServicePlus Service Desk", "[url="http://usdp/CAisd/pdmweb.exe"]http://usdp/CAisd/pdmweb.exe[/url]")
  ControlSend("Unicenter ServicePlus Service Desk - Incident Search", "", "Internet Explorer_Server1", "{RIGHT}", 0)
  WinActivate("Unicenter ServicePlus Service Desk", "[url="http://usdp/CAisd/pdmweb.exe"]http://usdp/CAisd/pdmweb.exe[/url]")
  Sleep(20)
  $note1 = IniRead("unplus.ini", @UserName, "searchincident", "")
  ControlSend("Unicenter ServicePlus Service Desk - Incident Search", "", "Internet Explorer_Server1", $note1, 0)
  WinActivate("Unicenter ServicePlus Service Desk", "[url="http://usdp/CAisd/pdmweb.exe"]http://usdp/CAisd/pdmweb.exe[/url]")
  ControlSend("Unicenter ServicePlus Service Desk - Incident Search", "", "Internet Explorer_Server1", "!s", 0)
  BlockInput(0)
  iniwrite("bin\unplus.ini",@UserName, "action", "0")
 EndIf
EndFunc   ;==>_F3_Func 
Func _F3_chk1()  ;this works fine, no changes needed here. 
   $search1 = IniRead("bin\unplus.ini", @UserName, "searchincident", "")
   sleep(300)
      Send($search1)
   ClipPut("")
   send("^a")
   sleep(10)
   send("^c")
   sleep(5)
   send("^c")
EndFunc
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...