Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all 12506 articles
Browse latest View live

Problem Storing Arrays Inside Arrays

$
0
0

Hello guys, I have a matrix inverse function that I am trying to improve the accuracy of by making it preform math on fractions instead of floats, however is appears I'm having issues accessing an array embedded inside a 2D array ($array[1][1][0]) where [0] would contain a 1D array with 2 values in it.

 

See my code below, and as always thanks a ton! (you will need the fractions UDF http://www.autoitscript.com/forum/topic/165558-fraction/)

AutoIt         
#include "fractions.au3" #include <array.au3> $matricies = _loaddata(_datagen()) _inv_big($matricies[0]) Func _inv_big($m)         Local $n = UBound($m, 1)         Local $a[$n][2 * $n]         Local $inv[$n][$n]         Local $temprow[2 * $n]         Local $pivelt, $tarelt, $pivrow, $tarrow, $k, $i, $j         #Region - Filling matrix A             For $i = 0 To $n - 1                 For $j = 0 To $n - 1                     $a[$i][$j] = $m[$i][$j]                 Next             Next             For $i = 0 To $n - 1                 $a[$i][$n + $i] = 1             Next         #EndRegion - Filling matrix A         #Region - Inverting matrix $M             For $pivrow = 0 To $n - 1                 $pivelt = $a[$pivrow][$pivrow]                 If ($pivelt == 0) Then                     $k = $pivrow + 1                     While ($pivelt == 0 AND $k <= $n)                         $pivelt = $a[$k][$pivrow]                         $k = $k + 1                     WEnd                     If ($pivelt == 0) Then                         SetError(1)                         Return                     Else                         For $i = 0 To 2 * $n - 1                             $temprow[$pivrow][$i] = $a[$pivrow][$i]                             $k = $k - 1                         Next                         For $i = 0 To 2 * $n - 1                             $a[$pivrow][$i] = $a[$k][$i]                         Next                         For $i = 0 To 2 * $n - 1                             $a[$k][$i] = $temprow[$k][$i]                         Next                     EndIf                 EndIf                 For $i = 0 To 2 * $n - 1                     $a[$pivrow][$i] = _fraction(Number($a[$pivrow][$i]), Number($pivelt))                     ;array is accessable here                 Next                 #Region - replace all other rows by target                     For $tarrow = 0 To $n - 1                         If ($tarrow <> $pivrow) Then                             $tarelt = $a[$tarrow][$pivrow]                             For $i = 0 To 2 * $n - 1                                 $a[$tarrow][$i] = _FractionSubtract(_fraction(number($a[$tarrow][$i])), _FractionMultiply($a[$pivrow][$i], _fraction(number($tarelt))))                                 _ArrayDisplay($a[$tarrow][$i])                                 ;array is accessable here via _arraydisplay() but when I try to consolewrite the values it says the dimension range is exceeded                                 ConsoleWrite($a[$tarrow][$i][0]&'/'&$a[$tarrow][$i][1]&@CRLF)                                                             Next                          EndIf                       Next                       ;array is accessable here with _arraydisplay but still not via any other method                 #EndRegion - Now replace all other rows by target row minus pivot row times element in target row and pivot colum              Next                 _ArrayDisplay($a)              ;array is nullified, all values for the array get set to 1             #Region - finally extract the inverse from columns N+1 to 2N                 For $i = 0 To $n - 1                     For $j = 0 To $n - 1                         $inv[$i][$j] = $a[$i][$n + $j]                     Next                 Next             #EndRegion - finally extract the inverse from columns N+1 to 2N             Return $inv         #EndRegion - Inverting matrix $M      EndFunc      Func _datagen()         Local $ret         For $i = 1 To 112             Local $data = ""             For $x = 0 To 7                 For $y = 0 To 7                     $data &= Random(111111111, 99999999999, 1) & ","                 Next                 $data = StringTrimRight($data, 1) & "/"             Next             $ret &= StringTrimRight($data, 1) & "|"         Next         Return $ret      EndFunc     Func _loaddata($data, $z = 112)         Local $dataz[$z]         $array = StringSplit($data, "|")         If $array[0] < $z - 1 Then Return 0         For $i = 0 To $z - 1             $dataz[$i] = _stringtoarray($data, $i)             If $dataz[$i] = 0 Then                 Return 0             EndIf         Next         Return $dataz     EndFunc     Func _stringtoarray($data, $n = 0)         $array = StringSplit($data, "|", 2)         $next = StringSplit($array[$n], "/")         $num2 = StringSplit($next[1], ",")         Local $ar1[$next[0]][$num2[0]]         For $i2 = 1 To $next[0]             $next2 = StringSplit($next[$i2], ",", 2)             For $i3 = 0 To UBound($next2) - 1                 If $i2 - 1 > $next[0] - 1 OR $i3 > $num2[0] - 1 OR $i3 > UBound($next2) Then                     Return 0                 EndIf                 $ar1[$i2 - 1][$i3] = $next2[$i3]             Next         Next         Return $ar1     EndFunc

array variable dimension range exceeded error

$
0
0

I'm fairly new to autoit and I'm having issues with reading from my array. My scripts is basically as follows:

$MyArray = IniReadSection ("Someini.ini" , "iniSection") $NoElements = UBound($MyArray) $i=1 For $i = 1 to $NoElements-1 MsgBox ($MB_SYSTEMMODAL, "", $MyArray[$i]) Next

The $NoElements variable returns the correct number of elements in the array (+1) however when I try to display the values in a message box I get the range exceeded error. I tested the _FileWriteFromArray after I created the array so I know its not empty.

 

Can someone point out where I'm going wrong.

Newb need help with script

$
0
0

I am having trouble with one part of the code, It is made to detect a pixel on the screen that is given a set color. I want it to give 2 scripts (one if it finds the pixel, and another if it doesnt.)

 

I have "If @error then" and the script, IF it did not find the pixel.

I have "If Not @error Then" and the script, IF it found the pixel.

 

It just seems to continue the whole script in order, ignoring the "If @error then" & "If Not @error Then"

Plain Text         
Global $Runner HotKeySet("{ESC}", "Terminate") HotKeySet("{F1}", "Click") Func Terminate() Exit 0 EndFunc Func Click() PixelSearch(1233, 826, 1386, 852, 0xFFCC00) If @error then     MouseClick("left", 716, 698, 10) Sleep (500) Send("{a down}")     Sleep (800)     Send("{a up}")     Sleep (500)     MouseClick("left", 716, 698, 10)     Sleep (500)     Send("{d down}")     Sleep (800)     Send("{d up}")     Sleep (500)     MouseClick("left", 716, 698, 10)     Sleep (500)     EndIf If Not @error Then     Sleep (500)     MouseClick("left", 863, 697, 3)     Sleep (500)     MouseClick("left", 701, 750, 3)     Sleep (500)     MouseClick("left", 863, 697, 3)     Sleep (500)     MouseClick("left", 701, 750, 3)     Sleep (500)     MouseClick("left", 1095, 873, 3)     Send("{@ 1}")     Sleep (100)     Send("{c 1}")     Sleep (100)     Send("{o 1}")     Sleep (100)     Send("{n 1}")     Sleep (100)     Send("{f 1}")     Sleep (100)     Send("{l 1}")     Sleep (100)     Send("{i 1}")     Sleep (100)     Send("{c 1}")     Sleep (100)     Send("{t 1}")     Sleep (100)     Send("{s 1}")     Sleep (100)     Send("{o 1}")     Sleep (100)     Send("{u 1}")     Sleep (100)     Send("{l 1}")     Sleep (100)     Send("{Space 1}")     Sleep (100)     Send("{d 1}")     Sleep (100)     Send("{Enter 1}")     Sleep (500)     Send("{@ 1}")     Sleep (100)     Send("{c 1}")     Sleep (100)     Send("{o 1}")     Sleep (100)     Send("{n 1}")     Sleep (100)     Send("{f 1}")     Sleep (100)     Send("{l 1}")     Sleep (100)     Send("{i 1}")     Sleep (100)     Send("{c 1}")     Sleep (100)     Send("{t 1}")     Sleep (100)     Send("{s 1}")     Sleep (100)     Send("{o 1}")     Sleep (100)     Send("{u 1}")     Sleep (100)     Send("{l 1}")     Sleep (100)     Send("{Space 1}")     Sleep (100)     Send("{d 1}")     Sleep (100)     Send("{Enter 1}")     Sleep (500) Send("{@ 1}")     Sleep (100)     Send("{c 1}")     Sleep (100)     Send("{o 1}")     Sleep (100)     Send("{n 1}")     Sleep (100)     Send("{f 1}")     Sleep (100)     Send("{l 1}")     Sleep (100)     Send("{i 1}")     Sleep (100)     Send("{c 1}")     Sleep (100)     Send("{t 1}")     Sleep (100)     Send("{s 1}")     Sleep (100)     Send("{o 1}")     Sleep (100)     Send("{u 1}")     Sleep (100)     Send("{l 1}")     Sleep (100)     Send("{Space 1}")     Sleep (100)     Send("{d 1}")     Sleep (100)     Send("{Enter 1}")     Sleep (500)     EndIf EndFunc While 1     Sleep(100)     WEnd

Problem with SQLite...

$
0
0

SQLite v 3.8.8.3

AutoIT v 3.3.12.0

 

SQL statement is:

UPDATE Metadata SET AcquisitionTime="2009/04/23 16:14:23" WHERE SourceURL="M:\1\1 Giant Leap-My Culture.mp3";
 

Getting @error = 2 and 21 as the result from _SQLite_Exec()

 

If I set _SQLite_SafeMode(False), I get a out of memory error on _SQL_Exec().
 
Sending this line via SQLite Admin (using SQLite v 3.8.8.3) works fine.
 
Databases are fine as I pull data from them prior to doing the UPDATE sql and load them into arrays.
 
I also can't seem to find where the SQLite constants are as referred to in the Help file under _SQLite_Exec - Return Value - Failure.
 
TIA

Should a registry key always be set with a value?

$
0
0

Just a quick one

 

On something im doing it sets a key based on essentially a yes or no question like this but im getting some weird answers on some parts of the gui and i wondered if this was causing it

                    Local $WinUpdateCheck = MsgBox($MB_YESNO + $MB_ICONWARNING + $MB_DEFBUTTON2, 'Update Check', 'Are The Updates Completed')                     If $WinUpdateCheck = 6 Then                         GUICtrlSetImage($WinUpdateIcon, $tick)                         RegWrite('HKEY_LOCAL_MACHINE\SYSTEM\Setup\Simple', 'Updates', 'REG_SZ', _Date_Time_SystemTimeToDateTimeStr($CuDate))                     ElseIf $WinUpdateCheck = 7 Then                         GUICtrlSetImage($WinUpdateIcon, $cross)                         RegWrite('HKEY_LOCAL_MACHINE\SYSTEM\Setup\Simple', 'Updates', 'REG_SZ', 'False')                     EndIf

So the question really is should i set the negative key as the word False?

 

O should it be set as '' , does it matter setting a word what happens if the key doesn't exist ? that would make a third condition wouldn't it

 

So should i set the key differently than i am

 

Advice please

Slow Insert to sqlite db

$
0
0

Hi,

 

This is a question about sqlite.

 

I have a large size 2 dimension array that I want to insert it into physical sqlite database table (not in memory).

My problem is that it is take very long time.

 

How do I make it faster?

 

BTW: On my computer its take 92 seconds!

 

 

Insert to database took 92.2876927154525 seconds!

 

Here is a code sample to assist me.

AutoIt         
#include <Array.au3> #include <MsgBoxConstants.au3> #include <SQLite.au3> #include <SQLite.dll.au3> Local $iRows, $iColumns, $aRes Local $hDB = @ScriptDir & "\" & "Test.db" If FileExists($hDB) Then FileDelete($hDB) Local $aResult, $iRows, $iColumns, $iRval ;Local $aArray[5][2] Local $hTimer, $fDiff _SQLite_Startup() If @error Then     MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite.dll Can't be Loaded!")     Exit -1 EndIf $hDskDb = _SQLite_Open($hDB) If @error Then     MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't Load Database!")     Exit -1 EndIf Local $aArray[100][3] For $i = 0 To UBound($aArray) - 1     For $j = 0 To UBound($aArray, 2) - 1         $aArray[$i][$j] = "Item" & $i * $j     Next Next ;_ArrayDisplay($aArray) If Not _SQLite_Exec($hDskDb, "CREATE TABLE T (Column0, Column1,Column2);") = $SQLITE_OK Then _         MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg()) $hTimer = TimerInit() For $i = 0 To UBound($aArray) - 1     _SQLite_Exec($hDskDb, "INSERT INTO T (Column0,Column1,Column2) VALUES ( " & _SQLite_FastEscape($aArray[$i][0]) & "," & _SQLite_FastEscape($aArray[$i][1]) & "," & _SQLite_FastEscape($aArray[$i][2]) & ");") Next $fDiff = TimerDiff($hTimer) ConsoleWrite(@CRLF & "Insert to database took " & $fDiff / 1000 & " seconds!" & @CRLF) _SQLite_GetTable2d($hDskDb, "SELECT * FROM T;", $aRes, $iRows, $iColumns) _SQLite_Display2DResult($aRes) ; Output to Console _SQLite_Close() _SQLite_Shutdown()

Array mind bender help

$
0
0

I'm in the middle of a rather large project, and have gotten to the point where I'm out of ideas on how to handle populating arrays and sorting them, from other arrays.

 

To me, it's quite complicated and I'm quite lousy with words, but I'll try just that same.

 

I have a 'Master' array, which has in it a lot of names of items.

Those items have 2 specific types, the type, and the subtype.

 

Into my script I get some arrays passed (determined at runtime)

 

I need to use the master array, by looping through it to determine how many of each item are listed in the passed in arrays, add up the total of all the sub types of each type, and show it in a new array. The sub types must also be listed under the type.

Like I say, it's quite complicated, and the passed in arrays may or may not contain a given type, or a certain subtype of that type.

 

I'm getting lost again here, so I'l post the reproduce I've made (I hoped I'd get insired while creating the reproducer, but alas, I did not)

 

