Jump to content

orange

Active Members
  • Posts

    172
  • Joined

  • Last visited

Everything posted by orange

  1. Thank you thank you thank you!!!! Everything works great!!!! Again. apologies to Zedna - I misunderstood your response.
  2. Apologies to the first reply post - I read through too quickly. I'll try these suggestions out and post back the result. Thanks.
  3. Thanks for the reply, but that doesn't answer my question. Parsing the XML isn't the issue - the issue is that by using IE I cannot view, edit, or otherwise RETRIEVE the XML. That's the problem with IE. Try opening XML in IE via viewsource or saveas, and you'll get an error "IE cannot open this file" or somthing like that. Save As also does not work. This is not unique to my machine either - I'm not asking "whats wrong with this IE?!!?!" This is a feature (documented on msdn) that I'm trying to get around.
  4. It looks to me like you're not properly resetting $iDloadFinalSize to "" when you complete a download. That makes you hange in the while loop, and you don't move on to the second one. I'd suggest running a watch on $iDloadCurrentSize and $iDloadFinalSize to make sure that they're exactly equal when a download finishes.
  5. If you're just looking for that word, then StringBetween() is less of a headache. $ResultArray = _StringBetween($test,"is hit with "," for")
  6. I am writing a small tool for work. I need to submit a form to an off-site server that is either POST or GET (depending on query length), and parse through a returned XML file. Here are my problems: At my company, all browsers except IE 6 are blocked. Using IE.au3, I can open and properly submit the form via post or get, but I cannot parse the returned XML since IE blocks that. Using http.au3, I can spoof an IE useragent string, but cannot connect to the server at all. No @errors nor @extended errors returned either. I believe our firewall is blocking me. Following the examples on the http.au3 host thread, I cannot get POST or GET to work. Here are my questions: If I use IE, is there a way to dowload the returned XML? If I use TCP (via http.au3), is there a way to correctly connect with the server that I am missing? Here is a POST header recorded with Fetch: This is driving me nuts. Please, any input helps.
  7. I'm trying this from CPPMAN Func _FileReadBytes($sFileName, $nStart, $nEnd) Local $nBytesToRead = $nEnd - $nStart Local $ResultBuffer = DLLStructCreate("byte[" & $nBytesToRead & "]") Local $BytesRead = 0 Local $OverlappedStruct = DLLStructCreate($tagOVERLAPPED) Local $ResultString = "" DLLStructSetData($OverlappedStruct, "Offset", $nStart) $hFile = _WinAPI_CreateFile($sFileName, 2, 2, 2, 4, 0) if ($hFile == 0) Then return "" if (_WinAPI_ReadFile($hFile, DLLStructGetPtr($ResultBuffer), $nBytesToRead, $BytesRead, DLLStructGetPtr($OverlappedStruct)) <> true) then _WinAPI_CloseHandle($hFile) Return "" EndIf For $i = 1 to $nBytesToRead + 1 $ResultString &= Chr(DLLStructGetData($ResultBuffer, 1, $i)) Next _WinAPI_CloseHandle($hFile) Return $ResultString EndFunc
  8. I am trying to parse a VERY large single-line file, and I'm running into the obvious issue that variables can only store so much information before they have met their allocation. I have XML files that are dumped from a search service that return 20mb+ of results in a single line XML file. Obviously, I have to break that up somehow, but I'm at a loss. Can anybody help me out with this? Can I read the file byte by byte or word by word? How can I do this elegantly? Speed is a crucial issue. Thanks in advance.
  9. Intro: Frequent Autoit user 2-3 years ago, need basic XML reading, seached forums & attempted examples, but could not get to work with my specific XML formatting. I am at my wits end trying to understand the filestructure and Xpath syntax that works or doesn't work with this wrapper. I am having difficutly reading anything from this particular file, since all the nodes are named the same. <?xml version="1.0" encoding="UTF-8"?> <xml-dump version="1.0"> <documentlist number="1"> <param1>1a</param1> <param2>2a</param2> <documents number="1"> <document id ="12341938741"> <paragraph name="First Information"> <paragraphdata name="TYPE"></paragraphdata> </paragraph> <paragraph name="Second Information"> <paragraphdata name="TYPE"></paragraphdata> </paragraph> </document> <document id ="456789321"> <paragraph name="First Information"> <paragraphdata name="TYPE"></paragraphdata> </paragraph> <paragraph name="Second Information"> <paragraphdata name="TYPE"></paragraphdata> </paragraph> </document> </documents> </documentlist> </xml-dump> Essentially, I have a list of documents that have their information stored in XML. Any help figuring out this child-node mess is greatly appreciated. Thanks.
  10. What really helped me a few years ago when I started AutoIt was looking through the Example Script section of the forums. There you are going to find hundreds of thousands of lines of code from the most complex to the very simple. If you are looking to make this program a bit more interesting try using the msgbox() function. You can find information on this function in the help files of the SciTe script editor (available on the AutoIt download page) Good luck, and welcome.
  11. try searching in help for "computer name" its the first result for me. msgbox (0,0, @ComputerName)
  12. Just have the initial run set on minute 1 and then use a 15 minute timer.
  13. User authority - and I am blocked from internet connection sharing. The only permitted connection between computers is a non-bridged ad-hoc network. My question more hinges on the network interface problem. Can an autoit program send packets only to one interface? Its my understanding the the default network interface in windows is where all packets are sent. The default is set by the user (which I can't do because of admin rights) and otherwise defaults to the fastest internet connection - in my case, the ethernet and not the wireless ad-hoc network. Thoughts?
  14. Here is the situation: I have a very underpowered workstation at work, and a very powerful personal laptop. I have IT permission to use the laptop just so long as I don't access the company's intra or internet. I can setup an ad-hoc wireless network between the computers, so long as there is no network bridging on the workstation. Right now, working on my personal laptop is worlds faster than on the work computer, and I have been doing file transfers via thumb drive. It's getting a little old. Would it be worth my while to attempt to write an IP based filesharing system that was specific to one network connection (I will have the workstation connected to two networks and would need to select the proper interfact), or is this a pipe dream? EDIT - Oh yeah, the reason that I am doing this is that filesharing is disabled for ad-hoc networks in firewall settings and I cannot install ANYTHING on the computer. I can run an executable though, so I am hoping that autoit can help. Any input is greatly appreciated. Orange
  15. Note update GUI and options... Thoughts?
  16. Well, actually, due to the fact that it takes almost a second to parse through a single web page after the link is found on google, the program only searches through the first 10 hits. Of course you can change that, with the "max" results. At that point, the first 10 results of a 77,000 item search will probably be exactly the same as the 7000 search.
  17. Tested on Vista -- works. ;Converted to work in 3.2.10.0 #include <GUIConstants.au3> #include <GuiComboBox.au3> #include <INET.au3> #include <array.au3> #include <GuiListView.au3> Opt("GUIOnEventMode", 1) #Region ### $MainGUI = GUICreate("Google File Downloader", 600, 552, 193, 115) GUISetOnEvent($GUI_EVENT_CLOSE, "MainGUIClose") $AvailableFilesListBox = GUICtrlCreateListView("File Name|Size|Type|Location", 8, 168, 585, 329) $FileInfomationGroup = GUICtrlCreateGroup("Search", 8, 8, 297, 105) $SearchText = GUICtrlCreateInput("", 16, 27, 281, 21) $FileTypeCombo = GUICtrlCreateCombo("", 152, 53, 144, 25) GUICtrlSetOnEvent(-1, "FileTypeComboChange") GUICtrlSetData($FileTypeCombo,"Music|Movies|Programs|Images|CD/DVD Images|Torrents|Archives|Documents|Other") _GUICtrlComboBox_SelectString($FileTypeCombo, "Music") $FileTypeLabel = GUICtrlCreateLabel("File Type to Search For:", 16, 56, 117, 17) $ExtensionListEditBox = GUICtrlCreateInput("", 152, 83, 145, 21) $FileExtensionLabel = GUICtrlCreateLabel("Extension List:", 16, 86, 72, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $SearchLimiterGroup = GUICtrlCreateGroup("Options", 312, 8, 281, 105) $MinimumFileFilterEnable = GUICtrlCreateCheckbox("Only Return Files Greater Than:", 320, 32, 177, 17) $MinimumFileSizeEditBox = GUICtrlCreateInput("0", 504, 29, 49, 21) $MBLabel = GUICtrlCreateLabel("MB", 565, 32, 20, 17) $EnableProgressBar = GUICtrlCreateCheckbox("Show Progress Bar", 320, 56, 177, 17) GUICtrlSetState(-1,$Gui_CHECKED) $SearchDepthLabel = GUICtrlCreateLabel("Maximum Google Results to Parse:", 320, 80, 168, 17) $MaxResultsInput = GUICtrlCreateInput("10", 496, 76, 81, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $SearchButton = GUICtrlCreateButton("Search", 8, 120, 297, 33, 0) GUICtrlSetOnEvent(-1, "SearchButtonclick") $DownloadButton = GUICtrlCreateButton("Download", 296, 504, 297, 40, 0) GUICtrlSetOnEvent(-1, "DownloadButtonclick") $ProgressBar = GUICtrlCreateProgress(8, 504, 281, 17) $ProgressInfoLabel = GUICtrlCreateLabel("Progress Info", 8, 528, 200, 17) $SearchTermLimiter = GUICtrlCreateCheckbox("Include Search Terms in Filename", 320, 132, 277, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### FileTypeComboChange() While 1 Sleep(100) WEnd Func Progress($Percent, $Text) guictrlsetdata($ProgressBar, $Percent) guictrlsetdata($ProgressInfoLabel, $Text) EndFunc Func DownloadButtonclick() $SelectionIndex = _GUICtrlListView_GetNextItem($AvailableFilesListBox) $SelectedText = _GUICtrlListView_GetItemTextString($AvailableFilesListBox,$SelectionIndex) $LineArray = StringSplit($SelectedText,"|") $SaveFile = FileSaveDialog("Download File To...",@DesktopCommonDir,"","",$LineArray[1]) $Size = InetGetSize($LineArray[4]) Inetget($LineArray[4],$SaveFile,1,1) While @InetGetActive Progress(@InetGetBytesRead/$Size*100, Stringformat("%.2f", @InetGetBytesRead/1000) & " Kb") Sleep(250) Wend Progress(0,"Complete") EndFunc Func MainGUIClose() Exit EndFunc Func FileTypeComboChange() $TypeToFind = Guictrlread($FileTypeCombo) Select case $TypeToFind = "Music" Guictrlsetdata($ExtensionListEditBox, "mp3 mp4 wma ogg flac aiff raw au gsm dct vox aac m4a atrac ra ram msv dvf m4p") case $TypeToFind = "Movies" Guictrlsetdata($ExtensionListEditBox, "3gp asf asx avi mov mpg mpeg mp4 ogm qt rm swf flv vob wmv") case $TypeToFind = "Programs" Guictrlsetdata($ExtensionListEditBox, "msi exe zip rar app") case $TypeToFind = "Images" Guictrlsetdata($ExtensionListEditBox, "jpg jpeg bmp tiff tif raw png gif ppm pgm pbm pnm svg") case $TypeToFind = "CD/DVD Images" Guictrlsetdata($ExtensionListEditBox, "iso bin cue vob nrg dmg mds ccd dvd") case $TypeToFind = "Torrents" Guictrlsetdata($ExtensionListEditBox, "torrent") case $TypeToFind = "Archives" Guictrlsetdata($ExtensionListEditBox, "zip rar 7z") case $TypeToFind = "Documents" Guictrlsetdata($ExtensionListEditBox, "doc pdf odt txt rtf") case Else GUICtrlSetData($ExtensionListEditBox, "") EndSelect EndFunc Func SearchButtonclick() $Query = Guictrlread($SearchText) $FileTypes = guictrlread($ExtensionListEditBox) $Delimiter = " " $MaxResults = guictrlread($MaxResultsInput) if guictrlread($SearchTermLimiter) = $GUI_CHECKED then $LimitSearch = True Else $LimitSearch = False EndIf if guictrlread($MinimumFileFilterEnable) = $GUI_CHECKED then $MinimumFileSize = guictrlread($MinimumFileSizeEditBox) Else $MinimumFileSize = 0 EndIf if guictrlread($EnableProgressBar) = $GUI_CHECKED then $ProgressOn = true Else $ProgressOn = False EndIf $ResultArray = _GoogleFileFinder($Query, $FileTypes,$Delimiter, $MaxResults, $MinimumFileSize, $LimitSearch, $ProgressOn) for $i = 0 to ubound($ResultArray)-1 Progress(($i+1)/(ubound($ResultArray)+1)*100, "Result " & $i & " of " & ubound ($ResultArray)) if Stringinstr($ResultArray[$i],"http")> 0 and Stringinstr($ResultArray[$i],"intitle:")=0 and stringlen($ResultArray[$i])>0 then $Filename = Stringright($ResultArray[$i],stringlen($ResultArray[$i]) - stringinstr($ResultArray[$i],"/","",-1)) $Type = Stringright($ResultArray[$i],stringlen($ResultArray[$i]) - stringinstr($ResultArray[$i],".","",-1)) $location = $ResultArray[$i] if stringlen($type) > 4 or $type = "" then $Type = "Unknown" if guictrlread($MinimumFileFilterEnable) = $GUI_CHECKED then $Size = StringFormat("%.2f", InetGetSize($ResultArray[$i])/1000000) & " MB" Else $Size = "N/A" EndIf _GUICtrlListView_InsertItem($AvailableFilesListBox,"",0) _GUICtrlListView_AddSubItem($AvailableFilesListBox,0,stringreplace($FileName, "%20", " "),0) _GUICtrlListView_AddSubItem($AvailableFilesListBox,0, $size,1) _GUICtrlListView_AddSubItem($AvailableFilesListBox,0, $type,2) _GUICtrlListView_AddSubItem($AvailableFilesListBox,0, $location,3) EndIf Next _GUICtrlListView_SetColumnWidth($AvailableFilesListBox,0,$LVSCW_AUTOSIZE) Progress(0,"") EndFunc func _GoogleFileFinder($Query, $FileTypes,$Delimiter = " ", $MaxResults = 10, $MinimumFileSize = 0, $LimitSearch = False, $ProgressOn = False) ;Minimum File Size is in Megabytes local $SearchURL, $GoogleHTML, $LinkArray, $FileArray, $FullFileList, $QueryArray local $FullHTML, $FileTypeArray, $FileLinkExtractionPattern, $TempHTML $FileTypeArray = StringSplit($FileTypes, $Delimiter) $QueryArray = StringSplit($Query, $Delimiter) $FileTypes = stringreplace($FileTypes, $Delimiter,"%7C") $Query = stringreplace($Query, $Delimiter,".") $SearchURL = "http://www.google.com/search?hl=en&q=intitle%3A%22index.of%22+%28" & _ $FileTypes&"%29+"& $Query &"+-html+-htm+-php+-js+-asp+-jsp&btnG=Google+Search&num=" & $MaxResults $GoogleHTML = _InetGetSource($SearchURL) $LinkExtractPattern = '(?i)href="(.*?)"' $LinkArray = StringRegExp($GoogleHTML, $LinkExtractPattern,3) Progress("","Finding Host Websites...") for $CurrentURL = 0 to ubound($LinkArray)-1 Progress(($CurrentURL + 1)/(ubound($LinkArray)-1) *100, "Limiting Searched Links: " & $CurrentURL+1 & " of " & ubound($LinkArray)) $GoogleIncluded = StringInStr($LinkArray[$CurrentURL],"google") $CacheIncluded = StringInStr($LinkArray[$CurrentURL],"cache") $GSearchIncluded = StringInStr($LinkArray[$CurrentURL],"/search?") if $GoogleIncluded = 0 and $CacheIncluded = 0 and $GSearchIncluded = 0 Then $TempHTML = _INetGetSource($LinkArray[$CurrentURL]) $TempHTML = StringReplace($TempHTML,'href="', 'href="' & $LinkArray[$CurrentURL]) $FullHTML = $FullHTML & $TempHTML EndIf Next For $CurrentType = 1 to ubound($FileTypeArray)-1 Progress(($CurrentType + 1)/(ubound($FileTypeArray)-1) *100, "Finding File Links: " & _ $CurrentType + 1 & " of " & ubound($FileTypeArray)-1) $FileLinkExtractionPattern = '(?i)href="(.*?)'&$FileTypeArray[$CurrentType]&'"' $FileArray = StringRegExp($FullHTML, $FileLinkExtractionPattern,3) for $TypeNum = 0 to ubound($FileArray) -1 $FileArray[$TypeNum] = $FileArray[$TypeNum] & $FileTypeArray[$CurrentType] Next $FullFileList = $FullFileList & _ArrayToString($FileArray,"|") & "|" Next $FileArray = "" $FileArray = StringSplit($FullFileList,"|") if $LimitSearch Then $LimitedFileList = "" For $CurrentFile = 0 to ubound($FileArray) -1 Progress(($CurrentFile +1)/(ubound($FileArray) -1 ) *100, "Limiting Search Results: " & $CurrentFile +1 & " of " & ubound ($FileArray)) $IncludeThis = False $HasHTTP = False if Stringinstr($FileArray[$CurrentFile], "http:")>0 then $HasHTTP = True for $CurrentQuery = 1 to ubound($QueryArray) -1 if Stringinstr($FileArray[$CurrentFile], $QueryArray[$CurrentQuery]) > 0 then $IncludeThis = True ExitLoop EndIf Next if $HasHTTP and $IncludeThis Then $LimitedFileList = $LimitedFileList & $FileArray[$CurrentFile] & "|" EndIf Next $FileArray = "" $FileArray = StringSplit($LimitedFileList,"|") EndIf if $MinimumFileSize > 0 then $FileSizeLimited = '' For $CurrentFile = 0 to ubound($FileArray) -1 Progress(($CurrentFile +1)/(ubound($FileArray) -1 )*100, "Checking File Size: " & $CurrentFile +1 & " of " & ubound($FileArray)) if $MinimumFileSize > InetGetSize($FileArray[$CurrentFile])/1000000 Then $FileSizeLimited = $FileSizeLimited & $FileArray[$CurrentFile] & "|" EndIf Next $FileArray = "" $FileArray = StringSplit($FileSizeLimited,"|") EndIf ProgressOff() return $FileArray EndFunc
  18. Well, since I wrote this in an old version of AutoIt, it needs to be converted to the new. GESELLER did a good job, but there are still a few things that need to be done. The function itself still works, but the display of the values is not quite right. I will have it finished in a few moments.
  19. are you using my code, or your adjusted code? (I need to know which one to debug for you)
  20. what are you searching for? not everything will be found by this. and I haven't added the "no files found" dialog yet.
  21. change it to this, and it should work. $SearchURL = "http://www.google.com/search?hl=en&q=i...index.of%22+%28" & _ Sorry for using old autoit guys... I forget to upgrade sometimes.
  22. Note the updated GUI...
  23. Thanks for all the positive comments! Any suggestions for its improvement?
  24. Here is a neat script that I just worked up. Essentially, it uses Google's vast index to find specific files hosted anywhere on the internet. It is the same principle as websites like g2p.org. Sorry its not in UDF format - I know that. I don't usually do that for my scripts. This is the updated script -- with multiple downloads, new search options Code below is updated: ;;Converted to work in 3.2.10.0 #include <GUIConstants.au3> #include <GuiComboBox.au3> #include <INET.au3> #include <array.au3> #include <GuiListView.au3> Opt("GUIOnEventMode", 1) #Region ### $MainGUI = GUICreate("Google File Downloader", 600, 552, 193, 115) GUISetOnEvent($GUI_EVENT_CLOSE, "MainGUIClose") $AvailableFilesListBox = _Guictrllistview_create($mainGUI, "File Name|Size|Type|Location", 8, 160, 297, 329) $FileInfomationGroup = GUICtrlCreateGroup("Search", 8, 8, 297, 145) $SearchText = GUICtrlCreateInput("", 16, 27, 281, 21) $FileNameShouldInclude = GUICtrlCreateInput("", 152, 58, 145, 21) $FileTypeCombo = GUICtrlCreateCombo("", 152, 93, 144, 25) GUICtrlSetOnEvent(-1, "FileTypeComboChange") GUICtrlSetData($FileTypeCombo,"Music|Movies|Programs|Images|CD/DVD Images|Torrents|Archives|Documents|Other") _GUICtrlComboBox_SelectString($FileTypeCombo, "Music") $FileTypeLabel = GUICtrlCreateLabel("File Type to Search For:", 16, 96, 117, 17) $ExtensionListEditBox = GUICtrlCreateInput("", 152, 123, 145, 21) $FileExtensionLabel = GUICtrlCreateLabel("Extension List:", 16, 126, 72, 17) $PhrasesToInclude = GUICtrlCreateLabel("Filename Might Contain:", 16, 61, 117, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $SearchLimiterGroup = GUICtrlCreateGroup("Options", 312, 8, 281, 105) $MinimumFileFilterEnable = GUICtrlCreateCheckbox("Use Minimum File Size Filter:", 320, 32, 177, 17) $MinimumFileSizeEditBox = GUICtrlCreateInput("1", 497, 29, 49, 21) $MBLabel = GUICtrlCreateLabel("MB", 557, 32, 20, 17) $SearchTermLimiter = GUICtrlCreateCheckbox("Use File Name Filter", 320, 56, 113, 17) $SearchDepthLabel = GUICtrlCreateLabel("Maximum Google Results to Parse:", 320, 80, 168, 17) $MaxResultsInput = GUICtrlCreateInput("10", 496, 76, 81, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $SearchButton = GUICtrlCreateButton("Search", 312, 120, 281, 33, 0) GUICtrlSetOnEvent(-1, "SearchButtonclick") $DownloadButton = GUICtrlCreateButton("Download All", 296, 504, 297, 33, 0) GUICtrlSetOnEvent(-1, "DownloadButtonclick") $ProgressBar = GUICtrlCreateProgress(8, 504, 281, 17) $ProgressInfoLabel = GUICtrlCreateLabel("0 Files in Download Queue", 8, 528, 285, 17) $FileQueue = _Guictrllistview_create($mainGUI,"File Name|Location", 352, 160, 241, 329) $AddToQueue = GUICtrlCreateButton(">", 312, 168, 33, 33, 0) GUICtrlSetOnEvent(-1, "AddToQueueClick") $RemoveFromQueue = GUICtrlCreateButton("<", 313, 213, 33, 33, 0) GUICtrlSetOnEvent(-1, "RemoveFromQueueClick") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### FileTypeComboChange() While 1 Sleep(100) WEnd func AddToQueueClick() $SelectionIndex = _GUICtrlListView_GetNextItem($AvailableFilesListBox) $SelectedText = _GUICtrlListView_GetItemTextString($AvailableFilesListBox,$SelectionIndex) $LineArray = StringSplit($SelectedText,"|") _GUICtrlListView_InsertItem($FileQueue,"",0) _GUICtrlListView_AddSubItem($FileQueue,0,$LineArray[1],0) _GUICtrlListView_AddSubItem($FileQueue,0,$LineArray[4],1) _GUICtrlListView_SetColumnWidth($FileQueue,0,$LVSCW_AUTOSIZE) EndFunc func RemoveFromQueueClick() _GUICtrlListView_DeleteItemsSelected ($FileQueue ) _GUICtrlListView_SetColumnWidth($FileQueue,0,$LVSCW_AUTOSIZE) EndFunc Func Progress($Percent, $Text) guictrlsetdata($ProgressBar, $Percent) guictrlsetdata($ProgressInfoLabel, $Text) EndFunc Func DownloadButtonclick() $Result = ping("www.google.com") if $Result = 0 then msgbox(32, "No Connection", "Please Connect to the Internet before downloading.") Return EndIf $NumberFiles = _GUICtrlListView_GetItemCount($FileQueue) $ItemText = _GUICtrlListView_GetItemTextArray($FileQueue) $SaveDirectory = FileSelectFolder("Select Download Folder","") for $i = 0 to $NumberFiles-1 $ItemText = _GUICtrlListView_GetItemText($FileQueue, $i,1) $FileName = _GUICtrlListView_GetItemText($FileQueue, $i,0) $Size = InetGetSize($ItemText) Inetget($ItemText,$SaveDirectory & $Filename,1,1) While @InetGetActive Progress(@InetGetBytesRead/$Size*100, Stringformat("%.2f", @InetGetBytesRead/1000) & " of " & _ int($size/1000) & " Kb") Sleep(250) Wend next Progress(0,"Done.") EndFunc Func MainGUIClose() Exit EndFunc Func FileTypeComboChange() $TypeToFind = Guictrlread($FileTypeCombo) Select case $TypeToFind = "Music" Guictrlsetdata($ExtensionListEditBox, "mp3 mp4 wma ogg flac aiff au gsm dct vox aac m4a atrac msv dvf m4p") case $TypeToFind = "Movies" Guictrlsetdata($ExtensionListEditBox, "3gp asf asx avi mov mpg mpeg mp4 ogm qt rm swf flv vob wmv") case $TypeToFind = "Programs" Guictrlsetdata($ExtensionListEditBox, "msi exe zip rar app") case $TypeToFind = "Images" Guictrlsetdata($ExtensionListEditBox, "jpg jpeg bmp tiff tif raw png gif ppm pgm pbm pnm svg") case $TypeToFind = "CD/DVD Images" Guictrlsetdata($ExtensionListEditBox, "iso bin cue vob nrg dmg mds ccd dvd") case $TypeToFind = "Torrents" Guictrlsetdata($ExtensionListEditBox, "torrent") case $TypeToFind = "Archives" Guictrlsetdata($ExtensionListEditBox, "zip rar 7z") case $TypeToFind = "Documents" Guictrlsetdata($ExtensionListEditBox, "doc pdf odt txt rtf") case Else GUICtrlSetData($ExtensionListEditBox, "") EndSelect EndFunc Func SearchButtonclick() $Query = Guictrlread($SearchText) $FileTypes = guictrlread($ExtensionListEditBox) $Delimiter = " " $MaxResults = guictrlread($MaxResultsInput) if guictrlread($SearchTermLimiter) = $GUI_CHECKED then $LimitSearch = True Else $LimitSearch = False EndIf if guictrlread($MinimumFileFilterEnable) = $GUI_CHECKED then $MinimumFileSize = guictrlread($MinimumFileSizeEditBox) Else $MinimumFileSize = 0 EndIf $ProgressOn = True _GUICtrlListView_DeleteAllItems($AvailableFilesListBox) $ResultArray = _GoogleFileFinder($Query, $FileTypes,$Delimiter, $MaxResults, $MinimumFileSize, $LimitSearch, $ProgressOn) $Count = 0 for $i = 0 to ubound($ResultArray)-1 Progress(($i+1)/(ubound($ResultArray)+1)*100, "Result " & $i & " of " & ubound ($ResultArray)) if Stringinstr($ResultArray[$i],"http")> 0 and Stringinstr($ResultArray[$i],"intitle:")=0 and stringlen($ResultArray[$i])>0 then $Filename = Stringright($ResultArray[$i],stringlen($ResultArray[$i]) - stringinstr($ResultArray[$i],"/","",-1)) $Type = Stringright($ResultArray[$i],stringlen($ResultArray[$i]) - stringinstr($ResultArray[$i],".","",-1)) $location = $ResultArray[$i] if stringlen($type) > 4 or $type = "" then $Type = "Unknown" if guictrlread($MinimumFileFilterEnable) = $GUI_CHECKED then $Size = StringFormat("%.2f", InetGetSize($ResultArray[$i])/1000000) & " MB" Else $Size = "N/A" EndIf if $Size = "N/A" or $Size > $MinimumFileSize then _GUICtrlListView_InsertItem($AvailableFilesListBox,"",0) _GUICtrlListView_AddSubItem($AvailableFilesListBox,0,stringreplace($FileName, "%20", " "),0) _GUICtrlListView_AddSubItem($AvailableFilesListBox,0, $size,1) _GUICtrlListView_AddSubItem($AvailableFilesListBox,0, $type,2) _GUICtrlListView_AddSubItem($AvailableFilesListBox,0, $location,3) $Count = $count + 1 EndIf EndIf Next _GUICtrlListView_SetColumnWidth($AvailableFilesListBox,0,$LVSCW_AUTOSIZE) Progress(0,$Count & " Files Found") EndFunc func _GoogleFileFinder($Query, $FileTypes,$Delimiter = " ", $MaxResults = 10, $MinimumFileSize = 0, $LimitSearch = False, $ProgressOn = False) ;Minimum File Size is in Megabytes local $SearchURL, $GoogleHTML, $LinkArray, $FileArray, $FullFileList, $QueryArray local $FullHTML, $FileTypeArray, $FileLinkExtractionPattern, $TempHTML $FileTypeArray = StringSplit($FileTypes, $Delimiter) $QueryArray = StringSplit(guictrlread($FileNameShouldInclude), $Delimiter) $FileTypes = stringreplace($FileTypes, $Delimiter,"%7C") $Query = stringreplace($Query, $Delimiter,".") $SearchURL = "http://www.google.com/search?hl=en&q=intitle%3A%22index.of%22+%28" & _ $FileTypes&"%29+"& $Query &"+-html+-htm+-php+-js+-asp+-jsp&btnG=Google+Search&num=" & $MaxResults $GoogleHTML = _InetGetSource($SearchURL) $LinkExtractPattern = '(?i)href="(.*?)"' $LinkArray = StringRegExp($GoogleHTML, $LinkExtractPattern,3) Progress("","Finding Host Websites...") for $CurrentURL = 0 to ubound($LinkArray)-1 Progress(($CurrentURL + 1)/(ubound($LinkArray)-1) *100, "Limiting Searched Links: " & $CurrentURL+1 & " of " & ubound($LinkArray)) $GoogleIncluded = StringInStr($LinkArray[$CurrentURL],"google") $CacheIncluded = StringInStr($LinkArray[$CurrentURL],"cache") $GSearchIncluded = StringInStr($LinkArray[$CurrentURL],"/search?") if $GoogleIncluded = 0 and $CacheIncluded = 0 and $GSearchIncluded = 0 Then $TempHTML = _INetGetSource($LinkArray[$CurrentURL]) $TempHTML = StringReplace($TempHTML,'href="', 'href="' & $LinkArray[$CurrentURL]) $FullHTML = $FullHTML & $TempHTML EndIf Next For $CurrentType = 1 to ubound($FileTypeArray)-1 Progress(($CurrentType + 1)/(ubound($FileTypeArray)-1) *100, "Finding File Links: " & _ $CurrentType + 1 & " of " & ubound($FileTypeArray)-1) $FileLinkExtractionPattern = '(?i)href="(.*?)'&$FileTypeArray[$CurrentType]&'"' $FileArray = StringRegExp($FullHTML, $FileLinkExtractionPattern,3) for $TypeNum = 0 to ubound($FileArray) -1 $FileArray[$TypeNum] = $FileArray[$TypeNum] & $FileTypeArray[$CurrentType] Next $FullFileList = $FullFileList & _ArrayToString($FileArray,"|") & "|" Next $FileArray = "" $FileArray = StringSplit($FullFileList,"|") if $LimitSearch Then $LimitedFileList = "" For $CurrentFile = 0 to ubound($FileArray) -1 Progress(($CurrentFile +1)/(ubound($FileArray) -1 ) *100, "Limiting Search Results: " & $CurrentFile +1 & " of " & ubound ($FileArray)) $IncludeThis = False $HasHTTP = False if Stringinstr($FileArray[$CurrentFile], "http:")>0 then $HasHTTP = True for $CurrentQuery = 1 to ubound($QueryArray) -1 if Stringinstr($FileArray[$CurrentFile], $QueryArray[$CurrentQuery]) > 0 then $IncludeThis = True ExitLoop EndIf Next if $HasHTTP and $IncludeThis Then $LimitedFileList = $LimitedFileList & $FileArray[$CurrentFile] & "|" EndIf Next $FileArray = "" $FileArray = StringSplit($LimitedFileList,"|") EndIf ProgressOff() return $FileArray EndFunc
  25. Improved MouseRepel Function: This one doesn't jump - AT ALL. The function is completely new, the example code is the same from the last version. #include-once #include<misc.au3> ; Mouse repel - keep mouse away from an area ; Author - Orange Global $GUI = GUICreate("Can't Touch This", 200, 100, 200, 200) GUISetState() AdlibEnable("CallMouseRepel", 10) While 1 Sleep(1000) WEnd Func CallMouseRepel() $coords = WinGetPos($GUI) _MouseRepel($coords[0], $coords[1], $coords[0] + $coords[2], $coords[1] + $coords[3]) EndFunc ;==>CallMouseRepel ;=============================================================================== ; ; Description: _MouseRepel ; Parameter(s): $i_left - Left coord ; $i_top - Top coord ; $i_right - Right coord ; $i_bottom - Bottom coord ; User CallTip: _MouseRepel([$i_left = 0[, $i_top = 0[, $i_right = 0[, $i_bottom = 0]]]]) Repel the Mouse Cursor to specified coords. ; Author(s): Orange ; Note(s): This function must be called constantly to prevent the mouse cursor from entering the area. ; It is therefore recommended that you call this function from another function that is called by AdlibEnable every 1 to 50ms. ; ;=============================================================================== Func _MouseRepel($i_left = 0, $i_top = 0, $i_right = 0, $i_bottom = 0) $i_Position = MouseGetPos() Select case $i_Position[0] > $i_right and $i_Position[1] > $i_bottom _MouseTrap() Case $i_Position[0] > $i_right and $i_Position[1] < $i_top _MouseTrap() Case $i_Position[0] < $i_left and $i_Position[1] < $i_top _MouseTrap() Case $i_Position[0] < $i_left and $i_Position[1] > $i_bottom _MouseTrap() case $i_Position[0] > $i_right _MouseTrap($i_right,0,@DesktopWidth,@DesktopHeight) case $i_Position[0] < $i_left _MouseTrap(0,0,$i_left,@DesktopHeight) case $i_Position[1] < $i_top _MouseTrap(0,0,@DesktopWidth,$i_top) case $i_Position[1] > $i_bottom _MouseTrap(0,$i_bottom,@DesktopWidth,@DesktopHeight) EndSelect EndFunc ;==>_MouseRepel
×
×
  • Create New...