Jump to content

Andrew Sparkes

Active Members
  • Posts

    57
  • Joined

  • Last visited

Everything posted by Andrew Sparkes

  1. If you need to, just do a regex on it. That would be the simplest way... You could just parse out the link url of the link you are looking for... Sparkes.
  2. Add something like this: HotKeySet('{F5}',"On") HotKeySet('{F6}',"Off") $flag=0 While 1 If $flag = 1 Then ; do stuff here ... EndIf WEnd Func On() $flag=1 EndFunc Func Off() $flag=0 EndFunc
  3. Use _IEFormSetElementValue() and _IEFormSubmit() check IE.au3 ... Make $form,$username,$password obj references to the form and the inputs, respectively. _IEFormSetElementValue($username,'username') _IEFormSetElementValue($password,'password') _IEFormSubmit($form) EDIT: To hit the submit button, try _IEClickLinkByText() I think that's what it's called... Sparkes.
  4. Use the Autoit Window info tool to get the coords, then pop them where they belong. The rectangle should be as small as the area you are checksumming. Just measure the bottom left point and the top right point, then take out the individual numbers and put them in. i.e. bottom left is 50, 200, top right is 100, 75 put them in like (50,75,100,200) I used random numbers... doesn't matter... Just use the window info tool, and you'll be fine. Read through the code sample in the helpfile too. Sparkes.
  5. I thought it was too easy of a problem to wait for it, so I wrote my own: Tell me if there are any problems, it should work right... it escapes all characters that aren't alphanumeric or a period. Func URLEscape($text) $newtext='' For $x=1 To StringLen($text) $char=StringMid($text,$x,1) If StringRegExp($char,'\A|\.',0) Then $newchar=$char Else $newchar="%"&Hex(Asc($char),2) EndIf $newtext=$newtext&$newchar Next Return $newtext EndFunc
  6. I hunted through the beta's helpfile and did a number of searches here, but have found nothing... What I need is a function to escape a string (using % as escape char) so it can pass nicely into a GET request. It has the same function as escape() in Javascript, but I need it in autoit. I can do it myself, but I was wondering if someone had already done it. If no one has done it, I'll use www.w3schools.com's reference and put the final function in scripts and scraps... i.e. turning 'email=myname@mydomain.com&password=mypass' into 'email=myname%40mydomain.com&password=mypass' Thanks, Sparkes.
  7. It browses to the default search page... Check The MSDN....
  8. Look through the _Array...() functions in the helpfile. They have some nice uses. You might want to declare the array and then add to it with _ArrayAdd()
  9. Use _IEDocReadHTML() and _IEDocWriteHTML(): ;=============================================================================== ; ; Function Name: _IEDocReadHTML() ; Description: Retrieves the full HTML source of a document ; Parameter(s): $o_object - InternetExplorer.Application, Window or Frame object ; Requirement(s): AutoIt3 Beta with COM support (post 3.1.1) ; Return Value(s): Success - HTML included in the <HTML> of the docuement, including the <HTML> and </HTML> tags ; Failure - 0 and sets @ERROR to 1 ; Author(s): Dale Hohm ; ;=============================================================================== ; Func _IEDocReadHTML($o_object) If IsObj($o_object) Then SetError(0) Return $o_object.document.getElementsByTagName("HTML").item(0).outerHTML Else SetError(1) Return 0 EndIf EndFunc ;=============================================================================== ; ; Function Name: _IEDocWriteHTML() ; Description: Replaces the HTML for the entire document ; Parameter(s): $o_object - InternetExplorer.Application, Window or Frame object ; $s_html - the HTML string to write to the document ; Requirement(s): AutoIt3 Beta with COM support (post 3.1.1) ; Return Value(s): Success - 1 ; Failure - 0 and sets @ERROR to 1 ; Author(s): Dale Hohm ; ;=============================================================================== ; Func _IEDocWriteHTML($o_object, $s_html) If IsObj($o_object) Then $o_object.document.Write($s_html) $o_object.document.close() SetError(0) Return 1 Else SetError(1) Return 0 EndIf EndFunc
  10. Almost. Add this instead of _IEDocWriteHTML($wantToDelete, $src): $src=StringReplace($src,$wantToDelete,'') _IEDocWriteHTML($IE,$src) I think you may run into problems with the array though. Try it and see what happens. If you need some array funcs, the Array.au3 include file has some handy ones... Sparkes.
  11. I don't know if it would work, but you could read the html into your script, then add $src=StringReplace($src,'NAME=""Name"">Policy Number','NAME=""Name"" Value='&$var&'>Policy Number') and then write it back to the window... I never tried working with vbscript, but I gave it a shot. Hope I helped, Sparkes.
  12. Yes, you are correct, if you want to do it that way, you'll need this: ;=============================================================================== ; ; Function Name: _IEDocWriteHTML() ; Description: Replaces the HTML for the entire document ; Parameter(s): $o_object - InternetExplorer.Application, Window or Frame object ; $s_html - the HTML string to write to the document ; Requirement(s): AutoIt3 Beta with COM support (post 3.1.1) ; Return Value(s): Success - 1 ; Failure - 0 and sets @ERROR to 1 ; Author(s): Dale Hohm ; ;=============================================================================== ; Func _IEDocWriteHTML($o_object, $s_html) If IsObj($o_object) Then $o_object.document.Write($s_html) $o_object.document.close() SetError(0) Return 1 Else SetError(1) Return 0 EndIf EndFunc
  13. #include <IE.au3> $IE=_IECreate() _IENavigate($IE,$url) $src=_IEDocReadHTML($IE) $stringyouwant=_StringBetween($src,'what is before the text','what is after the text') Func _StringBetween($s, $from, $to) $x = StringInStr($s, $from) + StringLen($from) $y = StringInStr(StringTrimLeft($s, $x), $to) If $x And $y Then Return StringMid($s, $x, $y) Else Return 0 EndIf EndFunc;==>_StringBetween ;=============================================================================== ; ; Function Name: _IEDocReadHTML() ; Description: Retrieves the full HTML source of a document ; Parameter(s): $o_object - InternetExplorer.Application, Window or Frame object ; Requirement(s): AutoIt3 Beta with COM support (post 3.1.1) ; Return Value(s): Success - HTML included in the <HTML> of the docuement, including the <HTML> and </HTML> tags ; Failure - 0 and sets @ERROR to 1 ; Author(s): Dale Hohm ; ;=============================================================================== ; Func _IEDocReadHTML($o_object) If IsObj($o_object) Then SetError(0) Return $o_object.document.getElementsByTagName("HTML").item(0).outerHTML Else SetError(1) Return 0 EndIf EndFunc EDIT: Just saw your second post. Look through some of the functions in IE.au3 that use the index. Use a method like that to get the index and then assign them in an array.... EDIT2: Typo... Urghhh
  14. Check Larry's post. That has exactly what you're looking for. It will checksum an area, and then find that area again and move the mouse there. I'm sure you can modify his code to suit your needs... Sparkes.
  15. You could use a combo of Pixelsearch(), PixelGetColor(), and PixelCheckSum()... Check the helpfile for those functions and try looping through and comparing the checksums of the bmp you want, and the bitmap at the coordinates...
  16. Is there any way in autoit to read and manipulate, and then save a picture? I looked around the scripts and scraps forum as way as the help file, and all I found was LazyCat's ImageGetInfo udf. The best way I could think of to do what I want, would be to read each pixel into autoit as a hex or decimal color into an array. A very large array..... Is there anything like that that anyone knows of? Like a _ReadImageIntoArray() function or similar? If I wanted to modify images in autoit, how would I go about doing so? I can only hope that it is simpler than what is inside LazyCat's udf... Could the gd library for php be used in autoit? or perhaps the CImg library in C++? Is there a way to read an image, then use a Pixelcolorsearch type process then replace a certain color? or pattern of colors? I would post code, but I have little idea where to start...
  17. I am not sure. I have never used it for .htaccess pages... If your code isn't working, double and triple check that you have the right params for the Control...() functions. Perhaps your could try ControlSend() ... That may work... Other than that, I'm afraid I can't help you... It would be a nice feature of the new build of IE.au3 to see it able to fix your problem... Sparkes. EDIT: Typo
  18. Use _IEFormGetObjByIndex() ... Check the IE.au3 documentation on how to use, but it works nicely like so: $email="your email here" $password="your password here" $oForm=_IEFormGetObjByIndex($IE_window,0) $oEmail=_IEFormElementGetObjByName($oForm,"email") $oPassword=_IEFormElementGetObjByName($oForm,"password") _IEFormSetValue($oEmail,$email) _IEFormSetValue($oPassword,$password)
  19. Instead of trying the Control...() Functions, try _IEForm...() _IEFormGetObjByIndex() Obtain an object variable reference to a form by 0-based index _IEFormGetObjByName() Obtain an object variable reference to a form by name _IEFormElementGetObjByIndex() Obtain a object reference to a form element within a form by 0-based index _IEFormElementGetObjByName() Obtain a object reference to a form element within a form by name _IEFormElementGetValue() Get the value of a specifid form element _IEFormElementSetValue() Set the value of a specified form element _IEFormSubmit() Submit a specified form Those should work for you. IE.au3 is a wonderful file. Sparkes.
  20. I hope no one minds me raising this topic from the dead, but I put together greenmachines code and made a function... I don't know if this is in the new IE.au3, but if anyone wants it, it works just like _IEClickImg() ... Func _IEFormClickImg($o_object, $s_linkText, $s_mode = "src", $i_index = 0, $f_wait = 1) $doc = _IEDocumentGetObj ($o_object) $oInputs = _IETagNameGetCollection (_IEDocumentGetObj ($o_object), "input") $found = 0 $s_mode = StringLower($s_mode) For $oInput In $oInputs Select Case $s_mode = "name" $linkText = $oInput.name Case $s_mode = "src" $linkText = $oInput.src Case Else ;; Invalid mode SetError(99) Return 0 EndSelect If StringInStr($linkText, $s_linkText) Then if ($found = $i_index) Then $result = $oInput.click Sleep(500); Allow readystate to change before proceeding If ($f_wait = 1) Then _IELoadWait($o_object) SetError(0) Return 1 EndIf $found = $found + 1 EndIf Next SetError(1) Return 0 EndFunc
  21. If you are disabling all the keys and mouse movements, just use BlockInput(1) ...
  22. IE.au3 can get the source and you can parse accordingly to get the text, but the actual position of the text is hard to get... Why do you need the position?
  23. The key code for slash is just "/", and the key code for the Win key is {#}, but when I test it, it doesn't work. The helpfile has a big long section on the send keys, check index for Send Key List, that should help... Note: I don't think you can have a forward slash in your function name...
  24. If you really want faster than that, look up winsock and DllCall() to send out http requests. It's not easy stuff, so consider yourself warned.... Sparkes.
  25. What minimize key? There is no minimize key on any keyboard I've seen....
×
×
  • Create New...