Jump to content

Eugenii

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by Eugenii

  1. Is there any chance to get such speed with AutoIt? I tried to compare array processing speed versus another great tool based on Lua: test={}; test2={}; for count = 1, 150000 do if (count==10000) then test[count]={101,102,103,104,105,106,107,108,109,110} else test[count]={50,51,52,53,54,55,56,57,58,59}; end end for count = 2, 150000 do test[count-1]=test[count] end for count = 1, 149999 do test2[count]=test[count]; end for el in pairs(test2) do if test2[el][1]==101 then res2=el end end VS Dim $test[150000][10] Dim $test2[149999][10] For $a=0 To 149999 If $a=9999 Then ;~ For $x=0 To 9 ;~ $test[$a][$x]=101+$x ;~ Next $test[$a][0]=101 $test[$a][1]=102 $test[$a][2]=103 $test[$a][3]=104 $test[$a][4]=105 $test[$a][5]=106 $test[$a][6]=107 $test[$a][7]=108 $test[$a][8]=109 $test[$a][9]=110 Else ;~ For $x=0 To 9 ;~ $test[$a][$x]=50+$x ;~ Next $test[$a][0]=50 $test[$a][1]=51 $test[$a][2]=52 $test[$a][3]=53 $test[$a][4]=54 $test[$a][5]=55 $test[$a][6]=56 $test[$a][7]=57 $test[$a][8]=58 $test[$a][9]=59 EndIf Next For $a=1 To 149999 ;~ For $x=0 To 9 ;~ $test[$a-1][$x]=$test[$a][$x] ;~ Next $test[$a-1][0]=$test[$a][0] $test[$a-1][1]=$test[$a][1] $test[$a-1][2]=$test[$a][2] $test[$a-1][3]=$test[$a][3] $test[$a-1][4]=$test[$a][4] $test[$a-1][5]=$test[$a][5] $test[$a-1][6]=$test[$a][6] $test[$a-1][7]=$test[$a][7] $test[$a-1][8]=$test[$a][8] $test[$a-1][9]=$test[$a][9] Next For $a=0 To 149998 ;~ For $x=0 To 9 ;~ $test2[$a][$x]=$test[$a][$x] ;~ Next $test2[$a][0]=$test[$a][0] $test2[$a][1]=$test[$a][1] $test2[$a][2]=$test[$a][2] $test2[$a][3]=$test[$a][3] $test2[$a][4]=$test[$a][4] $test2[$a][5]=$test[$a][5] $test2[$a][6]=$test[$a][6] $test2[$a][7]=$test[$a][7] $test2[$a][8]=$test[$a][8] $test2[$a][9]=$test[$a][9] Next For $a=0 To 14998 If $test2[$a][0]=101 Then $res2=$a Next Lua is done in ~374 ms while AutoIt in ~3203. If I use nested For...To...Next to assign array element values, it takes even more time ~4506 ms. While increasing the second dimension size, the processing time also increases significantly in AutoIt. In Lua it increases slightly. At this moment the only solution, as I see, is to combine both scripting engines: to use Lua for array processing and AutoIt for all other work.
  2. Does your advapi32.dll has 6.1.7601.17514 version and kernel32.dll has version 6.1.7601.18015 ? Could OS lang affect this?Windows restart doesn't help. _SingletonHWID() needs for APIConstants.au3 and WinAPIEx.au3 . And I think it will take even more time than _SingletonPID() takes. However _SingletonPID() seems to work fine, except of an about 1 sec delay. Maybe it will be even better than native _Singleton. Maybe it occured after latest windows update?
  3. Hello! Does anyone has an idea why it doesn't work? I can run many instances of .exe or .au3 (e.g. three .exe or two .au3, not only one .exe and one .au3). Thanks. 3.3.8.1 Win7 x64 HomePro SP1
  4. Thanks for your suggestion, but the icon flashes between normal Ico and "black square" anyway... guinness, Yes, I am. On 2nd question: Yesterday I have left a new comment in the ticket.
  5. Hello! I have tried to run simple code from help file and got an unexpected result: Is it normal or a bug? OS: Win 7 x64 Home Pro #NoTrayIcon Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown. Local $settingsitem = TrayCreateMenu("Settings") TrayCreateItem("Display", $settingsitem) TrayCreateItem("Printer", $settingsitem) TrayCreateItem("") Local $aboutitem = TrayCreateItem("About") TrayCreateItem("") Local $exititem = TrayCreateItem("Exit") TraySetState(5) While 1 Local $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $aboutitem MsgBox(64, "about:", "AutoIt3-Tray-sample") Case $msg = $exititem ExitLoop EndSelect WEnd Exit Thanks!
  6. You need something like this #include <Array.au3> $IP = "100.200.50.25" $temp=StringRegExp($IP,"(\d{0,3})\.(\d{0,3})\.(\d{0,3})\.(\d{0,3})",3) _ArrayDisplay($temp,"") $IP1 =$temp[0] ; result need to be 100 $IP2 =$temp[1] ; result need to be 200 $IP3 =$temp[2] ; result need to be 50 $IP4 =$temp[3] ; result need to be 25 $decIP = ($IP1*256*256*256)+($IP2*256*256)+($IP3*256)+$IP4 MsgBox(0, "Decimal IP is:", $decIP) Exit Or maybe next example will be more simple #include <Array.au3> #include <String.au3> $IP = "100.200.50.25" $temp=StringSplit($IP,'.') _ArrayDisplay($temp,"") $IP1 =$temp[1] ; result need to be 100 $IP2 =$temp[2] ; result need to be 200 $IP3 =$temp[3] ; result need to be 50 $IP4 =$temp[4] ; result need to be 25 $decIP = ($IP1*256*256*256)+($IP2*256*256)+($IP3*256)+$IP4 MsgBox(0, "Decimal IP is:", $decIP) Exit
  7. water, Thanks, you are right too! Simple code shows next difference: 0.027 against 19.4 seconds. #include <Array.au3> $timer=TimerInit() Dim $array[5000] $elCount=0 For $a=$elCount To UBound($array,1)-1 $array[$a]=Random(0,100,1) $elCount+=1 Next For $a=$elCount-1 To 0 Step -1 $array[$a]="" $elCount-=1 Next $t1=StringFormat("%.4f",TimerDiff($timer)/1000) $timer=TimerInit() Dim $array2[1] For $a=1 To 5000 _ArrayAdd($array2,Random(0,100,1)) Next For $a=5000 To 1 Step -1 _ArrayDelete($array2,$a) Next $t2=StringFormat("%.4f",TimerDiff($timer)/1000) MsgBox(0,"","Manual "&$t1&"-"&$elCount&" Auto "&$t2&"-"&UBound($array2,1)-1)2 questions are closed, 2 left.
  8. You are right once again! Now I will try to compare _ArrayAdd/Delete function speed with manual value assignment for each element of an array (without call ReDim every time).
  9. Thanks again! You saved a lot of my time from debugging! I made all 2 corrections.
  10. cageman, Thanks, one question is closed. Three more left. Working code: #include <Array.au3> #include <Date.au3> #include <String.au3> Local $avArray[21]=["2007/09/30", _ ;0 "2007/09/30", _ ;1 "2007/10/01", _ ;2 "2007/10/05", _ ;3 "2007/10/05", _ ;4 "2008/01/03", _ ;5 "2008/01/03", _ ;6 "2008/01/03", _ ;7 "2008/01/03", _ ;8 "2008/01/03", _ ;9 "2008/01/03", _ ;10 "2008/01/03", _ ;11 "2008/04/27", _ ;12 "2008/04/27", _ ;13 "2008/04/27", _ ;14 "2008/11/11", _ ;15 "2008/11/30", _ ;16 "2008/11/30", _ ;17 "2008/11/30", _ ;18 "2009/03/17", _ ;19 "2009/03/17"] ;20 _ArraySort($avArray) $iStart="" $iEnd="" $indBS=0 $indBS=_ArrayBinarySearch($avArray,"2008/01/03") If $indBS<>-1 Then If $indBS>0 Then For $v=$indBS-1 To 0 Step -1 If $avArray[$v]=$avArray[$indBS] Then $iStart=$v Else $iStart=$indBS ExitLoop EndIf Next Else $iStart=$indBS EndIf If $indBS<UBound($avArray)-1 Then For $v=$indBS+1 To UBound($avArray)-1 If $avArray[$v]=$avArray[$indBS] Then $iEnd=$v Else $iEnd=$indBS ExitLoop EndIf Next Else $iEnd=$indBS EndIf For $v=$iStart To $iEnd MsgBox(0,"Date",$v&"<Index Date>"&$avArray[$v]) Next EndIf[Edited: added ExitLoop, $iEnd & $iStart =$indBS and two Else statements > Thanks to cageman] Question about forum How can I insert "Tab" in autoit code?
  11. Hm... Error caused by _IELoadWait($oIE) function call. And it seems to be normal, according to description "Browser scripting security restrictions may sometimes prevent _IELoadWait from guaranteeing that a page is fully loaded and can occasionally result in untrapped errors." However I tried your piece of code with my 64Kbps and loading of gmail inbox page and didn't get any error. But I got an error, when I closed IE manually, so these functions maybe are not ideal. Some workarounds for this are described in _IELoadWait reference, and if you just want to get page content, maybe it will be better to download it from net (without loading IE)? Or it will not work fine with .php, which some content is generated by server on demand?
  12. I think that it will be much better if you find a workaround for each error instead of just closing eyes and script Why do not you just add a check for variable type like this: While IsArray($variable)=0 ;add network connection checking here (maybe ping command or there is a special function in autoit) or sleeping interval ;call function to fill array from web once again, maybe need Dim $variable[size] in the begining getFromWeb() WEnd ;process array [Edited: changed loop to while, add network connection checking comment] If I am right, last error appears because of some conditions were not met and variable $o_object don't get and IE object. If so, you can check this in If_Then_Else_EndIf (or other loop) too...
  13. Hello! 1 Closed) Am I right that _ArrayBinarySearch needs that every element in a sorted array had a unique binary (and in most cases usual string) representation? So if I have two or more identical string elements, e.g. "2007/08/01" and "2007/08/01" (which must have identical binary represent. as I think), function will produce unexpected results? #include <Array.au3> ; Local $avArray[21]=["2007/09/30", _ "2007/09/30", _ "2007/10/01", _ "2007/10/05", _ "2007/10/05", _ "2008/01/03", _ "2008/01/03", _ "2008/01/03", _ "2008/01/03", _ "2008/01/03", _ "2008/01/03", _ "2008/01/03", _ "2008/04/27", _ "2008/04/27", _ "2008/04/27", _ "2008/11/11", _ "2008/11/30", _ "2008/11/30", _ "2008/11/30", _ "2009/03/17", _ "2009/03/17"] _ArrayDisplay($avArray,"before") _ArraySort($avArray) _ArrayDisplay($avArray,"after") ;nothing changed, array data has been already entered in ascending order ; $wz=0 $indBS=0 While $indBS<>-1 $indBS=_ArrayBinarySearch($avArray,"2008/01/03",$wz) If $indBS<>-1 Then MsgBox(0,"1",$indBS&" "&$avArray[$indBS]) $wz=$indBS+1 WEndIn this code function finds only 10 and 11 elements. So I have to use slower _ArraySearch? 2 Closed) And another arrays question: Do _ArrayDelete and _ArrayAdd have a big influence on speed while working with 1D or 2D array like [3500] Or [3500][2]? 3) Now question about console windows. Is there an way to get output from console window, which is already executed. I also don't like using Run function with $STDOUT_CHILD flag, because it hide console program output from the user, while I need a possibility to manual interact with console without restarting it. Is it the only right way? : ;Select all text and copy it from the console Func ConsoleC() ;Get it's center $wp=WinGetPos($wh) MouseClick("right",($wp[0]+($wp[2]/2)),($wp[1]+($wp[3]/2)),1,0) Sleep(100) SendP("ы") SendP("{ENTER}") Return ClipGet() EndFunc ;Check console for specified output Func CheckC($outp) While StringInStr(ConsoleC(),$outp)=0 Sleep(300) WEnd EndFuncIt utilizes mouse right click, then "select all" command, then send ENTER to copy selected text and in the end it checks this string for requested data. 4) And last question: Are there any restrictions while using _FileListToArray with $sPath=folder at a linked net disk? I use it for getting list of all files with defined extension in specified folder and it's subfolders. It seems to work fine on my internal hdd with 10 subfolders and about 100 files at all, while connected net disk have about 30 folders and each folder may include more than 1000-1500 files (but with right extension only 15-25 files). THANKS a lot!
×
×
  • Create New...