Hope someone can make sense of it with comments, and offer some help...

AutoIt         
#include <Array.au3> ; Some Strings to create arrays from $sNames = "Name1,Name2,Name3,Name4,Name5,Name6,Name7,Name8,Name9,Name10,Name11," _          & "TName12,Name13,Name14,Name15,Name16,Name17,Name18,Name19,Name20,Name21," _          & "Name22,Name23,Name24,Name25,Name26,Name27,Name28,Name29,Name30,Name31," _          & "Name32,Name33,Name34,Name35,Name36,Name37,Name38,Name39,Name40" $sTypes = "Type1,Type2,Type3,Type4,Type5" $sSubTypes = "SubType1,SubType2,SubType3,SubType4,SubType5,SubType6,SubType7," _          & "SubType8,SubType9,SubType10,SubType11,SubType12,SubType13,SubType14,SubType15" ; Create arrays for Item Names, Item Types, and Item Sub Types Global $aNames = StringSplit($sNames, ",", 2) Global $aTypes = StringSplit($sTypes, ",", 2) Global $aSubTypes = StringSplit($sSubTypes, ",", 2) ; Create a 2D array With all Names, and fill it ; they must have a randon type nnd sub type Global $aMasterArray[UBound($aNames)][3] For $i = 0 To UBound($aNames) - 1     $aMasterArray[$i][0] = $aNames[$i]     $aMasterArray[$i][1] = $aTypes[Random(0, UBound($aTypes) - 1, 1)]     $aMasterArray[$i][2] = $aSubTypes[Random(0, UBound($aSubTypes) - 1, 1)] Next ; So this is the master array, similar to what I'm working with _ArrayDisplay($aMasterArray, "$aMasterArray") ; Now here I'm generating an array of sub arrays, which gets fed into ; my script via some other methods. ; ; I do not know how many sub arrays there will be until run time ; which is why I have to hold them in a dynamic array. Global $ArrayOfArrays = _GenerateArrayOfArrays() _ArrayDisplay($ArrayOfArrays, "$ArrayOfArrays") ; This is what I'd likr the resulting array to be like _Wish() Func _GenerateArrayOfArrays()     ; Array needs to hold a random amount of sub arrays     Local $iNumberOfSubArrays = Random(2, 7, 1)     ; Create array with random index count     ; plus 1 to hold the count     Local $aArrays[$iNumberOfSubArrays + 1] = [$iNumberOfSubArrays]     ; Add sub arrays to $aArrays     For $i = 1 To Int($aArrays[0])         $aArrays[$i] = _GenerateArray()     Next     Return $aArrays EndFunc   ;==>_GenerateArrayOfArrays Func _GenerateArray()     ; Sub arrays also need random index count     ; They have random Name, Type, and Sub Type same as master array     ; except they also have a value in col 3     Local $iIndexCount = Random(10, 60, 1)     Local $array[$iIndexCount][4]     For $i = 0 To UBound($array) - 1         $array[$i][0] = $aNames[Random(0, UBound($aNames) - 1, 1)]         $array[$i][1] = $aTypes[Random(0, UBound($aTypes) - 1, 1)]         $array[$i][2] = $aSubTypes[Random(0, UBound($aSubTypes) - 1, 1)]         $array[$i][3] = Round(Random(0, 200), 2)     Next     _ArraySort($array)     _ArrayDisplay($array, "Sub array")     Return $array EndFunc   ;==>_GenerateArray Func _Wish()     Local $array[10][7]     $array[0][0] = "Type1"     $array[0][1] = "283.56"     $array[0][2] = "413.56"     $array[0][3] = "52.06"     $array[0][4] = "320.51"     $array[0][5] = "763.36"     $array[0][6] = "685.00"     $array[1][0] = "SubType1"     $array[1][1] = "29.56"     $array[1][2] = "63.56"     $array[1][3] = "2.06"     $array[1][4] = "90.51"     $array[1][5] = "64.36"     $array[1][6] = "15.00"     $array[2][0] = "SubType2"     $array[2][1] = "29.56"     $array[2][2] = "63.56"     $array[2][3] = "2.06"     $array[2][4] = "90.51"     $array[2][5] = "64.36"     $array[2][6] = "15.00"     $array[3][0] = "SubType4"     $array[3][1] = "29.56"     $array[3][2] = "63.56"     $array[3][3] = "2.06"     $array[3][4] = "90.51"     $array[3][5] = "64.36"     $array[3][6] = "15.00"     $array[4][0] = "Type2"     $array[4][1] = "283.56"     $array[4][2] = "413.56"     $array[4][3] = "52.06"     $array[4][4] = "320.51"     $array[4][5] = "763.36"     $array[4][6] = "685.00"     $array[5][0] = "SubType3"     $array[5][1] = "83.56"     $array[5][2] = "13.56"     $array[5][3] = "2.06"     $array[5][4] = "20.51"     $array[5][5] = "63.36"     $array[5][6] = "85.00"     $array[6][0] = "SubType6"     $array[6][1] = "83.56"     $array[6][2] = "13.56"     $array[6][3] = "2.06"     $array[6][4] = "20.51"     $array[6][5] = "63.36"     $array[6][6] = "85.00"     $array[7][0] = "Type3"     $array[7][1] = "283.56"     $array[7][2] = "413.56"     $array[7][3] = "52.06"     $array[7][4] = "320.51"     $array[7][5] = "763.36"     $array[7][6] = "685.00"     $array[8][0] = "SubType5"     $array[8][1] = "83.56"     $array[8][2] = "13.56"     $array[8][3] = "2.06"     $array[8][4] = "20.51"     $array[8][5] = "63.36"     $array[8][6] = "85.00"     $array[9][0] = "SubType8"     $array[9][1] = "83.56"     $array[9][2] = "13.56"     $array[9][3] = "2.06"     $array[9][4] = "20.51"     $array[9][5] = "63.36"     $array[9][6] = "85.00"     _ArrayDisplay($array, "Type then all it's subtypes below, the large number = sum of sub types") EndFunc   ;==>_Wish

