Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/13/2019 in all areas

  1. When the array dimension(s) are not explicitely specified, the interpretor has to parse the whole init part in full detail to determine the actual dimension(s), before actually loading data into memory. For instance, this: Global $aArray1 = [ _ ['String1', 'String2', 0.71711], _ ['String1', 'String2', 0.70803], _ ['String1', 'String2', 0.44563]] ; last line results in: Array[3][3] [0][0] => String (7) 'String1' [0][1] => String (7) 'String2' [0][2] => Double 0.71711 [1][0] => String (7) 'String1' [1][1] => String (7) 'String2' [1][2] => Double 0.70803 [2][0] => String (7) 'String1' [2][1] => String (7) 'String2' [2][2] => Double 0.44563 But this: Global $aArray2 = [ _ ['String1', 'String2', 0.71711], _ ['String1', 'String2', 0.70803], _ ['String1', 'String2', 0.44563, "Gotcha", "bigger than you thought", "and much bigger really!"]] ; last line yields: Array[3][6] [0][0] => String (7) 'String1' [0][1] => String (7) 'String2' [0][2] => Double 0.71711 [0][3] => String (0) '' [0][4] => String (0) '' [0][5] => String (0) '' [1][0] => String (7) 'String1' [1][1] => String (7) 'String2' [1][2] => Double 0.70803 [1][3] => String (0) '' [1][4] => String (0) '' [1][5] => String (0) '' [2][0] => String (7) 'String1' [2][1] => String (7) 'String2' [2][2] => Double 0.44563 [2][3] => String (6) 'Gotcha' [2][4] => String (23) 'bigger than you thought' [2][5] => String (23) 'and much bigger really!' That implies much more work at init time than this: Global $aArray2[][6] = [ _ ['String1', 'String2', 0.71711], _ ['String1', 'String2', 0.70803], _ ['String1', 'String2', 0.44563, "Gotcha", "bigger than you thought", "and much bigger really!"]] ; last line because by finding the column dimension, the interpreter only has to count rows and can store data on the fly. Better still, provide the actual dimensions at declaration [10000][2], since values are known in advance or easily counted. This slowdown isn't noticeable when arrays are small but can waste enough cycles to make a difference in your use case.
    2 points
  2. deleting allways same item 32 is not correct and I would be surprised if thats the cause Send("{UP 32}") is shorter wayfor send 32 times an up key but also not causing your issue Check in first round with simplespy the identification string for that objet check in 2nd round again with simplespy the identification string (it can be after a page save/refresh that descriptions are changing) put output of simplespy for some elements in this thread we could identify in a different way (could be harder to make as You have to guess a little on the indexrelative value)     ; Work Order Number     _UIA_setVar("oWorkOrder","Title:=Work Order:;controltype:=UIA_EditControlTypeId;class:=")     ; Location     _UIA_setVar("oLocation","Title:=Work Order:;indexrelative:=2") similar for index but thats much harder as its only based on controltype     ; Work Order Number     _UIA_setVar("oWorkOrder","controltype:=Edit;index:=5")     Sleep(300)     ; Location     _UIA_setVar("oLocation","controltype:=Edit;index:=6")     Sleep(300) check what the xml logfile is saying
    1 point
  3. remove: ;class:= from all your descriptions in uia_setvar it doesnt add anything write this: controltype:=UIA_EditControlTypeId as controltype:=Edit although both will work it makes it a little easier to read I miss somewhere in your coding _UIA_Action($cDocument,"setfocus") and not setting focus to chrome window. Also not reason it doesnt work but it will give more speed if mainwindow is given.
    1 point
  4. No it does exactly what it should do it removes the RTI.<name> items from the internal array as you can see the array has your logical description for example like oworkOrder. When its found it adds another enrtry RTI.oWorkOrder which on screen looks empty in col1 but ac tually contains the physical object reference to the object. This is then reused on the same page when you do another action with same object. Looking at your script You should cleanup your script a little for example make a function like this and put it before the while loop. Its not needed to repeat this part and sleep is also not needed for _uia_setvar func defineElements() ;=============================================================================== ; Store the Elements ;=============================================================================== ; Description _UIA_setVar("oDescription","Title:=Description:;controltype:=UIA_EditControlTypeId;class:=") ; Work Order Number _UIA_setVar("oWorkOrder","Title:=Work Order:;controltype:=UIA_EditControlTypeId;class:=") ; Location _UIA_setVar("oLocation","Title:=Location:;controltype:=UIA_EditControlTypeId;class:=") ; Work Type _UIA_setVar("oWorkType","Title:=Work Type:;controltype:=UIA_EditControlTypeId;class:=") ; Reported By Date _UIA_setVar("oDate","Title:=Reported Date:;controltype:=UIA_EditControlTypeId;class:=") ; Reported By Person _UIA_setVar("oCustomer","Title:=Reported By:;controltype:=UIA_EditControlTypeId;class:=") ; Reported By Email _UIA_setVar("oEmail","Title:=Reported By Email:;controltype:=UIA_EditControlTypeId;class:=") ; Reported By Phone _UIA_setVar("oPhone","Title:=Reported By Phone:;controltype:=UIA_EditControlTypeId;class:=") ndfunc Hard to say as in video it looks 2nd loop starts as it fills the first 2 fields. There should be a logfile xml telling you in detail what object its looking for an if object is found
    1 point
  5. I love people like you. Going into threads you have no idea about, demanding answers like it's some sort of communist deposition while providing ZERO input, throwing a little fit when called on it, and I'm almost sure, feeling like the other person is the d... If you don't want to help or you're frustrated by people asking for help, that's absolutely fine --> don't join a thread and jog along.
    1 point
  6. You're right. The following code takes around 65 s on my slow, slow PC. Local $h = FileOpen("arr12x10kx3.au3", 2) FileWriteLine($h, '#include-once' & @CRLF) For $i = 1 To 12 FileWriteLine($h, 'Local $a' & $i & ' = [ _') For $j = 1 To 9999 FileWriteLine($h, ' ["abcdefghijklm", "nopqrstuvwxyz", 0.123456789], _') Next FileWriteLine($h, ' ["abcdefghijklm", "nopqrstuvwxyz", 0.123456789] _') FileWriteLine($h, ']' & @CRLF) Next Local $t = TimerInit() #include "arr12x10kx3.au3" ConsoleWrite(TimerDiff($t)) Anyway consider SQLite. Remember you can FileInstall the SQLite library. Of course accessing an array via index will be faster than a database, but the advantage of a DB goes way beyond accessing a single item thru individual indices. It all depends on how you'll be accessing data and what you intend to compute (e.g. statistical or partial results).
    1 point
  7. Local $oDict1 = ObjCreate("Scripting.Dictionary") Local $oDict2 = ObjCreate("Scripting.Dictionary") $odict1.add("B","Value b") $odict1.add("C","Value c") $odict1.add("D","Value d") $odict1.add("E","Value e") $odict2.add("A","Value a") $odict2.add("B","Value b") $odict2.add("C","Value c") $odict2.add("E","Value e") $odict2.add("F","Value f") $diff=compDic($oDict1,$oDict2) for $i=0 to $diff.count-1 consolewrite($diff.keys[$i]) Next consolewrite(@CRLF) $diff=compDic($oDict2,$oDict1) for $i=0 to $diff.count-1 consolewrite($diff.keys[$i]) Next func compDic($d1,$d2) Local $oDiff = ObjCreate("Scripting.Dictionary") for $i=0 to $d1.count-1 if $d2.exists($d1.keys[$i]) Then ;~ consolewrite($d1.keys[$i]) else $oDiff.add($d1.keys[$i], $d1.items[$i]) EndIf Next return $oDiff endfunc
    1 point
  8. Sounds really long to read a text file and split it into columns Read the full textfile in a variable Split it with a regex into an array example like below based on fixed columns of size 2,2,3 and a CRLF at end of each line #include <StringConstants.au3> #include <array.au3> $strData="ABCDEFG" & @CRLF $strData&="HIJKLMN" & @CRLF $strData&="OPQRSTU" & @CRLF $strData&="VWXYZAB" & @CRLF ;~ $strData=fileread("data.txt") consolewrite($strdata) ;~ Split fixed line $aArray=StringRegExp($strData,"(.{2})(.{2})(.{3})(\R)",$STR_REGEXPARRAYGLOBALFullMATCH) consolewrite(@error&@CRLF) Local $aMatch = 0 For $iRow = 0 To UBound($aArray) - 1 $aMatch = $aArray[$iRow] For $iCol = 1 To UBound($aMatch) - 1 consolewrite($iRow & ',' & $icol & ":" & $aMatch[$icol] &@CRLF) Next Next
    1 point
  9. Hi, here a little tool to create ISO files from default ISO 9660 (2048 bytes/sector) CD or DVD format (no audio cd and BD support yet!) Source is too huge for code box -> Look here to have a look to the source code Additional credits to: Ward for MD5 checksum / MemoryDLL routines Harald Vistnes for cd2iso used in v1 and v2 Yashied for WinAPIEx.au3 wolf9228 to play wave from memory AutoItObject Team Download (purely written with AutoIt): ISO Creator v1.16 build 2015-07-13 beta.7z (1110 downloads previously) Thanks to smashly for pointing me to right direction The development of v1 and v2 is discontinued! Download v1: ISO Creator v1.0.0 build 2011-08-03 beta v1.7z (195 downloads previously) Download v2 (everything is called directly from memory): ISO Creator v1.0.0 build 2011-08-03 beta v2.7z (117 downloads previously) Thanks to smartee for the DLL version (experimental) of cd2iso! v1 is using cd2iso.exe to create the ISO v2 is using cd2iso.dll which was created by smartee. For compiled v1, v2 and pure AutoIt versions only (x86) visit (ISO Creator Exe only): 4shared.com or MediaFire You can call ISO Creator.exe also with command line parameters: ISO Creator.exe -s [source cd/dvd drive] -d [filename] (-md5) (-aem) (-exit) -s and -d are mendatory if called from command line! Tested on Win7 x64. If you find any bug please report here! Many thanks to smartee and smashly for their efforts on this project! Br, UEZ Change Log:
    1 point
  10. https://docs.microsoft.com/en-us/windows/win32/uxguide/inter-mouse
    1 point
  11. mLipok

    Error in ie.au3

    look in helpfile: ObjEvent()or just use: #include <IE.au3> _IEErrorHandlerRegister()
    1 point
  12. wysocki, You can use this snippet to determine the AutoIt version: MsgBox(0, "Version", @AutoItVersion) M23
    1 point
  13. Thanks for this topic, and all those which link to it. Nevertheless I feel it misses something... Kiboost did tell it without telling it: these text Verbs() are localized. As I like to do world-apps, at least at usage level, here is the way I found to get the current system strings from Windows shell32.dll (thanks to google I found and this here by searching "Pin to Tas&kbar" : http://www.win7dll.info/shell32_dll.html). Thanks to all involved people. The code below allows to pin or unpin to/from Start Menu or TaskBar, and allows to define argument(s) for pinned applications, in any language. As I don't have a Enterprise or Ultimate Windows Seven, I wasn't able to test if this was suitable to each and every localized Windows 7, but as I'm confident Windows doesn't work by magic, it should be international. But, as a matter of fact, Windows is sometimes strange, so I would like Spanish, Russian, Endian and any other language than French to be confirmed as working with this method, if you're kind enough to do so, thanks. #include-once #include <WinAPI.au3> #include <Constants.au3> Func _pinunpin($filepath, $action = 'p2sm', $arguments = '') $clean = 0 If Not FileExists($filepath) Or @OSBuild < 7600 Then Exit ; to arrange to your liking, SetError() & co ;split path, filename and extension $pathsplit = StringSplit($filepath, '\') $lastp = $pathsplit[0] $file = $pathsplit[$lastp] $path = StringReplace($filepath, $file, '') $path = StringTrimRight($path, 1) $filesplit = StringSplit($file, ".") $last = $filesplit[0] $fileext = $filesplit[$last] $filename = StringReplace($file, '.' & $fileext, '', 1) ;define code to use depending on action choosen Switch $action Case 'pin2SM', 'p2sm' ;pin to Start Menu $code = 5381 Case 'unpinFromSM', 'up2sm' ;unpin from Start Menu $code = 5382 Case 'pin2TB', 'p2tb' ;pin to Task Bar $code = 5386 Case 'unpinFromTB', 'up2tb' ;unpin from Task Bar $code = 5387 EndSwitch ;if arguments, make a shortcut, pin it then mark it for deletion If $arguments <> '' And $code <> 5382 And $code <> 5387 Then $linkfile = @DesktopDir & '\' & $filename & '.lnk' FileCreateShortcut($filepath, $linkfile, $path, $arguments, $filename & ' ' & $arguments, $filepath) $path = @DesktopDir $file = $filename & '.lnk' $clean = 1 EndIf ;retrieve Localized text for action $hInstance = _WinAPI_LoadLibraryEx('shell32.dll', $LOAD_LIBRARY_AS_DATAFILE) If $hInstance Then $localizedstring = _WinAPI_LoadString($hInstance, $code) ;If @error Then MsgBox(0, "Error", _WinAPI_GetLastErrorMessage()) ;debug _WinAPI_FreeLibrary($hInstance) EndIf ;when unpining from Start Menu, use the shortcut that is effectively pinned to do so, if argument(s) they are ignored If $code == 5382 Then $path = @UserProfileDir & '\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu' $file = $filename & '.lnk' EndIf ;pin or unpin $objShell = ObjCreate('Shell.Application') $objFolder = $objShell.Namespace($path) $objFolderItem = $objFolder.ParseName($file) For $val in $objFolderItem.Verbs() If StringInStr($val(), $localizedstring) Then $val.DoIt() Next ;clean temporary shortcut If $clean Then FileDelete($linkfile) EndIf EndFunc ;usage _pinunpin('C:\Windows\System32\calc.exe') ;pin Windows' calculator to taskbar. _pinunpin('C:\Windows\System32\notepad.exe', 'p2tb', 'C:\Windows\system.ini') ;pin notepad to start menu with system.ini file as argument (completely useless, but this file should be on any win7) This code can't switch between pin/unpin, you have to tell it the right action to do, or adapt the Switch part to enable unpin/pin switching.
    1 point
  14. Ah, the _WinAPI_RedrawWindow function is what I came across before and couldn't remember where/what it was. Thanks to both.
    1 point
×
×
  • Create New...