Sign in to follow this  
Followers 0
NoobieAutoitUser

How to serach for text in Array.

3 posts in this topic

#1 ·  Posted

Hi.
I am currently writing a script for Pidgin (chatting/messaging) program. I am using OTR (off the record - encrypts the text/chat) with Pidgin on XMPP (Jabber). The goal is so when people login I can send them messages. Basically offline messaging.
When you first send a message you need to wait for a second or two (sometime longer) for the message 'Successfully refreshed the' text to appear before the receiver gets the message. I have everything working great up to this point. I figured out how to 'copy and paste text' into an Array. The Array pops up a message box, so I see the text has been copied. How do i serach for the text in the Array, and have it loop as it waits for the text to appear? With a time out of 60 seconds.

#include <Array.au3>

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
WinWait("Untitled - Notepad","")
If Not WinActive("Untitled - Notepad","") Then WinActivate("Untitled - Notepad","")
WinWaitActive("Untitled - Notepad","")

Send("{CTRLDOWN}a{CTRLUP}")
Send("{CTRLDOWN}c{CTRLUP}")

$txt = ClipGet()
StringSplit( $txt, @CRLF, 1)
;MsgBox(0,"test", $txt, 0)

Local $ClipTxtArray[5]

Local $avLines = StringSplit( $txt, @CRLF, 1)
_ArrayDisplay($avLines)

 

Share this post


Link to post
Share on other sites



#2 ·  Posted

_ArraySearch is a function included in the AutoIT Array UDF.  There are a couple of examples in the help file.

You can employ a While or Do loop and use sleep (delays) and/or a timer to allot/track 60 seconds worth of time.  Personally, I would use a minimal sleep and a timer (TimerInit).  I'd suggest looking for the items in bold in the help file for some examples and seeing what you can piece together.  Let us know if you get stuck or don't understand how to accomplish what you want.

Share this post


Link to post
Share on other sites

#3 ·  Posted

$txt is what is copied 'clip get'?
Local $ClipTxtArray[5] <-- that is the array?
Local $avLines = StringSplit( $txt, @CRLF, 1)  <--  not sure I need that.
_ArraySearch($ClipTxtArray, "g6g6g6g sf hgfhf")  <--- searches Array for 'g6g6g6g sf hgfhf'?

Their is a lot I am not sure of with this. I have read of this in the Help and the forums. I looked at the Bold stuff. Still is as clear as mud :)
I don't want to do a file to do the search, as it will need to loop, until it finds the text. That will be many writes. Faster to do Array.

Thanks for any pointers. Some I grasp, some I need to learn.

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