Jump to content

Alterego

Active Members
  • Posts

    188
  • Joined

  • Last visited

Everything posted by Alterego

  1. Unless you have a legal time assiting you in writing our EULA, you are most likely digging yourself a hole. Legalese is a tricky business.
  2. You could have done it in one command using my _ScreenScrape UDF =)
  3. Or you could replace that second part with something like this: $alphabetsoup = StringSplit('z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a',',') $location = _ArrayBinarySearch($alphabetsoup,$sz_t) - 1 Return $alphabetsoup[$location]
  4. that thing works really well thanks! <h2[^>]*>(.*?)</h2>
  5. It appears that (<h2>.+</h2>) is the correct way. I could still go for that DllCall. I don't plan on learning a non-standard implementation of something so widely used across languages.
  6. I remember someone posting it but I can't find it. The built in regular expression engine just doesn't work correctly. I've verified that \<h2\>.+\<\/h2\> should match h2 tags with anything at all inbetween them, but the built in engine chokes on the 12th character colon in <h2>Template:Spanish-name and Template:Chinese-name</h2>. According to the help file, a period should Match any single character. Apparantly not! Anyway, if anyone knows where that dll is that would be helpful.
  7. You're trying to crack Captcha's with AutoIt? You must be nuts.
  8. I developed this because I am working with a program that does not have traditional GUI controls, meaning it definitely did not respect @SW_HIDE, and I wanted to completely move it off the screen before it had a chance to think. I was successful except for the brief flash of the splash screen. With this snippet of code and some trial and error timing, I was able to freeze the splash screen and get the title. As you will see with this code, notepad is frozen so quickly that it doesn't have a chance to draw the GUI. You will need to download process explorer from sysinternals and drop procexp.exe in your @WindowsDir. ;$letter equals the first letter of the process name. ;If the process will be the second, third etc... starting ;with that letter, enter the key n times to arrive at the ;correct process, e.g, _suspend('notepad.exe','nnn) $process = 'notepad.exe' $letter = 'n' Run($process,'',@SW_HIDE) _suspend($process,$letter) Func _suspend($process,$letter) Run("procexp.exe",'',@SW_HIDE) WinActivate("Process") ControlSend("Process",'',101,$letter & "!p{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}") ProcessClose("procexp.exe") EndFunc Edit: Just call _suspend() again to resume the process! suspend.au3
  9. I just modified larry's example to send a file from the server to the client, but it gets chopped off at around 500 bytes in length. I don't have time to modify it to send the data in smaller chunks, but it would be pretty easy. To use it, type 'fsend' on the server, and pick a text file, then click ok. When you close the client, it will write the first ~500 bytes of the server's text file to a file called "proofofconcept.txt" on your desktop... TCP_server_client.rar
  10. Matching only the first instance of something happens in your script, not in the expression. I leave translating this into AutoIt's homemade implementation an exercise for the reader. [a-zA-z]{1}[:\\][\d+|\w+|\s+\\]+[\d+|\w+|\s+]\.\w{3} Matches: C:\te43 st\fc oo\bar\ex ample.txt. <-- but not the period Doesn't match: Anything it shouldn't as far as I could tell
  11. I can see it now. A peer to peer program that actually works written in AutoIt.
  12. I have no idea what most of these do. #compiler_allow_decompile #compiler_au3check_dat #compiler_aut2exe #compiler_autoit3 #compiler_compression #compiler_icon #compiler_outfile #compiler_passphrase #compiler_prompt #compiler_res_comment #compiler_res_description #compiler_res_field #compiler_res_field1name #compiler_res_field1value #compiler_res_field2name #compiler_res_field2value #compiler_res_fileversion #compiler_res_legalcopyright #compiler_run_after #compiler_run_au3check #compiler_run_before
  13. I wonder, what of the possibility of then handling exceptions in the functions themselves by ByRef'ing them the for loops variable and allowing them to increment/decrement them. And it works. This is great, a never-ending loop: Global $a For $a = 1 to 2 _decrement($a) Next Func _decrement(ByRef $a) $a = $a - 1 EndFunc
  14. I see what you are getting at. It seems that it would guarantee the variables made it outside of the for loop and into the function no matter what. It requires just slightly more complex code but should be worth it in reliability. I'll update..
  15. That's the idea I was just having. This throws a scope error so it seems to work: Local $a = 0 For $a = 1 to 10 _increment() Next Func _increment() $a = $a + 1 EndFunc ClipPut($a)
  16. Oh? Is there such a thing as For Global $a = 1 to 10? /runs to check
  17. I would like to heavily functionalize the program. It has become very hard to maintain and bloated as more exceptions have become necessary over time.
  18. I seem to have had varying results in the past, although it is possible I was doing something wrong. As some of you may know by now ( ) I am fond of multi-tiered for loops due to the nature of automatically processing files in six languages, of three different types, for two different operating system and then either with or without images. So assume I have the following structure (which I do) in pseudocode: $lang = StringSplit('English,German,French,Dutch,Polish,esperanto') $wik = StringSplit('Wikipedia,Wiktionary,Wikiquote') $os = StringSplit('PPC,PALM') $img = StringSplit('TXT,IMG') For $a = 1 to lang[0] For $b = 1 to wik[0] For $c = 1 to os[0] For $d = 1 to img[0] logfile() Do a whole bunch of stuff tons of times over logfile() Next Next Next Next Func logfile() _FileWriteLog(@DesktopDir & '\log\' & $lang[$a] & '-' & $wik[$b] & '-' & $os[$c] & '-' & $img[$d] & '.txt') EndFunc This does not seem work with my loop, now over 300 lines. A few questions that, if anyone could answer would help me out a lot: 1) What is the actual scope of the for variable (local, global) ? 2) Should it be available outside of the loop in a subfunction? 3) Is it available outside of the subfunction? Because this does not seem to work for me it seems necessary to not use UDFs and repaste code etc... but that is not ideal. edit: update code to be more clear
  19. This example code will return the the number of pages Google has indexed on every single datacenter. This is very useful for webmasters observing the "google dance", which is pretty much a constant anymore. #Include <Array.au3> #include <Misc.au3> Global $results ;the website to check Global $website = 'autoitscript.com' ;all of Google's datacenters $DCs = StringSplit('64.233.161.99,64.233.161.104,64.233.161.105,64.233.161.147,64.233.167.99,64.233.167.104,64.233.1 67.147,64.233.171.99,64.233.171.104,64.233.171.105,64.233.171.147,64.233.179.99,64.233.179.99,64.233 .183.99,64.233.183.104,64.233.185.99,64.233.185.104,64.233.187.99,64.233.187.104,64.233.189.104,66.1 02.7.104,66.102.7.105,66.102.7.147,66.102.9.104,66.102.11.104,216.239.37.104,216.239.37.105,216.239. 37.147,216.239.39.104,216.239.53.104,216.239.57.98,216.239.57.104,216.239.57.105,216.239.57.147,216. 239.59.104,216.239.59.105,216.239.63.104', ',') For $loop = 1 To $DCs[0] ;the scraping code. i found very small unique before and after strings which are optimal. Global $pagesingoogle = _ScreenScrape ('http://' & $DCs[$loop] & '/search?hl=en&q=site%3A' & $website & '&btnG=Google+Search', 't <b>', '</b> f') ;update $results to equal the datacenter, a colon, the number of pages, and a line break for every iteration $results = $results & @CRLF & $DCs[$loop] & ' : ' & $pagesingoogle Next ClipPut($results) code is also attached. scrapegoogledatacenters.au3
  20. hum..ok..you guys really don't know how command line tools work (judging by my pms)....ok, you just google for 'lynx windows', go to any of the sites that are offering a download, unzip|rar|tar the executeable and copy it to your @HomeDrive &'\Windows\' directory
  21. they removed StringRegExpReplace from all releases I believe, so if you don't have it now you aren't going to get it. I'm not sure why this choice was made. alternative is to use the lynx example i provided. it returns better output anyway. lynx requires no installation. just download it from somewhere and drop it in \windows\
  22. sure. you can either run cygwin or download one compiled for win right, i don't know why that is, but you should be able to get along fine using the last code example i provided, as it only uses functions in the last stable distribution.
×
×
  • Create New...