_StringInsert fails when insertion point > 65535

$
0
0
#include <String.au3> Global $iLength = 99999 ; change it to whatever, as long as it's longer than the insert point Global $iInsert = 65536 ; insert point 65536 => not working, and no @error. change it to 65535 => OK Global $s1 = _StringRepeat('a', $iLength) $s1 = _StringInsert($s1, 'b', $iInsert) ConsoleWrite( _         '@error = ' & @error & @LF & _         'Length = ' & StringLen($s1) & @LF & _         'Char   = ' & StringMid($s1, $iInsert + 1, 1) & @CRLF)

issue is quite simple really, title and code above speaks for itself. i'm just trying to make sure i'm not missing the obvious before submitting a ticket.

 

issue exists in AutoIt v3.3.12.0 & v3.3.10.2, as well as latest Beta.

issue does not exist in AutoIt v3.3.8.1

 

there was a major rewrite of this function after v3.3.8.1, but it's now using StringRegExpReplace, which i'm not comfortable with.

 


regrexp help

$
0
0

hi guy i try to learn  regrexp 

 

i use  regexbuddy 

 

i want  take  a part of  this code 

<div class="contList" abp="100"> <ul class="unstyled" id="categoryList" abp="101">   <li class="btn btn-small gradient eleCat" abp="102"><a  href="/b2b/Ricerche/FantaRicerca/MostraFiltri?catMerc=HE&codFamiglia=HE0"  abp="103">CD PLAYERS</a></li>   <li class="btn btn-small gradient eleCat" abp="104"><a  href="/b2b/Ricerche/FantaRicerca/MostraFiltri?catMerc=HE&codFamiglia=HE6"  abp="105">CD RECORDERS</a></li>   <li class="btn btn-small gradient eleCat" abp="106"><a  href="/b2b/Ricerche/FantaRicerca/MostraFiltri?catMerc=HE&codFamiglia=HE4"  abp="107">CD/CASSETTE PLAYERS</a></li>

