Jump to content

Search the Community

Showing results for tags 'fast'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

Found 4 results

  1. This function rewrite whole content of given file by defined (implicitly 0x0) character and finally delete it, it's called as secure deleting. This should be VERY fast!! Just note that there is no error checking inside FileWipe() Maybe I will post later also version with error checking. You can comment line FileDelete($sFileName) to see how it's rewritten before deletion. EDIT: There can be problems with too big files (>2GB or > amount of RAM) see post #8 by Kafu #include <WinAPI.au3> ; prepare testing file FileDelete('1.txt') FileWrite('1.txt','123abc') FileWipe('1.txt') Func FileWipe($sFileName, $nByte = 0x0) If Not FileExists($sFileName) Then Return $iSize = FileGetSize($sFileName) $hFile = _WinAPI_CreateFile($sFileName, 2, 6) $hMapping = _WinAPI_CreateFileMapping($hFile) $pAddress = _WinAPI_MapViewOfFile($hMapping) MemSet($pAddress, $nByte, $iSize) _WinAPI_UnmapViewOfFile($pAddress) _WinAPI_CloseHandle($hMapping) _WinAPI_CloseHandle($hFile) FileDelete($sFileName) EndFunc Func MemSet($pDest, $nChar, $nCount) DllCall("msvcrt.dll", "ptr:cdecl", "memset", "ptr", $pDest, "int", $nChar, "int", $nCount) If @error Then Return SetError(1,0,False) Return True EndFunc ; from WinAPIEx - just simplified for this purpose Func _WinAPI_CreateFileMapping($hFile) Local $Ret = DllCall('kernel32.dll', 'ptr', 'CreateFileMappingW', 'ptr', $hFile, 'ptr', 0, 'dword', 0x4, 'dword', 0, 'dword', 0, 'ptr', 0) If (@error) Or (Not $Ret[0]) Then Return SetError(1, 0, 0) Return $Ret[0] EndFunc Func _WinAPI_MapViewOfFile($hMapping) Local $Ret = DllCall('kernel32.dll', 'ptr', 'MapViewOfFile', 'ptr', $hMapping, 'dword', 0x6, 'dword', 0, 'dword', 0, 'dword', 0) If (@error) Or (Not $Ret[0]) Then Return SetError(1, 0, 0) Return $Ret[0] EndFunc Func _WinAPI_UnmapViewOfFile($pAddress) DllCall('kernel32.dll', 'int', 'UnmapViewOfFile', 'ptr', $pAddress) If @error Then Return SetError(1, 0, 0) Return 1 EndFunc Here is my first test version without memory mapped files: Func FileWipe($sFileName, $nByte = 0x0) If Not FileExists($sFileName) Then Return $iSize = FileGetSize($sFileName) $tBuffer = DLLStructCreate("byte[" & $iSize & "]") MemSet(DLLStructGetPtr($tBuffer), $nByte, $iSize) $hFile = _WinAPI_CreateFile($sFileName, 2, 6) _WinAPI_WriteFile($hFile, DLLStructGetPtr($tBuffer), $iSize, $iSize) _WinAPI_CloseHandle($hFile) FileDelete($sFileName) EndFunc
  2. Hello to all, first thank you to all of you, because this forum is really usefull. I try to search about my problem but I didnt get any answer, so I try to create new topic... sorry for my english too, because I am not from uk or usa... I have a script which depends on specific pixel, if this pixes gets a colour, it will make a click... speed is the name of the game, so does anybody know, how fast will be this cycle? I mean how many times this script will go for 1 second, or maybe for 1 minute? second question is... when this pixel gets a colour I want, is there any better way how to wrote a script which will click on three different spot on the screen? best regards and thank you very much for any help pepan -snip-
  3. This function is very fast compared to standard _StringRepeat() when number of repeated chars is big. In my tests this version is faster than original for > 50 chars. Time needed for this new StringRepeat() is constant no matter how many chars you repeat (nCount) so for big numbers of repeated characters it's MUCH FASTER (hundred times). StringRepeat Function: Func StringRepeat($sChar, $nCount) $tBuffer = DLLStructCreate("char[" & $nCount & "]") DllCall("msvcrt.dll", "ptr:cdecl", "memset", "ptr", DLLStructGetPtr($tBuffer), "int", Asc($sChar), "int", $nCount) Return DLLStructGetData($tBuffer, 1) EndFunc Testing example for compare speed with standard _StringRepeat (try to change number of chars): #include <String.au3> $start = TimerInit() _StringRepeat('a',1000) ConsoleWrite(TimerDiff($start)& @CRLF) $start = TimerInit() StringRepeat('a',1000) ConsoleWrite(TimerDiff($start)& @CRLF) Func StringRepeat($sChar, $nCount) $tBuffer = DLLStructCreate("char[" & $nCount & "]") DllCall("msvcrt.dll", "ptr:cdecl", "memset", "ptr", DLLStructGetPtr($tBuffer), "int", Asc($sChar), "int", $nCount) Return DLLStructGetData($tBuffer, 1) EndFunc EDIT: There is one difference/limitation from original _StringRepeat(): This new StringRepeat() can repeat only one character, so it's not posiible to do: StringRepeat('abc',3) --> result is 'aaa' Maybe I should change its name from StringRepeat() to CharRepeat() EDIT2: Here is MemSet in form of UDF: Func MemSet($pDest, $nChar, $nCount) DllCall("msvcrt.dll", "ptr:cdecl", "memset", "ptr", $pDest, "int", $nChar, "int", $nCount) If @error Then Return SetError(1,0,False) Return True EndFunc
  4. Firs of all, i'm sorry for my bad english, but i'm brazilian! I've modified many functions of Excel.au3 to make it much more fast and created anothers functions the function list is above: Functions inside UDF: _ExcelColumnLetter($iColumn) _ExcelColumnNumber($sColumn) _ExcelFormatR1C1ToA1($iRowFrom, $iColFrom, $iRowTo = "", $iColTo = "") _ExcelFormatA1ToR1C1($sRange) _ExcelReadSheetToArrayEX($oExcel, $iStartRow = 1, $iStartColumn = 1, $iRowCnt = 0, $iColCnt = 0, $iColShift = 0) _ExcelPasteSpecial($oExcel, $sRange, $xPasteType = -4104, $xPasteSpecialOp = -4142) _ExcelFormatPainter($oExcel, $sRangeFrom, $sRangeTo = 0, $xPasteType = -4104, $xPasteSpecialOp = -4142) _ExcelWriteSheetFromArrayEx($oExcel, $aArray, $iStartRow = 1, $iStartColumn = 1, $iArrayRowStart = 0, $iArrayColStart = 0) _ExcelWriteArrayEX($oExcel, $aArray, $iStartRow = 1, $iStartColumn = 1, $iArrayRowStart = 0, $iDirection = 0) if someone wants to fix my specifications can be at ease! in the attached file have a examples of functions! Note: functions that are written by other people and i just modified, i left specified within the UDF I hope it is useful to you, it's much more fast than original functions! Thanks a lot! Examples: #include #include ;Generate an Array Local $aArray[100][15] For $i = 0 To 99 For $j = 0 To 14 $aArray[$i][$j] = "Line: " & $i + 1 & " - Col: " & $j + 1 Next Next ;Create Excel Object Local $oExcel = _ExcelBookNew() ;Write a 2d Array to Excel with default values (start in R1C1 cell and write all itens in array). MsgBox(0,'',"Press OK to write an Array to Excel.") _ExcelWriteSheetFromArrayEx($oExcel, $aArray) $oExcel.ActiveSheet.Columns("A:O").AutoFit ;Format 2 First's lines. MsgBox(0,'',"Press OK to format the 2 first Excel cells.") With $oExcel.ActiveSheet.Range("A1:O100") .Select .HorizontalAlignment = 3 .Borders.LineStyle = 1 EndWith $oExcel.ActiveSheet.Range("A1:O1").Interior.Color = 0xDAC0CC $oExcel.ActiveSheet.Range("A2:O2").Interior.Color = 0xF0B00A $oExcel.ActiveSheet.Range("A2:O2").Font.Bold = True ;Copy this style to all anothers Cells with _ExcelFormatPainter MsgBox(0,'',"Press OK to copy the style of the 2 first's cells to to all anothers cells.") _ExcelFormatPainter($oExcel, "A1:O2", 0, $xlPasteFormats, $xlPasteSpecialOperationNone) $oExcel.ActiveSheet.Range("A1").Select ;Read all data to array MsgBox(0,'',"Press OK to read all cells to and array.") Local $aCells = _ExcelReadSheetToArrayEX($oExcel) _ArrayDisplay($aCells) ;read 3 columns from Excel starting from 5nd and 50 rows starting from 1st row MsgBox(0,'',"Press OK to read 50 rows and 3 cols and to and array.") Local $aCells = _ExcelReadSheetToArrayEX($oExcel, 1, 5, 50, 3) _ArrayDisplay($aCells) _ExcelBookClose($oExcel) ;Create another Excel Object Local $oExcel = _ExcelBookNew() ;Write an Array to Excel Starting from 50 row and 12 col of array and write it starting from 2nd row and 3rd col of excel MsgBox(0,'',"Press OK to write an Array to Excel.") _ExcelWriteSheetFromArrayEx($oExcel, $aArray, 2, 3, 50, 12) MsgBox(0,'',"Press OK to Close.") _ExcelBookClose($oExcel) ;Write an 1D Array Local $oExcel = _ExcelBookNew() Local $aArray[5] = ["LocoDarwin", "Jon", "big_daddy", "DaleHolm", "GaryFrost"] MsgBox(0,'',"Press OK to write an Array to Excel.") _ExcelWriteArrayEX($oExcel, $aArray) ; Write the Array Horizontally _ExcelWriteArrayEX($oExcel,$aArray, 5, 1, 0, 1) ; Write the Array Vertically, starting on the 5th Row MsgBox(0,'',"Press OK to Exit.") _ExcelBookClose($oExcel)ExcelEX.rar
×
×
  • Create New...