PocketPig Posted April 14, 2008 Share Posted April 14, 2008 (edited) oookayy first im sorry for my english skills, its hard to speak in english but i'll try my best... autoit3 is completely new for me, I need it first for automize some processes in IE6, I just get some basic knowledge in HTML and thats why i have problems with controlling IE6 by AutoIt3-Scripts...what I did yet is working through some tutorials about autoit, but that gaves only general informations and commands about it... first, I want to write a script that opens a special site in IE6, that should be easy to realize: #include <IE.au3> _IECreate("http://www.********.com", 1, 1) If IsObj($oIE) Then _IELoadWait($oIE) now the site should be up...in the following i want to login, and here I got some problems because I dont know how to work with different HTML-forms...are there any tutorials that are specialized on commands with IE6? For example I dont know how to activate any buttons, how to search for them, or how I can write sth. into text-panels... here the part where to login: <form method="post" action="/passwort" id="login" onsubmit="java script:ssl();"> <div class="libo"><div style="height:10px"></div><div style="text-indent:8pt">Login:</div></div> <div class="lib"> name:<br><input type="text" name="login" class="libf"><br> password:<br><input type="password" name="login[p]" class="libf"><input type="submit" name="Submit" value="login"><br> <a href="/passwort" class="ql" style="font-size:9px">forget password?</a><br> <input type="checkbox" id="ssl_login" checked><a href="/infos/ssl/" class="ql" style="font-size:10px;font-family:arial">with SSL-codification</a><br> </div> </form> I think a form is a html-part with editable objects, right? so there are to boxes where you can fill in your member-name and your password, the boxes type is declared in the html reader when im right...and now, how can I (because member-name and password are filled in automatically) just send the entered informations? in realtime, i have to press "enter" on the keyboard, but how does autoit do? ufff there are so many left questions, but first I would be satisfied if Login works hope you can help me... EDIT: maybe another question: what I just need is a program you can control mouse and keyboard with, I need to write a bot that automizes processes in a webbrowser, ive chosen autoit3 because it seemed to be perfect because it includes special webbrowser-commands...first i tried out autohotkey, but it seemed to be outdated...autoit3 is much more complicated and it would need some time to be able to write such scripts, but its the best choice for my tasks..isnt it? or do you know another helpful program I can control browsers with? Edited April 14, 2008 by PocketPig Link to comment Share on other sites More sharing options...
spudw2k Posted April 14, 2008 Share Posted April 14, 2008 (edited) Check out this example of how to automate a google search. Should point you in the right direction. (Second Post)Linkedit: forgot to post link #Include <IE.au3> $oIE = _IECreate("http://www.********.com", 1, 1) $oForm = _IEFormGetObjByName ($oIE, "login") $oUsername = _IEFormElementGetObjByName ($oForm, "login[u]") $oPassword = _IEFormElementGetObjByName ($oForm, "login[p]") _IEFormElementSetValue ($oUsername, "username") _IEFormElementSetValue ($oUsername, "password") _IEFormSubmit ($oForm) Edited April 14, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
PocketPig Posted April 14, 2008 Author Share Posted April 14, 2008 thanks therefore, but ive got another question: with the command _IEFormGetObjByName($site, "login") I can chose a special form in the html-source that is opened, but what is if the form is not named with the <name="*"> tag but with the <id="*"> tag..? Link to comment Share on other sites More sharing options...
spudw2k Posted April 14, 2008 Share Posted April 14, 2008 (edited) thanks therefore, but ive got another question: with the command _IEFormGetObjByName($site, "login") I can chose a special form in the html-source that is opened, but what is if the form is not named with the <name="*"> tag but with the <id="*"> tag..?I think it should work the same. This code runs against Dogpile, which uses id's instead of names. #Include <IE.au3> $oIE = _IECreate("http://www.dogpile.com", 1, 1) $oForm = _IEFormGetObjByName ($oIE, "aspnetForm") $oQuery = _IEFormElementGetObjByName ($oForm, "icePage_SearchBoxTop_qkw") _IEFormElementSetValue ($oQuery, "This is a test") Edited April 14, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
PocketPig Posted April 14, 2008 Author Share Posted April 14, 2008 okay thanks a lot the script is still growing, login works, switching between different sites, working with listboxes and checkboxes...all works fine, ive done a lot till now but there is a new problem: in the html-source of the page is a tag with a variable in itself, the tag itself is included 10 or more times in the file...(its like this: "<bla anything="1" bla="5">user1</bla>, the tag repeats often, but the part of "user1" changes, not only the letters but also the length) can you tell me how I search for user1, user2 etc? I have to search bewteen the 2 known tags <bla anything="1" bla="5"> AND </bla>, so i just need the string bewteen those two tags, but i dont know how to pick it out...I hope youll help me again, thanks good night Link to comment Share on other sites More sharing options...
spudw2k Posted April 15, 2008 Share Posted April 15, 2008 There's many ways to parse text. My way may not be the most efficient, but it's just how I would do it. If you know the static tags, and you have a specific occurence you want to read, then you can use StringInstr() to find it. For Example, this code searchs a string variable for the 5th occurence of the "<tag id='tag'>" and trims the text. $str = "" For $x = 1 to 8 ;Generate String $str = $str & "<tag id='tag'>User" & $x & "</tag>" & @CRLF Next MsgBox(0,"Original String",$str) $tag1 = StringInStr($str,"<tag id='tag'>",0,5) + 13 ;<--- Plus Length of the string searching for - 1, to offset string to retrive. $strResult1 = StringTrimLeft($str,$tag1) $tag2 = StringInstr($strResult1,"</tag>") $strResult1 = StringTrimRight($strResult1,StringLen($strResult1)-$tag2+1) ;<--- Plus 1 for offset msgbox(0,"Text Found",$strResult1) Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
PocketPig Posted April 15, 2008 Author Share Posted April 15, 2008 hmmmm okay thanks, but it doesnt work...io tried it out, but your code did not help me well I quotated the part with the strings I want to copy: <li><a href="/user/pocketpigexample"> <p><img src="http://s1.censored.tv/x.gif" width="65" height="75" class="fuUb"></p> <div class="erNick"><span class="ni"> w 18 Babygirl890</span></div> <p> <img src="http://s1.censored.tv/y.gif" width="15" height="15" class="vaBot"> <strong></strong> aus <br><strong>Status: </strong> <br><strong>Last Login: </strong><br>05.04.2008 - 18:53 </p> </a></li> <li><a href="/user/pocketpig2"> <p><img src="http://s1.censored.tv/x.gif" width="65" height="75" class="fuUb"></p> <div class="erNick"><span class="ni"> w 18 GP_Lady</span></div> <p> <img src="http://s1.censored.tv/y.gif" width="15" height="15" class="vaBot"> <strong></strong> aus <br><strong>Status: </strong> <br><strong>Last Login: </strong><br>14.04.2008 - 20:39 </p> </a></li>this is a html source code of a page...the lines are various, the length of the username too...What I want to do is to copy those usernames into a .txt-file...i dont know how...somebody knows?? Link to comment Share on other sites More sharing options...
PocketPig Posted April 16, 2008 Author Share Posted April 16, 2008 hmm noone an idea? sorry for doubleposting, but I cant believe that my thread is on page 4 after 1 day Oo Link to comment Share on other sites More sharing options...
FreeFry Posted April 16, 2008 Share Posted April 16, 2008 You could use something like this? $ieObj = _IECreate("http://www.autoitscript.com/forum/index.php?act=UserCP") $oLinks = _IELinkGetCollection($ieObj) For $element In $oLinks $Link = $element.href If StringInStr($Link, "user") Then $Username = StringTrimLeft($Link, StringInStr($Link, "user", 0, -1)-1) ConsoleWrite($Username & @LF) EndIf Next That will output all links containing "user", and I'm guess that's what you want? Link to comment Share on other sites More sharing options...
PocketPig Posted April 17, 2008 Author Share Posted April 17, 2008 ohhh yes, helepd me a lot, thanks I nearly reached the end, not too far anymore but theres still a new problem:For $element In $oLinks $Link = $element.href If StringInStr($Link, "user") Then $Username = StringTrimLeft($Link, StringInStr($Link, "user", 0, -1)-1) $check = FileOpen("check.txt", 1) If StringinStr($check, $Username) Then FileClose($check) Else FileWrite($check, $Username & @CRLF) FileClose($check) EndIf EndIfNexthow u can see does the script save alle those "user-tags" in the check.txt file...when such a tag is already included in that file, the script shouldnt add it again to it...bnut how to realize this? because my version doestn work he saves every username without checking if its already in the file... Link to comment Share on other sites More sharing options...
FreeFry Posted April 17, 2008 Share Posted April 17, 2008 Delete the old user-file before running the script? Other than that you could do a If Not StringInStr(...) Then ... but that would require you to read the content of the user-file first... Link to comment Share on other sites More sharing options...
PocketPig Posted April 17, 2008 Author Share Posted April 17, 2008 well he should not delete the old file because i want to collect as much as usernames as possble, but noone should be included more than one time in the file...so i wont delete the file before restartijng the script... Link to comment Share on other sites More sharing options...
FreeFry Posted April 17, 2008 Share Posted April 17, 2008 (edited) Well the version i posted will go through all users with id:s in the range 0 to 1000( you can increase it if you want ), so you won't "loose" any users.But still you can use the StringInStr method I mentioned above if you really want it to add to the file on start.Edit:Alternatively you could just store the userid it was on the last time it ran and was quit, and have it continue from there.. Edited April 17, 2008 by FreeFry Link to comment Share on other sites More sharing options...
PocketPig Posted April 17, 2008 Author Share Posted April 17, 2008 (edited) well he should not delete the old file because i want to collect as much as usernames as possble, but noone should be included more than one time in the file...so i wont delete the file before restartijng the script...$Username = StringTrimLeft($Link, StringInStr($Link, "user", 0, -1)-1)$check = FileOpen("check.txt", 1)If Not StringInStr($check, $Username) Then i think one of the both lines above should be the problem...maybe $check isnt a string variable...?EDIT:Alternatively you could just store the userid it was on the last time it ran and was quit, and have it continue from there..no that doesnt work...really, i cannot continue where i quit the script.. Edited April 17, 2008 by PocketPig Link to comment Share on other sites More sharing options...
FreeFry Posted April 17, 2008 Share Posted April 17, 2008 Change $check = FileOpen("check.txt", 1)oÝ÷ ÚÚºÚ"µÍÌÍØÚXÚÈH[TXY ][ÝØÚXÚË ][ÝÊ Link to comment Share on other sites More sharing options...
GEOSoft Posted April 17, 2008 Share Posted April 17, 2008 (edited) Change this $check = FileOpen("check.txt", 1) If StringinStr($check, $Username) Then FileClose($check) To If StringInStr(FileRead("check.txt"), $Username) Then That could still potentially pose a problem. In particular with a situation where "pocketpig2" was already in the text file and you wanted to search for "pocketpig". To get around that you should #include file.au3. Use $mArray = "" _FileReadToArray("check.txt", $mArray) Then loop through the array with something like For $I = 1 To Ubound($array)-1 If $array[$I] == $Username Then ExitLoop Else FileWriteLine("check.txt", $Username) EndIf Next Edited April 17, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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