i try to use  this  expression for  take 

'(?i)abp=".+?"><a\n href="(*.?)"'

but  tell me  RegexBuddy does not yet support backtracking control verbs

and in autoit  not  run 

some on can help me ??  thankz  at  all  for patient 

 

Looking for assistance with MS Access

$
0
0

Hello, all! First-time poster here. I am starting to learn autoit to help me with various tasks at work, primarily with MS Access 2013 databases. My current project is using autoit to start access 2013 and open a specific database (.accdb format). I've searched high and low on the internet for threads specifically addressing this subject and come up dry. I know that I'm not understanding the script requirements, so I'll post my chicken scratch and let everyone see what I'm working with. Any help you can offer would be much appreciated! 

  1. Run ( "C:\Program Files\Microsoft Office\Office 15\MSACCESS.exe" [, "Drive\Folder\Database"])

InetRead

$
0
0

Hi, I have a small question.
Why not go to read this text?

$txt = BinaryToString(InetRead("http://url.com", 1),4) MsgBox(0,"",$txt)

Disabling a button in an Internet Explorer_Server instance using IUIAutomation

$
0
0

Hello everyone,

 

I support an application which has an Internet Explorer_Server instance in a pane of the application. There are a few buttons we would like to disable in the application, as it causes many an issue whenever users click on the buttons. The buttons which are part of the application/program are easy to disable (there was a "Print" button which we have disabled this way, thus forcing the user to use the "File->Print" option as that is the preferred method) but those which are part of the Internet Explorer_Server pane were inaccessible. Enter Junkew's IUIAutomation UDF.

 

