Jump to content

Search the Community

Showing results for tags 'speed'.

  • 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

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 16 results

  1. Hello everyone, I am working on a project which requires reading a few values from Excel, the catch is that I need it to be very fast... unfortunatley I found out that read operations using the supplied Excel UDF are very slow, more than 150 ms for each operation on average Here is my testing setup that I made: #include <Excel.au3> #include <MsgBoxConstants.au3> Global $iTotalTime = 0 Test() Func Test() Local $oExcel = _Excel_Open() Local $oBook = _Excel_BookAttach("Test.xlsx", "FileName", $oExcel) Local $sSheet = "Sheet1" If @error Then Return MsgBox($MB_ICONERROR, "Excel Failed", "Failed to attach to Excel") Local $iNum For $iRow = 1 To 6 Time() Local $iNum = Number(_Excel_RangeRead($oBook, $sSheet, "A" & $iRow)) If ($iNum = 1) Then ConsoleWrite("Row " & $iRow & " is 1 and value of column B is " & _Excel_RangeRead($oBook, $sSheet, "B" & $iRow)) Else ConsoleWrite("Row " & $iRow & " is not 1") EndIf ConsoleWrite(". Reading took: ") Time() Next ConsoleWrite("The whole operation took " & $iTotalTime & " milliseconds." & @CRLF) EndFunc Func Time() Local Static $hTimer Local Static $bRunning = False If $bRunning Then Local $iTime = Round(TimerDiff($hTimer), 2) $iTotalTime += $iTime ConsoleWrite($iTime & @CRLF) Else $hTimer = TimerInit() EndIf $bRunning = Not $bRunning EndFunc And Test.xlsx in CSV format: 1,-1 -1,1 1,-1 1,1 -1,-1 1,1 Here is the actual xlsx but it should expire in a week: https://we.tl/t-EVkxGp1kc6 And finally output from my script: Row 1 is 1 and value of column B is -1. Reading took: 276.06 Row 2 is not 1. Reading took: 163.36 Row 3 is 1 and value of column B is -1. Reading took: 302.58 Row 4 is 1 and value of column B is 1. Reading took: 294.65 Row 5 is not 1. Reading took: 152.33 Row 6 is 1 and value of column B is 1. Reading took: 284.92 The whole operation took 1473.9 milliseconds. Taking ~1.5 seconds for reading 6 rows of data is bad for my script, which needs to run as fast as possible . It would be nice if I can bring this down to 100 ms somehow, I am not very experienced working with MS office so I thought about asking you folks for help and advice on how I can optimize my script to squeeze out every bit of performance that I can get from this script Thanks for the help in advance!
  2. hi guys how is possible set a speed of all function _Ie ??
  3. Hello AutoIt community I run into speed problem in my script wich i cant solve myself, problem is with decoding texture loop - for better explanation, you need extract from file pallete (16x 16 RGB color) and picture data (224 * 128 byte), then use correct color for your picture data.... nothing extra hard and also texture is quite small 224*256 it is for my car model viewer/later maybe editor GranTurismo 2 from Playstation 1, so its old dataformat and i cant understand why AutoIt take so long to decode texture when good old Playstation almost 2,5 decades old can do that nearly immediately (when you list through cars in shop or garage) My first atempt was create all trought dllstructure, because its easier approach, but it was soooo slow (40-50s for create textures) then i upgrade my routine via arrays, first 3D arrays later only 1D, next i put decoding colors outside loop but it is still not enough, my last version took cca 15s wich is still unacceptable for car model viewer when you click on one carmodel from listview (1100 cars for whole game) and you must wait 15-16s for model to load.... oh and i forgot mention some cars have more then 1 color (much more... 8-9-10 etc) soloading take 8-9-10 times more time in attachment i post texture file from GranTurismo 2 for one car (contain only 1 color) and also my dll struct version and array version code dll struct version - ± 40 sec (33 without saving) #include <FileConstants.au3> Global $IMDT[256][256][4] LoadTexture("ufs9r.cdp") Func LoadTexture($file) $fileHandle = FileOpen($file, $FO_BINARY) $header = FileRead($fileHandle, 0x20) ConsoleWrite("header> " & $header & @CRLF) $PAL = FileRead($fileHandle, 0x200) ConsoleWrite("PAL> " & $PAL & @CRLF) FileSetPos($fileHandle, 0x43A0, $FILE_BEGIN) $IMD = FileRead($fileHandle, 0x7000) ConsoleWrite("IMD> " & $IMD & @CRLF) $st = DllStructCreate("BYTE[512]") DllStructSetData($st, 1, $PAL) $struct_PAL = DllStructCreate("WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16];WORD[16]", DllStructGetPtr($st)) $struct_IMD = DllStructCreate("BYTE[" & 0x7000 & "]") DllStructSetData($struct_IMD, 1, $IMD) $start = TimerInit() For $i = 0 To 15 For $j = 0 To 223 $cn = 0 For $k = 0 To 127 $bt = DllStructGetData($struct_IMD, 1, $j * 128 + $k + 1) $blue = BitShift(DllStructGetData($struct_PAL, $i + 1, BitAND($bt, 0x0F) + 1), 7) $IMDT[$j][$cn][0] = $blue $green = BitShift(DllStructGetData($struct_PAL, $i + 1, BitAND($bt, 0x0F) + 1), 2) $IMDT[$j][$cn][1] = $green $red = BitShift(DllStructGetData($struct_PAL, $i + 1, BitAND($bt, 0x0F) + 1), - 3) $IMDT[$j][$cn][2] = $red If DllStructGetData($struct_PAL, $i + 1, BitAND($bt, 0x0F) + 1) = 0 Then $IMDT[$j][$cn][3] = 0x00 Else $IMDT[$j][$cn][3] = 0xFF EndIf $cn += 1 $blue = BitShift(DllStructGetData($struct_PAL, $i + 1, BitShift($bt, 4) + 1), 7) $IMDT[$j][$cn][0] = $blue $green = BitShift(DllStructGetData($struct_PAL, $i + 1, BitShift($bt, 4) + 1), 2) $IMDT[$j][$cn][1] = $green $red = BitAND(BitShift(DllStructGetData($struct_PAL, $i + 1, BitShift($bt, 4) + 1), - 3), 0xFF) $IMDT[$j][$cn][2] = $red If DllStructGetData($struct_PAL, $i + 1, BitShift($bt, 4) + 1) = 0 Then $IMDT[$j][$cn][3] = 0x00 Else $IMDT[$j][$cn][3] = 0xFF EndIf $cn += 1 Next Next saveTGA($i) Next ConsoleWrite("t " & TimerDiff($start) & @CRLF) ; +- 40 seconds FileClose($fileHandle) EndFunc Func saveTGA($name) Local $tga[18] = [0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x20, 0x20] Local $data for $i = 0 To 17 $data &= Hex($tga[$i], 2) Next For $i = 0 To 255 For $j = 0 To 255 For $k = 0 To 3 $data &= hex($IMDT[$i][$j][$k], 2) Next Next Next $binary = FileOpen("test\" & $name & ".tga", BitOR($FO_BINARY, $FO_OVERWRITE, $FO_CREATEPATH)) FileWrite($binary, "0x" & $data) FileClose($binary) EndFunc array version - ± 15 sec (under 10s without saving) #include <FileConstants.au3> LoadTexture2("ufs9r.cdp") Func LoadTexture2($file) $fileHandle = FileOpen($file, $FO_BINARY) $a = TimerInit() Global $header[0x20] For $i = 0 To UBound($header) - 1 $header[$i] = Int(String(FileRead($fileHandle, 1))) ; read 0x20 bytes Next ConsoleWrite("header " & TimerDiff($a) & @CRLF) $a = TimerInit() Global $PAL[0x100] For $i = 0 To UBound($PAL) - 1 $PAL[$i] = Number(FileRead($fileHandle, 2)) ; read 0x200 (16*16) words Next Global $PALcolor[16 * 16 * 4] For $i = 0 To UBound($PAL) - 1 $PALcolor[$i * 4 + 0] = BitShift($PAL[$i], 7) $PALcolor[$i * 4 + 1] = BitShift($PAL[$i], 2) $PALcolor[$i * 4 + 2] = BitShift($PAL[$i], -3) If $PAL[$i] = 0 Then $PALcolor[$i * 4 + 3] = 0x00 Else $PALcolor[$i * 4 + 3] = 0xFF EndIf Next ConsoleWrite("PAL " & TimerDiff($a) & @CRLF) $a = TimerInit() FileSetPos($fileHandle, 0x43A0, $FILE_BEGIN) Global $IMD[0x7000] For $i = 0 To UBound($IMD) - 1 $IMD[$i] = Int(String(FileRead($fileHandle, 1))) ; read 0x7000 bytes Next ConsoleWrite("IMD " & TimerDiff($a) & @CRLF) Global $IMDT[256*256*4] $a = TimerInit() For $i = 0 To 15 For $j = 0 To 223 $cn = 0 For $k = 0 To 127 $byte = $IMD[$j * 128 + $k] ; byte for decode $index = $j * 1024 + $cn * 4 $index2 = $i * 0x40 + BitAND($byte, 0x0F) * 4 $IMDT[$index + 0] = $PALcolor[$index2 + 0] ; blue $IMDT[$index + 1] = $PALcolor[$index2 + 1] ; green $IMDT[$index + 2] = $PALcolor[$index2 + 2] ; red $IMDT[$index + 3] = $PALcolor[$index2 + 3] ; alpha $cn += 1 $index = $j * 1024 + $cn * 4 $index2 = $i * 0x40 + BitShift($byte, 4) * 4 $IMDT[$index + 0] = $PALcolor[$index2 + 0] ; blue $IMDT[$index + 1] = $PALcolor[$index2 + 1] ; green $IMDT[$index + 2] = $PALcolor[$index2 + 2] ; red $IMDT[$index + 3] = $PALcolor[$index2 + 3] ; alpha $cn += 1 Next Next ;~ $b = TimerInit() saveTGA2($i) ;~ ConsoleWrite("save TGA " & TimerDiff($b) & @CRLF) Next ConsoleWrite("full time " & TimerDiff($a) & @CRLF) ; 16 seconds FileClose($fileHandle) EndFunc Func saveTGA2($name) Local $tga[18] = [0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x20, 0x20] Local $data For $i = 0 To 17 $data &= Hex($tga[$i], 2) Next For $i = 0 To UBound($IMDT) - 1 $data &= Hex($IMDT[$i], 2) Next $binary = FileOpen("test\" & $name & ".tga", BitOR($FO_BINARY, $FO_OVERWRITE, $FO_CREATEPATH)) FileWrite($binary, "0x" & $data) FileClose($binary) EndFunc if anyone can optimize my code I would be very grateful, or pointing me to better solution, thx ufs9r.cdp
  4. Hi all, I was pondering over a question with regards to the speeds of reading something and did not see this kind of question in a forum search. The question: What is (technically) faster? Multiple reads from the same 3d array cell, or only once make a 'temp' variable from that cell and read the value from this? I don't know if either has any real impact at all anyway, but just wanted to ask anyway. :-) There may be a difference if the value holds an integer or a string (or something else) but in my case, is a simple integer. To hopefully clarify with a small bit of code: $process = $start - 15 If $xy[$process][3] <> "x" Then If _ArraySearch($open, $process, 1, $open[0][0], 0, 0, 1, 1) <> -1 Then UpdateOpen($xy[$process][5], $closed[0][0]) ElseIf $start > 0 And _ArraySearch($closed, $process, 1, $closed[0][0], 0, 0, 1, 0) = -1 Then Add_open($start, $closed[0][0], $counter, $process) EndIf EndIf You can read from this, that the array $closed[0][0] is being read 3 times. And this goes on further in the code I did not show. My question boils down to this, should I make a 'temp' variable to hold that $closed[0][0] value until the function is done? It may not have a real impact on my small script, but I really am interested in the answer at least. Regards, Tri.
  5. Searching inside the forum, I don't succeed to get any explanation about a strange (for me !) phenomena: Using AutoIt, I have coded a "cortex of neurons Simulator" for which I handle several neurons activity (Action Potential and Postsynaptic Potential) which take a long time, about 20 ms per neuron to be processed. This is why I need a global loop running about 1s for a global cortex of 50 neurons. But when I move the mouse (in any direction, like rotating above the GUI) the speed of the loop increase significantly : around x8 times more ... ! This happens only if the GUI has the focus. I did a check with the "Windows Task Manager" where I can see the CPU usage changing every time the mouse is moving (growing from 3% to 15%). I believe to remember some lecture about the influence of the user events regarding the "Application" capability to anticipate user actions by changing it's rate of pooling events, but I'm not sure it was in an AutoIt forum, or maybe it was in an other "developer forum" (like "Code Project", "Stackoverflow" , or ...? Could somebody help me to understand this behaviour ? If possible, is there a programmatic method to manage the speed of a simple "For, Next" loop ? I try to change the Application priority (setting to level 4 with "ProcessSetPriority"), but this seems not very efficient .... Thanks, Alain. FYI: I'm using : Autoit 3.3.14.2 Windows 7 Home Premium Service Pack 1 Computer ASUS N56V Screen resolution: 1920x1080 (recommended) Theme :Windows Classic
  6. Hey I've these two functions to do a base64 conversation , Is there any way to compare the exact speed of both of them ? Func _Base64Encode($input) $input = Binary($input) Local $struct = DllStructCreate("byte[" & BinaryLen($input) & "]") DllStructSetData($struct, 1, $input) Local $strc = DllStructCreate("int") Local $a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($struct), _ "int", DllStructGetSize($struct), _ "int", 1, _ "ptr", 0, _ "ptr", DllStructGetPtr($strc)) If @error Or Not $a_Call[0] Then Return SetError(1, 0, "") ; error calculating the length of the buffer needed EndIf Local $a = DllStructCreate("char[" & DllStructGetData($strc, 1) & "]") $a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($struct), _ "int", DllStructGetSize($struct), _ "int", 1, _ "ptr", DllStructGetPtr($a), _ "ptr", DllStructGetPtr($strc)) If @error Or Not $a_Call[0] Then Return SetError(2, 0, ""); error encoding EndIf Return DllStructGetData($a, 1) EndFunc ;==>_Base64Encode Func _Base64Encode($sData) Local $oXml = ObjCreate("Msxml2.DOMDocument") If Not IsObj($oXml) Then SetError(1, 1, 0) EndIf Local $oElement = $oXml.createElement("b64") If Not IsObj($oElement) Then SetError(2, 2, 0) EndIf $oElement.dataType = "bin.base64" $oElement.nodeTypedValue = Binary($sData) Local $sReturn = $oElement.Text If StringLen($sReturn) = 0 Then SetError(3, 3, 0) EndIf Return $sReturn EndFunc ;==>_Base64Encode
  7. Hi guys, I wonder if there is a speed meter gauge in AutoIT - did someone managed to create one without the need of excel, only using the AutoIT graphics? There is a great example (attached) from @GreenCan here in the excel's related gauge, but I can't use excel since it's not installed on the machine I need to run the AutoIT exe script on. Thanks!
  8. Hi gang, I'm in a bit of a pickle here, the gist of it is that i have one "main" file with ~200k lines, and literally hundreds of other files each ranging from 1k - 100k lines. I need to go through each of the "other" files and (separately) compare them to the "main" file, and save the differences between the two (no duplicates) The issue is that each comparison (especially if the "other" file has 50+ k lines) takes over a minute each... Is there anyway to cut this time down? As far as i know im using the most optimized array difference script Here's a rough mockup of the script im currently using note: the main file has all unique lines, and the "other" files wont ever have any lines that *DO NOT* appear in the main file, if that helps #include <array.au3> #include <file.au3> global $info_file global $compare_file global $Differece $info_file = FileReadToArray("info-file(200k lines).txt") $compare_file = FileReadToArray("compare-file(100k lines).txt") $Differece = _Diff($info_file, $compare_file, 0) ; get the difference between 2 arrays, NO duplicates _ArrayDisplay($Differece) ;================================================= ; Function Name: _Diff($Set1, $Set2 [, $GetAll=0 [, $Delim=Default]]) ; Description:: Find values in $Set1 that do not occur in $Set2 ; Parameter(s): $Set1 set 1 (1D-array or delimited string) ; $Set2 set 2 (1D-array or delimited string) ; optional: $GetAll 0 - only one occurence of every difference are shown (Default) ; 1 - all differences are shown, allowing duplicates ; optional: $Delim Delimiter for strings (Default use the separator character set by Opt("GUIDataSeparatorChar") ) ; Return Value(s): Succes 1D-array of values from $Set1 that do not occur in $Set2 ; Failure -1 @error set, that was given as array, isn't 1D-array ; Note: Comparison is case-sensitive! - i.e. Number 9 is different to string '9'! ; Author(s): BugFix (bugfix@autoit.de) Modified by ParoXsitiC for Faster _Diff (Formally _GetIntersection) ;================================================= Func _Diff(ByRef $Set1, ByRef $Set2, $GetAll = 0, $Delim = Default) Local $o1 = ObjCreate("System.Collections.ArrayList") Local $o2 = ObjCreate("System.Collections.ArrayList") Local $oDiff1 = ObjCreate("System.Collections.ArrayList") Local $tmp, $i If $GetAll <> 1 Then $GetAll = 0 If $Delim = Default Then $Delim = Opt("GUIDataSeparatorChar") If Not IsArray($Set1) Then If Not StringInStr($Set1, $Delim) Then $o1.Add($Set1) Else $tmp = StringSplit($Set1, $Delim, 1) For $i = 1 To UBound($tmp) - 1 $o1.Add($tmp[$i]) Next EndIf Else If UBound($Set1, 0) > 1 Then Return SetError(1, 0, -1) For $i = 0 To UBound($Set1) - 1 $o1.Add($Set1[$i]) Next EndIf If Not IsArray($Set2) Then If Not StringInStr($Set2, $Delim) Then $o2.Add($Set2) Else $tmp = StringSplit($Set2, $Delim, 1) For $i = 1 To UBound($tmp) - 1 $o2.Add($tmp[$i]) Next EndIf Else If UBound($Set2, 0) > 1 Then Return SetError(1, 0, -1) For $i = 0 To UBound($Set2) - 1 $o2.Add($Set2[$i]) Next EndIf For $tmp In $o1 If Not $o2.Contains($tmp) And ($GetAll Or Not $oDiff1.Contains($tmp)) Then $oDiff1.Add($tmp) Next If $oDiff1.Count <= 0 Then Return 0 Local $aOut[$oDiff1.Count] $i = 0 For $tmp In $oDiff1 $aOut[$i] = $tmp $i += 1 Next Return $aOut EndFunc ;==>_Diff
  9. Hi, anyone got some experience with the _NetInfo_GetUploadSpeed() from the NetInfo UDF. Been fiddeling with it for a day now. and i keep getting a return: 1 or return 2, never get my upload in kb/s. This is the little bit of my script i got: $s_CountryCode = "NL" $Upload_Speed = _NetInfo_GetUploadSpeed() MsgBox(4096, "Test", $Upload_Speed)What am I not seeing here...
  10. Hi, I am trying to create a script wich checks my hardware and my internet information. The hardware part is done and I got my external IP-check working but I have searched far and wide but not came up wich an example for an internet speed check. Can any one help me. Below you will find my script: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Inet.au3> #include <WinAPIReg.au3> #include <Security.au3> #include <WinAPI.au3> #include "NavInfo.au3" GUICreate("Mijn Salon - Check", 283, 311, -1, -1) GUICtrlCreateGroup("Systeem info", 8, 8, 265, 145) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $PROC = GUICtrlCreateInput("", 16, 32, 249, 21) $READPROC = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0", "ProcessorNameString") GUICtrlSetData($PROC, $READPROC) GUICtrlSetState($PROC, $GUI_DISABLE) $RAM = GUICtrlCreateInput("RAM", 16, 56, 121, 21) Local $aMem = MemGetStats() $mem = $aMem[1] /1024 $mem1= $mem /1024 $mem2= Round($mem1, 0) GUICtrlSetData($RAM, $mem2 & " GB Geheugen") GUICtrlSetState($RAM, $GUI_DISABLE) $MODEL = GUICtrlCreateInput("", 144, 56, 121, 21) $READMODEL1 = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\Bios", "SystemManufacturer") $READMODEL2 = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\Bios", "BaseBoardProduct") GUICtrlSetData($MODEL, $READMODEL1 & " " & $READMODEL2) GUICtrlSetState($MODEL, $GUI_DISABLE) $WINDOWS = GUICtrlCreateInput("", 16, 80, 249, 21) $READOS = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName") If @OSArch = "X86" Then $ARCH = "32-Bit" Else $ARCH = "64-Bit" EndIf GUICtrlSetData($WINDOWS, $READOS & " " & $ARCH) GUICtrlSetState($WINDOWS, $GUI_DISABLE) $IE = GUICtrlCreateInput("", 16, 104, 249, 21) Local $sVersion = FileGetVersion(@ProgramFilesDir & "\Internet Explorer\iexplore.exe") GUICtrlSetData($IE, "Internet Explorer: " & $sVersion) GUICtrlSetState($IE, $GUI_DISABLE) $SILVERLIGHT = GUICtrlCreateInput("SILVERLIGHT", 16, 128, 249, 21) $Silverlight_Version = _NavInfo_GetSilverlightVersion() If Not @error Then GUICtrlSetData($SILVERLIGHT, "Silverlight: " & $Silverlight_Version) EndIf GUICtrlSetState($SILVERLIGHT, $GUI_DISABLE) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("Internet info", 8, 160, 265, 113) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $SPEED = GUICtrlCreateInput("SPEED", 16, 184, 249, 21) $IPADRES = GUICtrlCreateInput("", 16, 216, 249, 21) $PublicIP = _GetIP() GUICtrlSetData($IPADRES, $PublicIP) GUICtrlSetState($IPADRES, $GUI_DISABLE) $PROVIDER = GUICtrlCreateInput("PROVIDER", 16, 248, 249, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $SAVE = GUICtrlCreateButton("Opslaan naar .txt", 8, 280, 131, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $MAIL = GUICtrlCreateButton("Send E-mail", 144, 280, 131, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $SAVE SAVE() Case $MAIL MAIL() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func SAVE() $READIE = GUICtrlRead($IE) $IEDONE = StringTrimLeft($READIE, 19) $READSILVER = GUICtrlRead($SILVERLIGHT) $SILVERDONE = StringTrimLeft($READSILVER, 13) If FileExists(@Desktopdir & "\check.txt") Then FileDelete(@desktopdir & "\check.txt") EndIf $DEBITNR = InputBox("Invoeren", "Voer klantnaam in:", "") $MEDEWERKER = InputBox("Invoeren", "Uitgevoerd door:", "") $FILE = FileOpen(@desktopdir & "\check.txt", 1) $1 = GUICtrlRead($PROC) $2 = GUICtrlRead($RAM) $3 = GUICtrlRead($MODEL) $4 = GUICtrlRead($WINDOWS) $5 = $IEDONE $6 = $SILVERDONE $7 = GUICtrlRead($SPEED) $8 = GUICtrlRead($IPADRES) $9 = GUICtrlRead($PROVIDER) FileWrite($FILE, "Klantnaam: " & $DEBITNR & @CRLF) FileWrite($FILE, "Datum: " & @MDAY & "-" & @MON & "-" & @YEAR & @CRLF & @CRLF) FileWrite($FILE, "Processor: " & $1 & @CRLF) FileWrite($FILE, "Geheugen: " & $2 & @CRLF) FileWrite($FILE, "Model: " & $3 & @CRLF) FileWrite($FILE, "Windows: " & $4 & @CRLF) FileWrite($FILE, "Internet Explorer: " & $5 & @CRLF) FileWrite($FILE, "Silverlight: " & $6 & @CRLF & @CRLF) FileWrite($FILE, "Internet Snelheid: " & $7 & @CRLF) FileWrite($FILE, "IP-Adres: " & $8 & @CRLF) FileWrite($FILE, "Internet Provider: " & $9 & @CRLF & @CRLF) FileWrite($FILE, "Uitgevoerd door: " & $MEDEWERKER) MsgBox(4096, "Klaar", "Check is klaar en opgeslagen op het bureaublad") EndFunc Func MAIL() EndFunc
  11. Continuation of topic started I have been testing various times and configurations after reading the tips given and things are a bit better, though now a new issue has come up - after installing the latest version of AutoIt (3.3.10.2) _SQLite_Startup() is taking a LOT of time to load. Odd thing is, it is not consistent (I hate that....) - though times vary from 5 seconds (which is 'long', IMHO) to OVER 60 seconds! ConsoleWrite("various states disabled/hidden " & Round(TimerDiff($timer) / 1000, 2) & ' sec' & @crlf) ; ************************************ read from / update the database FileInstall("sqlite3.dll", @ScriptDir & "", 1) ConsoleWrite("SQL0 " & Round(TimerDiff($timer) / 1000, 2) & ' sec' & @crlf) _SQLite_Startup() If @error Then MsgBox(16, "SQLite Error", "SQLite3.dll Can't be Loaded!") Exit -1 EndIf ConsoleWrite("SQL1 " & Round(TimerDiff($timer) / 1000, 2) & ' sec' & @crlf) Console output from one test (not 'typical', but certainly 'common' to be very long.....) Prior to loading 3.3.10.2 times were 'fast' (never noticed any lag enough to care to time it), though now when I start the program it is very noticably delayed. I want to address various other tweaks and such as discussed by @jchd and certainly the differences and tweaks for working with disk based or memory based databases (in this project, I need one disk based and it may be that I go with memory based for the other, more temporary), though now, this is my #1 priority! It doesn't matter if it is disk or memory based at this point, I'm just doing the Startup and with such L O N G times, it has my project stalled (I can't put something out that takes over a minute to start!). BTW (not sure how important it might be), the #include list (which seems to grow constantly...) is now I will be eliminating some of those, I'm sure as I tweak this program for speed (one of them being "AssocArrays" - I have found it to be (sadly, as I am used to named array elements...) causing some of the slowness in the program. I have elimanted most of the AssocArray calls in the main loop and increased times about 20% (calling it nearly 40 times in the loop, with 30K+ files, it made a difference!) Anyway, more on that stuff later - right now, I need to understand what to do about _SQLite_Startup()! Ideas/suggestions?
  12. Version 1.0

    949 downloads

    This will shutdown the pc whenever the download speed goes under the specified nÂș of KB/s. Should you find any issues, please report to me.
  13. This script takes a total of ~6 seconds for me, each test taking ~1 sec: Global $wnd=WinGetHandle("[ACTIVE]") Global $total_time Global $result $n1 = 60000 $start_time = TimerInit() For $i = 1 To $n1 PixelGetColor(1, 1) Next $time1=int(TimerDiff($start_time)) $total_time += $time1 $result &= "1. PixelGetColor: same screen pixel, omitting handle parameter: " & $time1 & " ms" & @LF Sleep(30) $start_time = TimerInit() For $x = 0 To 299 For $y = 0 To 199 PixelGetColor($x, $y) Next Next $time1=int(TimerDiff($start_time)) $total_time += $time1 $result &= "2. PixelGetColor: screen rectangle 300x200 pixels, omitting handle parameter: " & $time1 & " ms" & @LF Sleep(30) $n1 = 60000 $start_time = TimerInit() For $i = 1 To $n1 PixelGetColor(1, 1, "") Next $time1=int(TimerDiff($start_time)) $total_time += $time1 $result &= "3. PixelGetColor: same screen pixel, using parameter "": " & $time1 & " ms" & @LF Sleep(30) $start_time = TimerInit() For $x = 0 To 299 For $y = 0 To 199 PixelGetColor($x, $y) Next Next $time1=int(TimerDiff($start_time)) $total_time += $time1 $result &= "4. PixelGetColor: screen rectangle 300x200 pixels, using parameter "": " & $time1 & " ms" & @LF Sleep(30) $n1 = 60000 $start_time = TimerInit() For $i = 1 To $n1 PixelGetColor(1, 1, $wnd) Next $time1=int(TimerDiff($start_time)) $total_time += $time1 $result &= "5. PixelGetColor: same screen pixel, using parameter [Active]: " & $time1 & " ms" & @LF Sleep(30) $start_time = TimerInit() For $x = 0 To 299 For $y = 0 To 199 PixelGetColor($x, $y, $wnd) Next Next $time1=int(TimerDiff($start_time)) $total_time += $time1 $result &= "6. PixelGetColor: screen rectangle 300x200 pixels, using parameter [Active]: " & $time1 & " ms" & @LF $result &= @LF $result &= "Total time: " & $total_time & " ms" ; exluding sleep's MsgBox(0, "mBox", $result) What results do you get? (XP users particulary of interest) Is my numbers normal/expected? Is there any way to speed this up (staying with default functions)? I've been looking for alternatives and one seems to be _GDIPlus_BitmapLockBits with a simple example available >here. That example makes my AutoIt crash completely though (even with handle "" specified). >Another example also crashes for me, so I'm a bit lost. Does the GDIPlus example(s) work for you? I'd love to stay with PixelGetColor for now, if possible. Any help greatly appreciated. Machine: WinXP Pro SP3 GPU 1GB GeForce 3 GB RAM 1600x1200x32 Window Classic theme AutoIt v3.3.10.2
  14. In my script i check a small area (say 20x20 pixels) with looped PixelGetColor. This has worked without any real problems for months and has taken about 20ms to complete. To test my script, I'm running Photoshop and activate different layers to show different photos. This has also worked great. After a GPU replace (to the better) a week ago it worked great the first few days, but now I've come to a dead end. This is the deal: I open my .psd file and runs my script - performance is ok I switch to layer 2 and runs my script - performance is ok I switch back to layer 1 and runs my script - performance is horrible, almost 50ms. At this point it doesn't matter what I do, every use of PixelGetColor() is slow. Now, if I close Photoshop completely, reopens my .psd file and run the script again - performance is ok What could possible be the problem!? Could it be anything with the new Nvidia drivers - PhysX/hyperthreading and all that new shit (which I didnt use earlier)? After a search through the forums I've found some interesting stuff making me far from the only one having general performance issues using the PixelGetColor() function. I'm gonna take a shot using _GDIPlus_BitmapLockBits instead and see if that helps. But I wonder if there might be something more at work in my case? As mentioned, I'm using the same script as I have for months. I've tested with Photoshop again and again - same result. Also tried using Paint but then its horrible speed constantly. It's just now the problems started. Related links on the matter Setup WinXP GPU 1GB GeForce 3 GB RAM 1600x1200x32 Window Classic theme with all Performance Visual Effects turned off. AutoIt v3.3.8.1
  15. Recently I found myself needing to "Uniqueify" large arrays of data. Not happy with the speed I decided to check out how _ArrayUnique worked and if it could be improved. Below is my overhauled version of _ArrayUnique. "Uniqueify" An array of 500 random numbers (average of 5 results) Old: 274.597787502462 New: 240.237994573652 "Uniqueify" An array of 1000 random numbers (average of 5 results) Old: 1070.06629280595 New: 920.537746095923 Still not fast but faster Changed ALL Dim's to Local's From the help file: "You should use Local or Global, instead of Dim, to explicitly state which scope is desired for a variable/constant/array." Changed: Dim $aArrayTmp[1] ;Declare blank array, which will hold the dimension declared by user For $i = 0 To $iUboundDim - 1 _ArrayAdd($aArrayTmp, <itemtoadd> ) ;$iDimension-1 to match Dimension Next _ArrayDelete($aArrayTmp, 0) ;Get rid of 1st-element which is blank To: Local $aArrayTmp[$iUboundDim] ;Declare array, which will hold the dimension declared by user For $i = 0 To $iUboundDim - 1 ;Loop through "Rows" $aArrayTmp[$i] = <itemtoadd> ;$iDimension-1 to match Dimension Next It is silly to declare a "blank" array (and delete the first "empty value")if you already know it's intended dimentions This also removed the need for _ArrayAdd (No more ReDim's YAY!) Changed If,Then, Else statements to Switch statements where appropriate for ease of reading (they are supposed to be faster too) Trimmed: If Not $iDimension > 0 Then Return SetError(3, 0, 0) ;Check to see if it is valid array dimension, Should be greater than 0 Else To: If $iDimension < 1 Then Return SetError(3, 0, 0) ;Check to see if it is valid array dimension, Should be greater than 0 Changed: $aArrayTmp = StringSplit(StringTrimRight($sHold, StringLen($vDelim)), $vDelim, 1) ;Split the string into an array Return $aArrayTmp ;SmOke_N's version used to Return SetError(0, 0, 0) To: $sHold = StringTrimRight($sHold, StringLen($vDelim)) $aArrayTmp = StringSplit($sHold, $vDelim, 1) ;Split the string into an array Return $aArrayTmp ;SmOke_N's version used to Return SetError(0, 0, 0) For clarity ; #FUNCTION# ==================================================================================================================== ; Name...........: _ArrayUnique ; Description ...: Returns the Unique Elements of a 1-dimensional array. ; Syntax.........: _ArrayUnique($aArray[, $iDimension = 1[, $iBase = 0[, $iCase = 0[, $vDelim = "|"]]]]) ; Parameters ....: $aArray - The Array to use ; $iDimension - [optional] The Dimension of the Array to use ; $iBase - [optional] Is the Array 0-base or 1-base index. 0-base by default ; $iCase - [optional] Flag to indicate if the operations should be case sensitive. ; 0 = not case sensitive, using the user's locale (default) ; 1 = case sensitive ; 2 = not case sensitive, using a basic/faster comparison ; $vDelim - [optional] One or more characters to use as delimiters. However, cannot forsee its usefullness ; Return values .: Success - Returns a 1-dimensional array containing only the unique elements of that Dimension ; Failure - Returns 0 and Sets @Error: ; 0 - No error. ; 1 - Returns 0 if parameter is not an array. ; 2 - _ArrayUnique failed for some other reason ; 3 - Array dimension is invalid, should be an integer greater than 0 ; Author ........: SmOke_N ; Modified.......: litlmike, Gibbo ; Remarks .......: Returns an array, the first element ($array[0]) contains the number of strings returned, the remaining elements ($array[1], $array[2], etc.) contain the unique strings. ; Related .......: _ArrayMax, _ArrayMin ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _ArrayUnique($aArray, $iDimension = 1, $iBase = 0, $iCase = 0, $vDelim = "|") Local $iUboundDim ;$aArray used to be ByRef, but litlmike altered it to allow for the choosing of 1 Array Dimension, without altering the original array If $vDelim = "|" Then $vDelim = Chr(01) ; by SmOke_N, modified by litlmike If Not IsArray($aArray) Then Return SetError(1, 0, 0) ;Check to see if it is valid array ;Checks that the given Dimension is Valid If $iDimension < 1 Then Return SetError(3, 0, 0) ;Check to see if it is valid array dimension, Should be greater than 0 ;If Dimension Exists, then get the number of "Rows" $iUboundDim = UBound($aArray, 1) ;Get Number of "Rows" If @error Then Return SetError(3, 0, 0) ;2 = Array dimension is invalid. ;If $iDimension Exists, And the number of "Rows" is Valid: Switch $iDimension = 1 Case False ;Makes sure the Array dimension desired is more than 1-dimensional Local $aArrayTmp[$iUboundDim] ;Declare array, which will hold the dimension declared by user For $i = 0 To $iUboundDim - 1 ;Loop through "Rows" $aArrayTmp[$i] = $aArray[$i][$iDimension - 1] ;$iDimension-1 to match Dimension Next Case Else ;Makes sure the Array dimension desired is 1-dimensional ;If Dimension Exists, And the number of "Rows" is Valid, and the Dimension desired is not > 1, then: ;For the Case that the array is 1-Dimensional Switch UBound($aArray, 0) Case 1 ;Makes sure the Array is only 1-Dimensional Local $aArrayTmp[$iUboundDim] ;Declare array, which will hold the dimension declared by user For $i = 0 To $iUboundDim - 1 $aArrayTmp[$i] = $aArray[$i] Next Case Else ;For the Case that the array is 2-Dimensional Local $aArrayTmp[$iUboundDim] ;Declare array, which will hold the dimension declared by user For $i = 0 To $iUboundDim - 1 $aArrayTmp[$i] = $aArray[$i][$iDimension - 1] ;$iDimension-1 to match Dimension Next EndSwitch EndSwitch Local $sHold ;String that holds the Unique array info For $iCC = $iBase To $iUboundDim - 1 ;Loop Through array ;If Not the case that the element is already in $sHold, then add it Switch StringInStr($vDelim & $sHold, $vDelim & $aArrayTmp[$iCC] & $vDelim, $iCase) Case False $sHold &= $aArrayTmp[$iCC] & $vDelim EndSwitch Next If $sHold Then $sHold = StringTrimRight($sHold, StringLen($vDelim)) $aArrayTmp = StringSplit($sHold, $vDelim, 1) ;Split the string into an array Return $aArrayTmp ;SmOke_N's version used to Return SetError(0, 0, 0) EndIf Return SetError(2, 0, 0) ;If the script gets this far, it has failed EndFunc ;==>_ArrayUnique
  16. Hey guys, can i change the mouse speed via AutoIt? I want to make a nice little GUI where all necessary settings, that have to be done while clicking through different windows UIs, can be done easily in one window. First of all i want to change the mouse speed... Is there any Function or DLL call or RegEdit able to do that? i'd appreciate your help
×
×
  • Create New...