-
Posts
5,295 -
Joined
-
Last visited
-
Days Won
1
Everything posted by weaponx
-
Does anyone use RecursiveFileSearch by weaponx?
weaponx replied to JeffAllenNJ's topic in AutoIt General Help and Support
This will search within the folder "Base" for any folders beginning with "Dir" only. $array = RecursiveFileSearch("Base", "", "^(Dir)", 2) For $X = 0 to $array[0] ConsoleWrite('['&$X&']: ' & $array[$X] & @CRLF) ;ConsoleWrite(StringTrimLeft($array[$X], 9) & @CRLF) Next #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.10.0 Author: WeaponX Updated: 2/21/08 Script Function: Recursive file search 2/21/08 - Added pattern for folder matching, flag for return type 1/24/08 - Recursion is now optional Parameters: RFSstartdir: Path to starting folder RFSFilepattern: RegEx pattern to match ".(mp3)" - Find all mp3 files - case sensitive (by default) "(?i).(mp3)" - Find all mp3 files - case insensitive "(?-i).(mp3|txt)" - Find all mp3 and txt files - case sensitive RFSFolderpattern: "(Music|Movies)" - Only match folders named Music or Movies - case sensitive (by default) "(?i)(Music|Movies)" - Only match folders named Music or Movies - case insensitive "(?!(Music|Movies)b)bw+" - Match folders NOT named Music or Movies - case sensitive (by default) RFSFlag: Specifies what is returned in the array 0 - Files and folders 1 - Files only 2 - Folders only RFSrecurse: TRUE = Recursive, FALSE = Non-recursive RFSdepth: Internal use only #ce ---------------------------------------------------------------------------- Func RecursiveFileSearch($RFSstartDir, $RFSFilepattern = ".", $RFSFolderpattern = ".", $RFSFlag = 0, $RFSrecurse = true, $RFSdepth = 0) ;Ensure starting folder has a trailing slash If StringRight($RFSstartDir, 1) <> "" Then $RFSstartDir &= "" If $RFSdepth = 0 Then ;Get count of all files in subfolders for initial array definition $RFSfilecount = DirGetSize($RFSstartDir, 1) ;File count + folder count (will be resized when the function returns) Global $RFSarray[$RFSfilecount[1] + $RFSfilecount[2] + 1] EndIf $RFSsearch = FileFindFirstFile($RFSstartDir & "*.*") If @error Then Return ;Search through all files and folders in directory While 1 $RFSnext = FileFindNextFile($RFSsearch) If @error Then ExitLoop ;ConsoleWrite($RFSnext & @CRLF) ;If folder and recurse flag is set and regex matches If StringInStr(FileGetAttrib($RFSstartDir & $RFSnext), "D") Then If $RFSrecurse Then RecursiveFileSearch($RFSstartDir & $RFSnext, $RFSFilepattern, $RFSFolderpattern, $RFSFlag, $RFSrecurse, $RFSdepth + 1) If $RFSFlag <> 1 AND StringRegExp($RFSnext, $RFSFolderpattern, 0)Then ;Append folder name to array $RFSarray[$RFSarray[0] + 1] = $RFSstartDir & $RFSnext $RFSarray[0] += 1 EndIf EndIf ElseIf StringRegExp($RFSnext, $RFSFilepattern, 0) AND $RFSFlag <> 2 Then ;Append file name to array $RFSarray[$RFSarray[0] + 1] = $RFSstartDir & $RFSnext $RFSarray[0] += 1 EndIf WEnd FileClose($RFSsearch) If $RFSdepth = 0 Then Redim $RFSarray[$RFSarray[0] + 1] Return $RFSarray EndIf EndFunc ;==>RecursiveFileSearch -
I'll see what I can do. As of right now the UDF only retrieves information. I intended it to do everything Devcon can but testing it is very tricky if I want to avoid hosing my system.
-
Magnify alternatively 2 desktop area
weaponx replied to myspacee's topic in AutoIt General Help and Support
Are you using gdi for this? Sounds a little insane when Windows 7 comes with a magnification tool. http://windows.microsoft.com/en-US/windows7/Make-items-on-the-screen-appear-bigger-Magnifier -
pulling up a similar but wrong field
weaponx replied to gcue's topic in AutoIt General Help and Support
The only problem I have with this is it leaves the carriage return at the end of the match, and it I can't get it to ignore it. -
pulling up a similar but wrong field
weaponx replied to gcue's topic in AutoIt General Help and Support
You can't copy and paste AutoIt code because it puts it all on one line, you have to click Popup then copy it. -
pulling up a similar but wrong field
weaponx replied to gcue's topic in AutoIt General Help and Support
$string = _ 'Last Login Time: 07:22:03 pm 03/10/10' & @CRLF & _ 'Account Locked: False' & @CRLF & _ 'Account Disabled: False' & @CRLF & _ 'Grace Logins Allowed: 3' & @CRLF & _ 'Remaining Grace Logins: 3' & @CRLF & _ 'Last Intruder Address:' & @CRLF & _ 'TCP/IP Network Address' & @CRLF & _ 'IP Address: 30.20.222.74' & @CRLF & _ 'Maximum Connections: 6' & @CRLF & _ 'Login Script:' & @CRLF & _ 'map k:=lao-nws_user_server\users2:' & @CRLF & _ '' & @CRLF & _ '@NET USE x: \\loap01\teams' & @CRLF & _ 'Login Time: 05:09:48 am 03/11/10' & @CRLF & _ 'modifiersName: CN=CGNDSDR' $result = StringRegExp($string, "(?m)^Login Time: (.+)",1) If @ERROR Then MsgBox(0,"",@ERROR) For $X = 0 to Ubound($result)-1 ConsoleWrite($result[$X] & @CRLF) Next -
reconstructing data from html table
weaponx replied to gcue's topic in AutoIt General Help and Support
Have you tried _IETableWriteToArray ? -
Prevent Process creation from usb stick
weaponx replied to mary's topic in AutoIt General Help and Support
So the files can be renamed. They would need to be blocked by a hash. -
Prevent Process creation from usb stick
weaponx replied to mary's topic in AutoIt General Help and Support
What good is this if the files can be copied from the removable device and executed? -
Huh? Nobody uses ftp for local network file sharing. If you have admin rights on these systems you can just use named pipes. Fyzzle can you provide any code?
-
passing operators to imagemagick
weaponx replied to RasmusN's topic in AutoIt General Help and Support
Rather than passing the options individually, why can't you just pass it as one string? Global $img = ObjCreate("ImageMagickObject.MagickImage.1") $options = '' $options &= "source.JPG " $options &= "-gravity " $options &= "south " $options &= "-background " $options &= "#afbc22 " $options &= "-splice " $options &= "0x60 " $options &= "-font " $options &= "OCR-A-Extended " $options &= "-pointsize " $options &= "12 " $options &= "-annotate " $options &= "+0+0 " $options &= "filename goes here " $options &= "testoutput.jpg" $NewImage = $img.Convert($options) -
How to add details in a picture(gif)
weaponx replied to iamsandeep's topic in AutoIt General Help and Support
#include <GuiConstantsEx.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> ; Initialize GDI+ library _GDIPlus_Startup () ; Capture full screen $hBitmap = _ScreenCapture_Capture() ;Capture window ;$hWin = WinGetHandle ("SciTE") ;$hBitmap = _ScreenCapture_CaptureWnd('', $hWin) $hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap) $hGraphic = _GDIPlus_ImageGetGraphicsContext ($hImage) ;Get dimensions $iWidth = _GDIPlus_ImageGetWidth($hImage) $iHeight = _GDIPlus_ImageGetHeight($hImage) $sCLSID = _GDIPlus_EncodersGetCLSID ("JPG") ;Draw semi transparent rectangle along bottom $hBrush1 = _GDIPlus_BrushCreateSolid(0x7F000000) _GDIPlus_GraphicsFillRect($hGraphic, 0, $iHeight-40,$iWidth,40,$hBrush1) ;Define font $hBrush2 = _GDIPlus_BrushCreateSolid (0xFFFFFFFF) ;Text color (white) $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat,1) ;Center text horizontally $hFamily = _GDIPlus_FontFamilyCreate ("Arial") ;Typeface $hFont = _GDIPlus_FontCreate ($hFamily, 20, 1) ;Font style (20pt, bold) $tLayout = _GDIPlus_RectFCreate (0, $iHeight-40,$iWidth,40) ;Draw text along bottom _GDIPlus_GraphicsDrawStringEx ($hGraphic, "Hello world", $hFont, $tLayout, $hFormat, $hBrush2) ; Save resultant image (high quality) $tParams = _GDIPlus_ParamInit (1) $tData = DllStructCreate("int Quality") DllStructSetData($tData, "Quality", 100) ;quality 0-100 $pData = DllStructGetPtr($tData) _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData) $pParams = DllStructGetPtr($tParams) _GDIPlus_ImageSaveToFileEx($hImage, @MyDocumentsDir & "\GDIPlus_Image.jpg", $sCLSID, $pParams) ; Save resultant image (low quality) ;_GDIPlus_ImageSaveToFile ($hImage, @MyDocumentsDir & "\GDIPlus_Image.jpg") ; Clean up resources _GDIPlus_ImageDispose ($hImage) _GDIPlus_GraphicsDispose($hGraphic) _WinAPI_DeleteObject ($hBitmap) _GDIPlus_BrushDispose($hBrush1) _GDIPlus_BrushDispose($hBrush2) ; Shut down GDI+ library _GDIPlus_ShutDown () -
Winexists checks hidden windows?
weaponx replied to Jerther's topic in AutoIt General Help and Support
Why can't you install silently using command line switches? -
How can we test this without adequate details? A search for "MCP_EnumPrinter" finds nothing on Google.
-
Why my little script use so much processor capacity??
weaponx replied to hendrikhe's topic in AutoIt General Help and Support
Oh also, this script violates the Heroes of Newarth TOS: -
Why my little script use so much processor capacity??
weaponx replied to hendrikhe's topic in AutoIt General Help and Support
Don't open or close dll's inside a loop. Don't use DllCall with a filename, use a handle.... -
DllCall won't work after an If statement
weaponx replied to Its2l82die's topic in AutoIt General Help and Support
Okay well in this case, straight from the Battles For Glory website: http://translate.googleusercontent.com/translate_c?hl=en&sl=ru&tl=en&u=http://www.bsfg.ru/%3Frules&rurl=translate.google.com&usg=ALkJrhjZAzO9ccwcFg9g5ZNgwPEVq_TMuw -
DllCall won't work after an If statement
weaponx replied to Its2l82die's topic in AutoIt General Help and Support
Discussion of game bots is prohibited. -
How to add details in a picture(gif)
weaponx replied to iamsandeep's topic in AutoIt General Help and Support
This can be done with straight GDI+, i'm looking for a good example. -
Manadar's code seems correct to me.
-
Date & time functions in VBA. How to convert ?
weaponx replied to Tany's topic in AutoIt General Help and Support
Roll your own function dude, it's not difficult. $timestamp = _NOW() ConsoleWrite($timestamp & @CRLF) ConsoleWrite("Year: " & _Year($timestamp) & @CRLF) ConsoleWrite("Month: " & _Month($timestamp) & @CRLF) ConsoleWrite("Day: " & _Day($timestamp) & @CRLF) ConsoleWrite("Hour: " & _Hour($timestamp) & @CRLF) ConsoleWrite("Minute: " & _Minute($timestamp) & @CRLF) ConsoleWrite("Second: " & _Second($timestamp) & @CRLF) Func _Now() Return StringFormat('%i-%02i-%02i %02i:%02i:%02i',@YEAR, @MON,@MDAY,@HOUR,@MIN,@SEC) EndFunc Func _Year($ts) Return StringMid($ts,1,4) EndFunc Func _Month($ts) Return StringMid($ts,6,2) EndFunc Func _Day($ts) Return StringMid($ts,9,2) EndFunc Func _Hour($ts) Return StringMid($ts,12,2) EndFunc Func _Minute($ts) Return StringMid($ts,15,2) EndFunc Func _Second($ts) Return StringMid($ts,18,2) EndFunc -
http://preventrilo.com/
-
Date & time functions in VBA. How to convert ?
weaponx replied to Tany's topic in AutoIt General Help and Support
Read the help file... @MON @MDAY @YEAR @HOUR @MIN @SEC -
Don't even bother with Win*() functions. Use RunWait() and install it silently like a real man. http://support.myteks.net/xp-sp3-silent-install