I've been trying to follow the threads regarding IUIAutomation, and while I've been able to highlight the button (which in itself is a great accomplishment in my view) I can't find a way to disable said button. Is this even possible? If this were a regular button, I could get the handle of the control and manipulate it that way. I understand that the "automation" part doesn't include disabling items (who does that, right?) but I was wondering if someone savvier than myself knew of a method to do this.

 

Below is the code provided by simple spy (which I commented out to use the shorter version of the program at the end) Some information has been removed, but it was mostly to protect innocent servers. :-) Any guidance/assistance would be greatly appreciated.

 

Plain Text         
#include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) #cs Local $oP13=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=[Horizon Ambulatory Care];controltype:=UIA_WindowControlTypeId;class:=WindowsForms10.Window.8.app4", $treescope_children) _UIA_Action($oP13,"setfocus") Local $oP12=_UIA_getObjectByFindAll($oP13, "Title:=Workspace;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.MDICLIENT.app4", $treescope_children) _UIA_Action($oP12,"setfocus") Local $oP11=_UIA_getObjectByFindAll($oP12, "Title:=Horizon Ambulatory Care;controltype:=UIA_WindowControlTypeId;class:=WindowsForms10.Window.8.app4", $treescope_children) _UIA_Action($oP11,"setfocus") Local $oP10=_UIA_getObjectByFindAll($oP11, "Title:=;controltype:=UIA_PaneControlTypeId;class:=Shell Embedding", $treescope_children) _UIA_Action($oP10,"setfocus") Local $oP9=_UIA_getObjectByFindAll($oP10, "Title:=;controltype:=UIA_PaneControlTypeId;class:=Shell DocObject View", $treescope_children) _UIA_Action($oP9,"setfocus") Local $oP8=_UIA_getObjectByFindAll($oP9, "Title:=info.sys:12200/hac/clinical/frame/showMainFrame;controltype:=UIA_PaneControlTypeId;class:=Internet Explorer_Server", $treescope_children) _UIA_Action($oP8,"setfocus") Local $oP7=_UIA_getObjectByFindAll($oP8, "Title:=HAC;controltype:=UIA_PaneControlTypeId;class:=", $treescope_children) Local $oP6=_UIA_getObjectByFindAll($oP7, "Title:=info.sys:12200/hac/clinical/frame/showRootFrame;controltype:=UIA_CustomControlTypeId;class:=", $treescope_children) Local $oP5=_UIA_getObjectByFindAll($oP6, "Title:=Root Frame Page;controltype:=UIA_PaneControlTypeId;class:=", $treescope_children) Local $oP4=_UIA_getObjectByFindAll($oP5, "Title:=info.sys:12200/hac/clinical/workFlow/worklist/tabBarHandler/showFrameSet?activeTab=0;controltype:=UIA_CustomControlTypeId;class:=", $treescope_children) Local $oP3=_UIA_getObjectByFindAll($oP4, "Title:=;controltype:=UIA_PaneControlTypeId;class:=", $treescope_children) Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=info.sys:12200/hac/clinical/workFlow/worklist/showWorklist;controltype:=UIA_CustomControlTypeId;class:=", $treescope_children) Local $oP1=_UIA_getObjectByFindAll($oP2, "Title:=Worklist;controltype:=UIA_PaneControlTypeId;class:=", $treescope_children) Local $oP0=_UIA_getObjectByFindAll($oP1, "Title:=;controltype:=UIA_CustomControlTypeId;class:=", $treescope_children) ;~ First find the object in the parent before you can do something ;~$oUIElement=_UIA_getObjectByFindAll("Delete.mainwindow", "title:=Delete;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree) Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=Delete;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree) ConsoleWrite("Value: " & _UIA_action($oUIElement,"right") & @CRLF) #ce _UIA_SetVAR("HACWindow","Title:=[Horizon Ambulatory Care];controltype:=UIA_WindowControlTypeId;class:=WindowsForms10.Window.8.app4") _UIA_SetVAR("TaskListPane","Title:=Worklist;controltype:=UIA_PaneControlTypeId;class:=") _UIA_SetVAR("DeleteButton","title:=Delete;ControlType:=UIA_ButtonControlTypeId") ConsoleWrite("HAC? " & _UIA_Action("HACWindow","setfocus") & @CRLF) ConsoleWrite("Pane? " & _UIA_Action("TaskListPane","setfocus") & @CRLF) ConsoleWrite("Button? " & _UIA_Action("DeleteButton","highlight") & @CRLF)

 

