Sign in to follow this  
Followers 0
Bert

Loop Problem

4 posts in this topic

#1 ·  Posted (edited)

You would think I would know this now, but I still have some trouble with this. (sigh) I have a application that has some trouble with send and controlsend. I will get only part of the string sent, or something that is lower case be sent in upper case, or a _ instead of a -. I'm not sure why this app has this trouble, but I'm trying to make a workaround to check to make sure the data sent is correct. I tried this, and of course, it doesn't work.

while 3   
   $search1 = IniRead("bin\unplus.ini", @UserName, "searchincident", "")
   ClipPut("")
   send("^a")
   sleep(10)
   send("^c")
   sleep(5)
   send("^c");needed for sometimes it will return a blank string, when in fact there is something there.
   $info = string(ClipGet())
;MsgBox(0,"",$info)  
   if not $info = $search1 then return  ;example: CTS-M = CTS-MA
   if $info = $search1 then ExitLoop ;example: CTS-MA = CTS-MA
  wend 
  sleep(100)
  send("!s")

What it does is check the string that was sent to the field. It does this by copying it to the clipboard, then doing a compare with what is in the INI file. If it matches, it will exit the loop, and do a send to allow the app to process the data entered. My problem is that it gets either stuck, or won't work at all.

Edited by vollyman

Share this post


Link to post
Share on other sites



Have you tried ControlSetText()?


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

The problem is the control has no ID. I've tried, but the only way I can access the control is to do a mouse click. I can access the control by doing this no problem, but the problem is sending the data. It will work 5 times out of 6 or so. Every so often it will send only part of the string, or one of the characters sent is incorrect. That is why I want to do a error check.

Edited by vollyman

Share this post


Link to post
Share on other sites

I figured it out. I really need to get this down so I don't get smacked by silly stuff like this:

_F3_chk1()
  While 2   
  $search1 = IniRead("bin\unplus.ini", @UserName, "searchincident", "")
  $info = string(ClipGet())
  if $search1 = $info then 
   ExitLoop
  Else
   _F3_chk1()
  EndIf 
  wend 
  sleep(100)
  send("!s")

Func _F3_chk1()
   $search1 = IniRead("bin\unplus.ini", @UserName, "searchincident", "")
   sleep(300)
      Send($search1)
   ClipPut("")
   send("^a")
   sleep(10)
   send("^c")
   sleep(5)
   send("^c")
  ;$info = string(ClipGet())
EndFunc

Share this post


Link to post
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
Sign in to follow this  
Followers 0