RGBreality Posted July 9, 2010 Share Posted July 9, 2010 Hey, folks! First, let me say that I'm very new to using AutoIt, so I'll need a lot of hand-holding... I'm trying to write a script which does the following actions to automate search functionality with a document search engine that runs only through a console window: 1.) Launch the console window. (No problem with the script.) 2.) Update, then open the index used to perform text searches. (No problem with the script.) 3.) Pause the script until it detects generic text in the Windows Clipboard; this text is supplied by a third-party application, and once the end user clicks the "Search" button to search for that text string in the body of documents, the third-party application will put the text string into the Windows Clipboard so the AutoIt script can access it. 4.) Copy the text from the Windows Clipboard. 5.) Automatically type "Find [sPACE]", then paste the contents of the Windows Clipboard into the console window. 6.) The console window will perform the search, then return to display all the hits in the body of documents. In that returned display will be six attributes of each hit (such as the file name, directory of the file, file size, etc.). The AutoIt script then needs to capture the results, then parse them so the results can be displayed in a grid/array/spreadsheet like layout. With a little help from a stranger on this fine forum, I was able to set up the Run and StdOutRead functions. However, I am having problems with the copy functions. And I haven't gotten far enough to know what problems or challenges I may have in parsing the text for spreadsheet layout. Below is my existing script thus far: expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Compression=4 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",2) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) #include <Constants.au3> #Include <Clipboard.au3> #Include <GuiRichEdit.au3> Global $iPID = Run("C:\Apppath\Application.exe", "C:\Apppath", @SW_SHOW, $STDERR_CHILD + $STDOUT_CHILD) MouseMove(28,32) MouseDown("left") MouseUp("left") MouseMove(28,32) Send("update{SPACE}{SHIFTDOWN}u{SHIFTUP}ltimus{SPACE}{SHIFTDOWN}a{SHIFTUP}daptive{SPACE}{SHIFTDOWN}bpm{SPACE}s{SHIFTUP}uite{SPACE}8{SPACE}{SHIFTDOWN}d{SHIFTUP}ocumentation{ENTER}") Send("open{SPACE}{SHIFTDOWN}u{SHIFTUP}ltimus{SPACE}{SHIFTDOWN}a{SHIFTUP}daptive{SPACE}{SHIFTDOWN}bpm{SPACE}s{SHIFTUP}uite{SPACE}8{SPACE}{SHIFTDOWN}d{SHIFTUP}ocumentation{ENTER}") WinWaitActive ("wilmacmd.exe") _ClipBoard_IsFormatAvailable([$CF_TEXT]) _ClipBoard_GetData([$CF_TEXT = 1]) Send("find{SPACE}") _GUICtrlRichEdit_Paste($0x0197034E) Send("{ENTER}") Send("listresults 10000{ENTER}") Global $line = " " While 1 $line = StdOutRead($iPID) If @error Then ExitLoop MsgBox(0, "StdOutRead: " & $iPID, $line) WEnd While 1 $line = StdErrRead($iPID) If @error Then ExitLoop MsgBox(0, "StdErrRead: " & $iPID, $line) WEnd MsgBox(0, "Debug") I'm not only at a loss on how to fix the clipboard functions (IsFormatAvailable and GetData), but I don't know how I would parse the text results. Any ideas? Thank you very much in advance for your assistance! Most gratefully... RGBreality Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now