Search image until there is no longer

$
0
0

HI, i start to learn autoit right now :D

I'm searching video tutorial online and it seems easy, but i have a problem. 

I'm using ImageSearch.au3 and it's ok, but i want to search the same image many time until it there is no longer..

Image:

 

8r0dCcM.jpg

 

 if I click the button "dona" and I give troops it hide. So, this is my source:

AutoIt         
#include <ImageSearch.au3> $x = 0 $y = 0 #Region simple search #cs $res = _imagesearch('dona.png',1,$x,$y,100) If $res = 1 Then     MouseMove($x,$y,100)     MouseClick("left") Else     MsgBox(0,'Info','richieste presenti') EndIf #ce #EndRegion #Region Search for more images with call waiting Dim $myPics[10] $myPics[0] = 2 $myPics[1] = 'dona.png' $myPics[2] = 'altre.png' $res = _WaitForImagesSearch($myPics,5,1,$x,$y,100) Switch $res     Case 0         MsgBox(0,'','nessuno trovato')      Case 1         For $i = 1 To 5 MsgBox(0,"Il Mio Primo Ciclo",$i) Next         MouseMove($x,$y,100) MouseClick("left") MouseClick("left")         ;MsgBox(0,'','donazione trovata')     Case 2         MouseMove($x,$y,100)         mouseclick("left")         MsgBox(0,'','richieste trovate') EndSwitch

The problem is when there are 2 or more image "DONA"

 

How can i search every same image?

Thanks and sorry for my english. :-)

Keyboard remapping? Sun kb on Win PC.

$
0
0

I have an nice old Sun Micro Systems N-107 keyboard and I would like to use it on my PC. I hooks up via the PS/2 plug and most keys work, it is just that some of the mapping is not correct for Windows.

Before I look into registry modification, Is it possible to remap using autoit? something like the hotkeys.au3 so that the keys that are missed matched can send the correct value?

I am not interested in keylogging or any of that stuff, just a way to use my cool old keyboard.

Problem creating a Countdown Timer with Button Inputs

$
0
0

I've been trying to wrap my brain around how I could set the timer the the time I want with buttons. Can anyone help me?

Thanks in advance!

