lokeycmos Posted January 20, 2009 Posted January 20, 2009 i am making an autoit script to update blocklist manager. i have it working successfully, but i want to make it better. what i want todo is add the number of blocked ips and the error count(if any) to the final message box. but todo this i need to extract the information from blocklist manger. the other thing is that the number of blocked ips is dynamic. here is what my code looks like and i have attached a pic. can someone please post a snippet of code that shows how to extract the text so i can put it in a string variable? ; Prompt the user to run the script - use a Yes/No prompt $answer = MsgBox(36, "Update Script", "This script will launch Blocklist Manager, update lists, and import to PeerGuardian, Run?") ; Check the user's answer to the prompt ; If "No" was clicked (7) then exit the script If $answer = 7 Then MsgBox(0, "AutoIt", "OK. Bye!") Exit EndIf ; Run Blocklist Run("C:\Program Files\Bluetack\Blocklist Manager\BlockMgr.exe") ; Wait for Blocklist Manager to become active WinWaitActive("Blocklist Manager") ; Process Blocklists Send ("^p") ; Wait for Blocklists to finish downloading WinWaitActive("Blocklist Manager", "BLM Version: 2.7.7") ; Launch Blocklist Converter Send ("^v") ; Wait for Blocklist Manager converter to become active WinWaitActive("Convert from Memory Array...") ; Start Blocklist Converter Send ("!v") ; Wait for Conversion to Finish by changing focus, waiting for "Conversion Complete" then changing focus back to "Convert from Memory Array..." WinActivate("Blocklist Manager") WinWaitActive("Blocklist Manager", "Conversion Complete.") WinActivate("Convert from Memory Array...") ; Save Output As Send ("!a") ; Wait for Save As window to become active WinWaitActive("Save As") Sleep(1000) ; Save file as Paranoid Blocklist.p2p Send("Paranoid Blocklist.p2p") Sleep(1000) Send("{ENTER}") Sleep(1000) Send("!y") ; Wait for save to finish WinWaitClose("Save As") ; Close convert from memory array window WinClose("Convert from Memory Array...") WinWaitClose("Convert from Memory Array...") ; Close blocklist manager WinClose("Blocklist Manager") WinWaitClose("Blocklist Manager") ;Show Final Prompt and number of blocked IP's MsgBox(64, "Update Script", "Update Completed Succesfully!")
lokeycmos Posted January 20, 2009 Author Posted January 20, 2009 i was looking at WinGetText ( "title" [, "text"] ) ,but how does this work if the text is dynamic? i was thinking that i could use StringRight along with it, because the begining of the text will always start as "total ip count:" since this is my 1st time using autoit, im hoping someone can post some example snippets of code. thank you everyone!
torels Posted January 20, 2009 Posted January 20, 2009 please use autoit or code tags! Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org
azure Posted January 20, 2009 Posted January 20, 2009 i was looking at WinGetText ( "title" [, "text"] ) ,but how does this work if the text is dynamic? i was thinking that i could use StringRight along with it, because the begining of the text will always start as "total ip count:" since this is my 1st time using autoit, im hoping someone can post some example snippets of code. thank you everyone! Try some options. Opt("option",value) WinDetectHiddenText Specifies if hidden window text can be "seen" by the window matching functions. 0 = Do not detect hidden text (default) 1 = Detect hidden text WinSearchChildren Allows the window search routines to search child windows as well as top-level windows. 0 = Only search top-level windows (default) 1 = Search top-level and child windows WinTextMatchMode Alters the method that is used to match window text during search operations. 1 = Complete / Slow mode (default) 2 = Quick mode In quick mode AutoIt can usually only "see" dialog text, button text and the captions of some controls. In the default mode much more text can be seen (for instance the contents of the Notepad window). If you are having performance problems when performing many window searches then changing to the "quick" mode may help. WinTitleMatchMode Alters the method that is used to match window titles during search operations. 1 = Match the title from the start (default) 2 = Match any substring in the title 3 = Exact title match 4 = Advanced mode, see Window Titles & Text (Advanced) -1 to -4 = force lower case match according to other type of match.
lokeycmos Posted January 20, 2009 Author Posted January 20, 2009 im a total noob to autoit. please elaborate. if you look at the highlited text in the attached pic, i basically just want the numbers after "total ip count" to be assigned to a string. i know that autoit can read the text if you look at the 6th block of posted code. i dont want to sound like a dumass but can you post some code for me?(im a pc technician, not a programmer ) thank you very much!
azure Posted January 20, 2009 Posted January 20, 2009 im a total noob to autoit. please elaborate. if you look at the highlited text in the attached pic, i basically just want the numbers after "total ip count" to be assigned to a string. i know that autoit can read the text if you look at the 6th block of posted code. i dont want to sound like a dumass but can you post some code for me?(im a pc technician, not a programmer ) thank you very much!Is this visible text seen by the AutoIt Window Info?
lokeycmos Posted January 21, 2009 Author Posted January 21, 2009 ok, i think ive got this figured out. the (modified) code from this post: http://www.autoitscript.com/forum/index.ph...opy+window+text is what im looking for. but how does this work if say the window is a different size or position than when the origional coordinates where entered in?
lokeycmos Posted January 23, 2009 Author Posted January 23, 2009 new problem. how can i remove the commas in a string of numbers? for example, if the clipboard contains 123,456,789,123 $DenyIPString = ClipGet() $DenyIPCount = StringReplace("$DenyIPString", ",", "") this does not seem to be working for me. ive also tried number("$DenyIPString") any suggestions would be greatly appreciated!
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