AutoIt         
  1. #include <ButtonConstants.au3>
  2. #include <ComboConstants.au3>
  3. #include <GUIConstantsEx.au3>
  4. #include <StaticConstants.au3>
  5. #include <WindowsConstants.au3>
  6.  
  7. Global $_CompteArebour = 100000, $_Minutes, $_Seconds
  8. $TimeTicks = TimerInit()
  9. $teamOneScore = 0
  10. $teamTwoScore = 0
  11.  
  12. $Form1 = GUICreate("ImproTimer", 946, 535, -1, -1)
  13. $MenuItem1 = GUICtrlCreateMenu("?")
  14. $AboutMenuItem = GUICtrlCreateMenu("About" & @TAB & "Ctrl+A")
  15. $GroupTeam1 = GUICtrlCreateGroup("", 80, 32, 257, 225)
  16. $GraphicTeam1 = GUICtrlCreateGraphic(88, 48, 240, 200)
  17. $Team1Score = GUICtrlCreateLabel($teamOneScore, 160, 56, 98, 146, BitOR($SS_CENTER, $SS_CENTERIMAGE))
  18. GUICtrlSetFont($teamOneScore, 120, 400, 0, "MS Sans Serif")
  19. GUICtrlCreateGroup("", -99, -99, 1, 1)
  20. $ComboTeam1 = GUICtrlCreateCombo("Couleur", 8, 40, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
  21. GUICtrlSetData(-1, "Blanc|Bleu|Rouge|Orange|Jaune|Vert")
  22. $GroupTeam2 = GUICtrlCreateGroup("", 608, 32, 257, 225)
  23. $GraphicTeam2 = GUICtrlCreateGraphic(616, 48, 240, 200)
  24. $Team2Score = GUICtrlCreateLabel($teamTwoScore, 664, 56, 152, 146, BitOR($SS_CENTER, $SS_CENTERIMAGE))
  25. GUICtrlSetFont($teamTwoScore, 120, 400, 0, "MS Sans Serif")
  26. GUICtrlCreateGroup("", -99, -99, 1, 1)
  27. $ComboTeam2 = GUICtrlCreateCombo("Couleur", 872, 40, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
  28. GUICtrlSetData(-1, "Blanc|Bleu|Rouge|Orange|Jaune|Vert")
  29. $TimerLabel = GUICtrlCreateLabel("", 352, 40, 247, 125, BitOR($SS_CENTER, $SS_CENTERIMAGE))
  30. ;~ $Graphic1 = GUICtrlCreateGraphic( 352, 72, 247, 115)
  31. ;~ GUICtrlSetBkColor($Graphic1, 0x0033CC)
  32. GUICtrlSetData($TimerLabel, StringFormat("%02u" & ":" & "%02u", $_Minutes, $_Seconds))
  33. GUICtrlSetFont($TimerLabel, 72, 400, 0, "MS Sans Serif")
  34. $BtnStart = GUICtrlCreateButton("Start", 352, 168, 121, 33)
  35. $BtnPause = GUICtrlCreateButton("Pause", 352, 168, 121, 33)
  36. GUICtrlSetState(-1, $GUI_HIDE)
  37. $BtnReset = GUICtrlCreateButton("Reset", 480, 168, 121, 33)
  38. $BtnAdd60 = GUICtrlCreateButton("+1 Min", 352, 208, 57, 33)
  39. $BtnAdd30 = GUICtrlCreateButton("+30 Sec", 416, 208, 57, 33)
  40. $BtnAdd10 = GUICtrlCreateButton("+10 Sec", 480, 208, 57, 33)
  41. $BtnAdd5 = GUICtrlCreateButton("+5 Sec", 544, 208, 57, 33)
  42. $PPT1 = GUICtrlCreateButton("+ 1", 8, 104, 65, 33)
  43. $MPT1 = GUICtrlCreateButton("- 1", 8, 160, 65, 33)
  44. $PPT2 = GUICtrlCreateButton("+ 1", 872, 104, 65, 33)
  45. $MPT2 = GUICtrlCreateButton("- 1", 872, 160, 65, 33)
  46. #EndRegion ### END Koda GUI section ###
  47.  
  48.     $nMsg = GUIGetMsg()
  49.     Switch $nMsg
  50.         Case $BtnStart
  51.             GUICtrlSetState($BtnStart, $GUI_HIDE)
  52.             GUICtrlSetState($BtnPause, $GUI_SHOW)
  53.             _Run()
  54.         Case $ComboTeam1
  55.             $sComboRead = ""
  56.             $sComboRead = GUICtrlRead($ComboTeam1)
  57.             If $sComboRead = "Blanc" Then
  58.                 GUICtrlSetBkColor($GraphicTeam1, 0xFFFFFF)
  59.             ElseIf $sComboRead = "Bleu" Then
  60.                 GUICtrlSetBkColor($GraphicTeam1, 0x0033CC)
  61.             ElseIf $sComboRead = "Rouge" Then
  62.                 GUICtrlSetBkColor($GraphicTeam1, 0xFF3030)
  63.             ElseIf $sComboRead = "Orange" Then
  64.                 GUICtrlSetBkColor($GraphicTeam1, 0xFF6600)
  65.             ElseIf $sComboRead = "Jaune" Then
  66.                 GUICtrlSetBkColor($GraphicTeam1, 0xFFFF33)
  67.             ElseIf $sComboRead = "Vert" Then
  68.                 GUICtrlSetBkColor($GraphicTeam1, 0x009933)
  69.             EndIf
  70.         Case $ComboTeam2
  71.             $sComboRead = ""
  72.             $sComboRead = GUICtrlRead($ComboTeam2)
  73.             If $sComboRead = "Blanc" Then
  74.                 GUICtrlSetBkColor($GraphicTeam2, 0xFFFFFF)
  75.             ElseIf $sComboRead = "Bleu" Then
  76.                 GUICtrlSetBkColor($GraphicTeam2, 0x0033CC)
  77.             ElseIf $sComboRead = "Rouge" Then
  78.                 GUICtrlSetBkColor($GraphicTeam2, 0xFF3030)
  79.             ElseIf $sComboRead = "Orange" Then
  80.                 GUICtrlSetBkColor($GraphicTeam2, 0xFF6600)
  81.             ElseIf $sComboRead = "Jaune" Then
  82.                 GUICtrlSetBkColor($GraphicTeam2, 0xFFFF33)
  83.             ElseIf $sComboRead = "Vert" Then
  84.                 GUICtrlSetBkColor($GraphicTeam2, 0x009933)
  85.             EndIf
  86.         Case $BtnAdd60
  87.             $_CompteArebour = $_CompteArebour + 100000
  88.         Case $BtnAdd30
  89.             $_CompteArebour = $_CompteArebour + 30000
  90.         Case $BtnAdd10
  91.             $_CompteArebour = $_CompteArebour + 10000
  92.         Case $BtnAdd5
  93.             $_CompteArebour = $_CompteArebour + 5000
  94.         Case $BtnReset
  95. ;~          $_CompteArebour = 0
  96.         Case $AboutMenuItem
  97.         Case $PPT1
  98.             $teamOneScore = $teamOneScore + 1
  99.             $Team1Score = GUICtrlCreateLabel($teamOneScore, 160, 56, 98, 146, BitOR($SS_CENTER, $SS_CENTERIMAGE))
  100.         Case $MPT1
  101.             $teamOneScore = $teamOneScore - 1
  102.             $Team1Score = GUICtrlCreateLabel($teamOneScore, 160, 56, 98, 146, BitOR($SS_CENTER, $SS_CENTERIMAGE))
  103.         Case $GUI_EVENT_CLOSE
  104.             Exit
  105.     EndSwitch
  106.  
  107.  
  108. Func _Run()
  109.     While 1
  110.         _Check()
  111.     WEnd
  112. EndFunc   ;==>_Run
  113.  
  114. Func _Check()
  115.     $nMsg = GUIGetMsg()
  116.     Switch $nMsg
  117.         Case $GUI_EVENT_CLOSE
  118.             Exit
  119.         Case $BtnStart
  120.             GUICtrlSetState($BtnStart, $GUI_HIDE)
  121.             GUICtrlSetState($BtnPause, $GUI_SHOW)
  122.             _Run()
  123.         Case $BtnPause
  124.             GUICtrlSetState($BtnPause, $GUI_HIDE)
  125.             GUICtrlSetState($BtnStart, $GUI_SHOW)
  126.         Case $BtnReset
  127. ;~          $_CompteArebour = 0
  128.         Case $BtnAdd60
  129.             $_CompteArebour = $_CompteArebour + 60000
  130.         Case $BtnAdd30
  131.             $_CompteArebour = $_CompteArebour + 30000
  132.         Case $BtnAdd10
  133.             $_CompteArebour = $_CompteArebour + 10000
  134.         Case $BtnAdd5
  135.             $_CompteArebour = $_CompteArebour + 5000
  136.     EndSwitch
  137.  
  138.     Local $_MinCalc = Int($_CompteArebour / (60 * 1000)), $_SecCalc = $_CompteArebour - ($_MinCalc * 60 * 1000)
  139.     $_SecCalc = Int($_SecCalc / 1000)
  140.  
  141.     $_CompteArebour -= TimerDiff($TimeTicks)
  142.     $TimeTicks = TimerInit()
  143.     Local $_MinCalc = Int($_CompteArebour / (60 * 1000)), $_SecCalc = $_CompteArebour - ($_MinCalc * 60 * 1000)
  144.     $_SecCalc = Int($_SecCalc / 1000)
  145.     If $_MinCalc <= 0 And $_SecCalc <= 0 Then
  146.         GUISetBkColor(0xFF0000, $Form1)
  147.         GUICtrlSetData($TimerLabel, "Fini!")
  148.         Sleep(1000)
  149.         GUICtrlSetData($TimerLabel, StringFormat("%02u" & ":" & "%02u", $_Minutes, $_Seconds))
  150.         ; If @Compiled Then Shutdown ( 13 )
  151.     Else
  152.         If $_MinCalc <> $_Minutes Or $_SecCalc <> $_Seconds Then
  153.             $_Minutes = $_MinCalc
  154.             $_Seconds = $_SecCalc
  155.             GUICtrlSetData($TimerLabel, StringFormat("%02u" & ":" & "%02u", $_Minutes, $_Seconds))
  156.             If $_Minutes = 0 And $_Seconds <= 10 Then
  157.                 Beep(1200, 100)
  158.                 GUISetBkColor(0xA093FF, $Form1)
  159.             EndIf
  160.         EndIf
  161.     EndIf
  162. EndFunc   ;==>_Check

Need to extract code from compiled; old script (2009)

$
0
0

I know the current version no longer has this but I'm looking for the older version.

 

I have a working EXE so I guess it's not all bad.  I'd like to make some minor changes to the GUI as my needs have changed.  I remember we used to be able to pull the code out of a compiled EXE with a tool that was included in the older versions of AutoIT.  Any chance someone has that tool around anymore or even an old AutoIT installer file?  It would save me a ton of time.

 

TIA

What replaced _StringAddThousandsSep()?

$
0
0

...or was it dropped entirely?

 

TIA

MTP protocol...anyone looking into this anymore?

$
0
0

Looking to be able to do file transfers and interactions via the MTP protocol that is now supported by most current Android smartphones.

 

Really no info on this beyond 1 or 2 queries here that seemed to die out last year.

 

Anyone have any info on how to address this?

 

TIA

how to i print on both sides Word file?

$
0
0

i used word.au3 udf but can't print on both sides with command _Word_DocPrint

any one know how to do that? thanks

Sending {ENTER} with _GUICtrlListView_SetItem ?

$
0
0

Hello,

 

My quetion stems from this thread: http://www.autoitscript.com/forum/topic/167935-script-sometimes-skipping-keystrokes-jumping-to-wrong-cells/

 

So, I have finally been able to get _GUICtrlListView_SetItem to work, setting values to cell I need it to. However, the application that Im setting the values to requires that after I set the values, I need to press ENTER or TAB. If I dont do that, it will automatically revert back to the old values after a few seconds.

 

I can not use _GUICtrlListView_SetItem and put {ENTER}, as it will litelly send the string to the cell and not simulate pressing the enter key. I have tried using ASCII chars aswell, but no go.

 

Furthermore, Ive tried _IsPressed() but that doesnt work because no keys actually get pressed with the SetItem method.

 

Screenshot of my application that I need to set values in:

 

Screen_Vplus_Auto_IT.jpg

 

I need to set the values in cells row 1, index 1 and index 2

and in row 2, index 1 and index 2

 

My code:

AutoIt         
#include <GuiListView.au3> #include <Misc.au3> ;--------------------------------------- ; Define Variables ;--------------------------------------- $windowTitle = "VTable 8.04 (COM3 [115200]) - [1: -  603 206 000 ; 12087363]" $windowControlID = "[CLASS:SysListView32; INSTANCE:6]" $hWin = WinGetHandle($windowTitle) $hControl = ControlGetHandle($hWin,"",$windowControlID) ;-------------------------------------- ; Start Script ;-------------------------------------- ;-------------------------------------- ; Index 1 ;-------------------------------------- ;Target Position value Index 1 in Vtable $iRowToEdit = 0 $iSubItemToEdit = 2 _GUICtrlListView_SetItem($hControl,"17777777",$iRowToEdit,$iSubItemToEdit) ;Target Speed value Index 1 in Vtable $iRowToEdit = 1 $iSubItemToEdit = 2 _GUICtrlListView_SetItem($hControl,"1638400",$iRowToEdit,$iSubItemToEdit) ;-------------------------------------- ; Index 2 ;-------------------------------------- ;Target position value Index 2 in Vtable $iRowToEdit = 0 $iSubItemToEdit = 3 _GUICtrlListView_SetItem($hControl,"100002",$iRowToEdit,$iSubItemToEdit) ;Target Speed value Index 2 in Vtable $iRowToEdit = 1 $iSubItemToEdit = 3 _GUICtrlListView_SetItem($hControl,"1638400",$iRowToEdit,$iSubItemToEdit)

Really hope anyone can help, its the last piece of this puzzle that Ive been struggling with for days now

Viewing all 12506 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>