Create TowerDefense.au3

Create TowerDefense.au3

;~ http://soundbible.com/tags-ping.html

; #INDEX# =======================================================================================================================
; Title .........: ALL2D
; AutoIt Version : 3.3.12.0
; Description ...: Gera um mapa em GDI a partir de um arquivo JSON criado pelo 'Tile Map Editor'
;                  Generate a GDI map from a JSON file created by 'Tile Map Editor'
; Author(s) .....: Luismar Chechelaky

; https://github.com/chechelaky/AutoIt/tree/master/GameStudy

; https://youtu.be/qo8Xt80bpXk

; use Tiled Map Editor to build a map
; http://www.mapeditor.org/

; ===============================================================================================================================

#include-once
#include <Array.au3>
#include <ScreenCapture.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <APIMiscConstants.au3>
#include <WinAPIMisc.au3>
#include <JSMN.au3>
#include <object_dump.au3>
#include <Sound\Bass.au3>
#include <Sound\BassConstants.au3>

OnAutoItExitRegister("OnExit")

_BASS_STARTUP(@ScriptDir & "\sound\bass.dll")
_BASS_Init(0, -1, 44100, 0, "")

Global Const $tagSound = "Struct;ptr handle;EndStruct"
Global Const $tagWeapon = "Struct;int image_id;int xx;int yy;int speed;int range;int delay;int sound;EndStruct"
Global Const $tagImage = "Struct;ptr handle;int width;int height;EndStruct"

Global $iAngle = 0
Global Const $PI = 3.14159265359
Global Const $PI2 = $PI / 2
Global $fDegToRad = $PI / 180
Global Const $DegToRad = $PI / 180
Global Const $rad90 = $PI / 2
Global Const $rad270 = 3 * $PI / 2

Global $aTemp

Global $oShot = ObjCreate($SD), $aDel[1] = [0], $aDel2[1] = [0], $iShot = 0
Global $oUnity = ObjCreate($SD), $iUnit = 0
Global $oImage = ObjCreate($SD)

Global $aSound[1]
Global $aWeapon[1]

Opt("GUIOnEventMode", 1)

Global Enum $WIDT1 = 0, $HEIG1, $DIAG1, $DIAG2, $POSX1, $POSY1, $WIDT2, $HEIG2, $POSX2, $POSY2, $SCAN0, $GRCTX, $MTRIX, $POSX3, $POSY3, $SPEED, $RANG1, $RANG2, $DELAY, $MMENT, $SOUND
Global $aGui[10] = [800, 600]
Global $hGraphic, $hBitmap, $hBackbuffer, $hMatrix
Global $Z_RUN[3] = [TimerInit(), TimerInit(), 0]

Global $aActor[8] = [400, 300, 32, 0.6]
$aActor[4] = $aActor[2] / 2
$aActor[0] = $aActor[0] - $aActor[4]
$aActor[1] = $aActor[1] - $aActor[4]
$aActor[5] = GradToRad(6)
$aActor[6] = 0
$aActor[7] = GradToRad(3)

$hGui = GUICreate("Rotate", $aGui[0], $aGui[1], -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
GUISetState()

Global $aPos[20] = [150, 50]
Global $a_hImage[1], $a_aiDim[1]

_GDIPlus_Startup()

$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($aGui[0], $aGui[1], $hGraphic)
$hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2)

Global $hShot = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\images\shot.png")

Global $tSound1 = Add_Sound(@ScriptDir & "\sound\shot00.wav")
Global $tSound2 = Add_Sound(@ScriptDir & "\sound\shot01.wav")
Global $tSound3 = Add_Sound(@ScriptDir & "\sound\shot02.wav")
Global $tSound4 = Add_Sound(@ScriptDir & "\sound\impacto.wav")
ConsoleWrite("$tSound4[" & $tSound4 & "]" & @LF)

Global $img1 = Image_Create("vermelho.png", 100, 100, 4, 300, 800, 1)
Global $img2 = Image_Create("azul.png", 300, 100, 5.5, 300, 850, 2)
Global $img3 = Image_Create("amarelo.png", 500, 100, 6, 330, 600, 3)
Global $img4 = Image_Create("verde.png", 100, 300, 7, 250, 700, 3)
Global $img5 = Image_Create("vermelho2.png", 300, 300, 8, 300, 1000, 2)
Global $img6 = Image_Create("preto.png", 500, 300, 9, 400, 500, 1)
Global $img7 = Image_Create("azul.png", 300, 500, 30, 550, 600, 2)

Add_Unit(0, 200, 800, 200, 1, 1, 500, Image_Add("exemplo.png"))
;~ Add_Unit(200, 0, 150, 800, 4, 1, 700, Image_Add("carro_azul.png"))
;~ Add_Unit(250, 0, 100, 800, 8, 2, 900, Image_Add("carro_preto.png"))

Global $aPontos = MAPA("mapa4.json")
$oUnity.Item(1).Item("x") = $aPontos[1][0]
$oUnity.Item(1).Item("y") = $aPontos[1][1]

Func MAPA($sFile)
	Local $oMap = json_load($sFile)
	Local $OBJ = $oMap.Item("layers")[0]
	Local $xx = ($OBJ.Item("objects"))[0].Item("x")
	Local $yy = ($OBJ.Item("objects"))[0].Item("y")
	Local $aPolyline = ($OBJ.Item("objects"))[0].Item("polyline")
	Local $arr[1][2] = [[UBound($aPolyline, 1) - 1, 2]]
	For $ii = 0 To $arr[0][0]
		_ArrayAdd2D($arr, $xx + ($aPolyline[$ii]).Item("x"), $yy + ($aPolyline[$ii]).Item("y"))
	Next
	Return $arr
EndFunc   ;==>MAPA

Func Image_Add($sName)
	Local $ds = DllStructCreate($tagImage)
	$ds.handle = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\images\" & $sName)
	$ds.width = _GDIPlus_ImageGetWidth($ds.handle)
	$ds.height = _GDIPlus_ImageGetHeight($ds.handle)
	Local $id = _ArrayAdd($aWeapon, $ds)

	Local $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\images\" & $sName)
	$oImage.Add($oImage.Count + 1, $hImage)
	Return $oImage.Count
EndFunc   ;==>Image_Add

Func Add_Unit($x1, $y1, $x2, $y2, $iSpeed, $iFOE, $iHP, $hImage)
	$iUnit += 1
	Local $oo = ObjCreate($SD)
	$oo.Add("x", $x1)
	$oo.Add("y", $y1)
	$oo.Add("s", $iSpeed)
	$oo.Add("f", $iFOE)
	$oo.Add("h", $iHP)
	$oo.Add("i", $hImage)
	$oUnity.Add($iUnit, $oo)
	Return $iUnit
EndFunc   ;==>Add_Unit

Func Add_Sound($sFile)
	Local $ds = DllStructCreate($tagSound)
	$ds.handle = _BASS_StreamCreateFile(False, $sFile, 0, 0, 0)
	Local $id = _ArrayAdd($aSound, $ds)
	$aSound[0] = UBound($aSound, 1) - 1
	Return $id
EndFunc   ;==>Add_Sound

Func Image_Create($sName, $xx = 0, $yy = 0, $iSpeed = 4, $iRange = 50, $iDelay = 100, $tSound = 0)
	Local $ds = DllStructCreate($tagWeapon)
	Local $id = _ArrayAdd($a_hImage, _GDIPlus_ImageLoadFromFile(@ScriptDir & "\images\" & $sName))
	Local $arr[22]

	$arr[$WIDT1] = _GDIPlus_ImageGetWidth($a_hImage[$id])
	$arr[$HEIG1] = _GDIPlus_ImageGetHeight($a_hImage[$id])
	$arr[$DIAG1] = _diagonal($arr[0], $arr[1])
	$arr[$DIAG2] = $arr[$DIAG1] / 2
	$arr[$POSX1] = $xx
	$arr[$POSY1] = $yy
	$arr[$WIDT2] = $arr[$WIDT1] / 2
	$arr[$HEIG2] = $arr[$HEIG1] / 2
	$arr[$POSX2] = $xx - $arr[$DIAG2]
	$arr[$POSY2] = $yy - $arr[$DIAG2]
	$arr[$SCAN0] = _GDIPlus_BitmapCreateFromScan0($arr[$DIAG1], $arr[$DIAG1])
	$arr[$GRCTX] = _GDIPlus_ImageGetGraphicsContext($arr[$SCAN0])
	$arr[$MTRIX] = _GDIPlus_MatrixCreate()
	$arr[$POSX3] = $xx - $iRange / 2
	$arr[$POSY3] = $yy - $iRange / 2

	$arr[$SPEED] = $iSpeed
	$arr[$RANG1] = $iRange
	$arr[$RANG2] = $iRange / 2
	$arr[$DELAY] = $iDelay
	$arr[$MMENT] = 0
	$arr[$SOUND] = $tSound
	_GDIPlus_MatrixTranslate($arr[$MTRIX], $arr[$DIAG2], $arr[$DIAG2])

	_ArrayAdd($a_aiDim, $arr, 0, "|", @CRLF, 1)
	$a_hImage[0] = UBound($a_hImage, 1) - 1

	Local $id = _ArrayAdd($aWeapon, $ds)
	$aWeapon[0] = UBound($aWeapon, 1) - 1

	Return $id
EndFunc   ;==>Image_Create

Func Image_Show()
	For $ii = 1 To $a_hImage[0]
		$iAngle = Radian2Degree(atan2($oUnity.Item(1).Item("x") - ($a_aiDim[$ii])[$POSX1], $oUnity.Item(1).Item("y") - ($a_aiDim[$ii])[$POSY1])) + 90
		_GDIPlus_GraphicsClear(($a_aiDim[$ii])[$GRCTX], 0xFFFFFFFF)

		_GDIPlus_MatrixRotate(($a_aiDim[$ii])[$MTRIX], $iAngle)
		_GDIPlus_GraphicsSetTransform(($a_aiDim[$ii])[$GRCTX], ($a_aiDim[$ii])[$MTRIX])
		_GDIPlus_MatrixRotate(($a_aiDim[$ii])[$MTRIX], -$iAngle)

		_GDIPlus_GraphicsDrawImageRectRect(($a_aiDim[$ii])[$GRCTX], $a_hImage[$ii], 0, 0, ($a_aiDim[$ii])[$WIDT1], ($a_aiDim[$ii])[$HEIG1], -($a_aiDim[$ii])[$WIDT2], -($a_aiDim[$ii])[$HEIG2], ($a_aiDim[$ii])[$WIDT1], ($a_aiDim[$ii])[$HEIG1])

		_GDIPlus_GraphicsDrawImageRectRect($hBackbuffer, ($a_aiDim[$ii])[$SCAN0], 0, 0, ($a_aiDim[$ii])[$DIAG1], ($a_aiDim[$ii])[$DIAG1], ($a_aiDim[$ii])[$POSX2], ($a_aiDim[$ii])[$POSY2], ($a_aiDim[$ii])[$DIAG1], ($a_aiDim[$ii])[$DIAG1])

		If Sqrt((($a_aiDim[$ii])[$POSX1] - $oUnity.Item(1).Item("x")) ^ 2 + (($a_aiDim[$ii])[$POSY1] - $oUnity.Item(1).Item("y")) ^ 2) <= ($a_aiDim[$ii])[$RANG2] Then
			_GDIPlus_GraphicsDrawArc($hBackbuffer, ($a_aiDim[$ii])[$POSX3], ($a_aiDim[$ii])[$POSY3], ($a_aiDim[$ii])[$RANG1], ($a_aiDim[$ii])[$RANG1], 0, 360)
			If TimerDiff((($a_aiDim[$ii])[$MMENT])) > ($a_aiDim[$ii])[$DELAY] Then
				$aTemp = $a_aiDim[$ii]
				$aTemp[$MMENT] = TimerInit()
				$a_aiDim[$ii] = $aTemp
				Add_Shot(($a_aiDim[$ii])[$POSX1], ($a_aiDim[$ii])[$POSY1], ($a_aiDim[$ii])[$DIAG2], ($a_aiDim[$ii])[$SPEED], $iAngle - 90, ($a_aiDim[$ii])[$SOUND])
			EndIf
		EndIf
	Next
EndFunc   ;==>Image_Show

Func Add_Shot($xx, $yy, $iRaio, $iSpeed, $iAngle, $iSound)
	$iShot += 1
	Local $oo = ObjCreate($SD)
	$oo.Add("x", $xx)
	$oo.Add("y", $yy)
	$oo.Add("vx", $iSpeed * Cos($iAngle * $fDegToRad))
	$oo.Add("vy", $iSpeed * Sin($iAngle * $fDegToRad))
	$oo.Add("r", $iRaio)
	$oo.Add("s", $iSpeed)
	$oo.Add("a", $iAngle)
	$oShot.Add($iShot, $oo)
	_BASS_ChannelPlay($aSound[$iSound].handle, 1)
EndFunc   ;==>Add_Shot

Func AcertouAlvo($xx, $yy)
	Local $limite = 33
	If $xx >= $oUnity.Item(1).Item("x") And $xx <= ($oUnity.Item(1).Item("x") + $limite) And $yy >= $oUnity.Item(1).Item("y") And $yy <= ($oUnity.Item(1).Item("y") + $limite) Then
		_box($hBackbuffer, $oUnity.Item(1).Item("x"), $oUnity.Item(1).Item("y"), $limite + 1, $limite + 1)
		_BASS_ChannelPlay($aSound[4].handle, 1)
		Return True
	EndIf
	Return False
EndFunc   ;==>AcertouAlvo

Func Image_Shot()
	For $each In $oShot
		$oShot.Item($each).Item("x") += $oShot.Item($each).Item("vx")
		If $oShot.Item($each).Item("x") < -9 Or $oShot.Item($each).Item("x") > 809 Then
			_ArrayAdd($aDel, $each)
		Else
			$oShot.Item($each).Item("y") += $oShot.Item($each).Item("vy")

			If $oShot.Item($each).Item("y") < -9 Or $oShot.Item($each).Item("y") > 609 Or AcertouAlvo($oShot.Item($each).Item("x"), $oShot.Item($each).Item("y")) Then
				_ArrayAdd($aDel, $each)
			Else
				_GDIPlus_GraphicsDrawImageRectRect($hBackbuffer, $hShot, 0, 0, 9, 9, $oShot.Item($each).Item("x") - 4, $oShot.Item($each).Item("y") - 4, 9, 9)
			EndIf
		EndIf
	Next
	$aDel[0] = UBound($aDel, 1)
	If $aDel[0] Then
		For $ii = 1 To $aDel[0] - 1
			$oShot.Remove($aDel[$ii])
		Next
		$aDel = $aDel2
	EndIf
EndFunc   ;==>Image_Shot

Func Image_Unit()
	For $each In $oUnity
		$iAngulo = Angulo($oUnity.Item($each).Item("x"), $oUnity.Item($each).Item("y"), $aPontos[$aPontos[0][1]][0], $aPontos[$aPontos[0][1]][1])
		If $iAngulo[1] < 8 Then
			$aPontos[0][1] += 1
			If $aPontos[0][1] >= $aPontos[0][0] Then $aPontos[0][1] = 1
		EndIf
		$oUnity.Item($each).Item("x") += $oUnity.Item($each).Item("s") * Cos($iAngulo[3])
		$oUnity.Item($each).Item("y") += $oUnity.Item($each).Item("s") * Sin($iAngulo[3])
		_GDIPlus_GraphicsDrawImageRectRect($hBackbuffer, $oImage.Item($oUnity.Item($each).Item("i")), 0, 0, 33, 33, $oUnity.Item($each).Item("x"), $oUnity.Item($each).Item("y"), 33, 33)
	Next
EndFunc   ;==>Image_Unit

While Z_RUN()
	_GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFF)
	Image_Show()
	Image_Shot()
	Image_Unit()
	_GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 0)
WEnd

Func Z_RUN()
	$Z_RUN[2] += 1
	If TimerDiff($Z_RUN[1]) > 999 Then
		WinSetTitle($hGui, "", "FPS[" & $Z_RUN[2] & "]" & @LF)
		$Z_RUN[1] = TimerInit()
		$Z_RUN[2] = 0
	EndIf
	Return True
EndFunc   ;==>Z_RUN

Func _Exit()
	For $ii = 1 To UBound($a_hImage, 1) - 1
		_GDIPlus_ImageDispose($a_hImage[$ii])
		_GDIPlus_BitmapDispose(($a_aiDim[$ii])[$SCAN0])
		_GDIPlus_MatrixDispose(($a_aiDim[$ii])[$MTRIX])
		_GDIPlus_GraphicsDispose(($a_aiDim[$ii])[$GRCTX])
	Next
	For $each In $oImage
		_GDIPlus_ImageDispose($oImage.Item($each))
	Next
	_GDIPlus_ImageDispose($hShot)
	_GDIPlus_GraphicsDispose($hGraphic)
	_GDIPlus_GraphicsDispose($hBackbuffer)
	_GDIPlus_BitmapDispose($hBitmap)
	_GDIPlus_Shutdown()
	GUIDelete()
	Exit
EndFunc   ;==>_Exit

Func _diagonal($CO, $CA)
	Return Sqrt($CO ^ 2 + $CA ^ 2)
EndFunc   ;==>_diagonal

Func Radian2Degree($iRadian)
	Return 180 * $iRadian / ACos(-1)
EndFunc   ;==>Radian2Degree

Func atan2($xx, $yy)
	Local $absx = 0, $absy = 0, $val = 0
	If Not $xx And Not $yy Then Return 0
	$absy = Abs($yy)
	$absx = Abs($xx)
	If ($absy - $absx = $absy) Then
		If $yy < 0 Then Return -$PI2
		Return $PI2
	EndIf
	If ($absx - $absy = $absx) Then
		$val = 0
	Else
		$val = ATan($yy / $xx)
	EndIf
	If ($xx > 0) Then Return $val
	If ($yy < 0) Then Return $val - $PI
	Return $val + $PI
EndFunc   ;==>atan2

Func OnExit()
	_BASS_Free()
EndFunc   ;==>OnExit

Func _box($hToGraphic, $iXX, $iYY, $iWW, $iHH, $iColor = 0)
	; _box3
	If $iWW = 1 And $iHH = 1 Then
		If $iColor Then
;~ 			_GDIPlus_BrushSetSolidColor($hBrush, $iColor)
;~ 			_GDIPlus_GraphicsFillRect($hBackbuffer, $iXX, $iYY, $iWW, $iHH, $hBrush)
		Else
			_GDIPlus_GraphicsFillRect($hBackbuffer, $iXX, $iYY, $iWW, $iHH)
		EndIf
	Else
		Local $aBox[5][2]
		$aBox[0][0] = 4
		$aBox[1][0] = $iXX
		$aBox[1][1] = $iYY
		$aBox[2][0] = $iXX + $iWW - 1
		$aBox[2][1] = $iYY
		$aBox[3][0] = $iXX + $iWW - 1
		$aBox[3][1] = $iYY + $iHH - 1
		$aBox[4][0] = $iXX
		$aBox[4][1] = $iYY + $iHH - 1
		If $iColor Then
;~ 			_GDIPlus_PenSetColor($hPen, $iColor)
			_GDIPlus_GraphicsDrawPolygon($hToGraphic, $aBox)
		Else
			_GDIPlus_GraphicsDrawPolygon($hToGraphic, $aBox)
		EndIf
	EndIf
EndFunc   ;==>_box

Func Angulo($xx1, $yy1, $xx2, $yy2, $ang = 0)
	Local $arr[6], $CA = Abs($yy1 - $yy2), $CO = Abs($xx1 - $xx2)
	Select
		Case $xx1 > $xx2
			Select
				Case $yy1 < $yy2
					$arr[2] = 6
					$arr[0] = $rad270 - ATan(($CO) / ($CA))
					$arr[3] = ATan(($CO) / ($CA)) + $rad90
				Case $yy1 == $yy2
					$arr[2] = 5
					$arr[0] = $PI
					$arr[3] = $PI
				Case $yy1 > $yy2
					$arr[2] = 4
					$arr[0] = ATan(($CO) / ($CA)) + $rad90
					$arr[3] = $rad270 - ATan(($CO) / ($CA))
			EndSelect
		Case $xx1 == $xx2
			Select
				Case $yy1 < $yy2
					$arr[2] = 7
					$arr[0] = $rad270
				Case $yy1 == $yy2
					$arr[2] = 9
					$arr[0] = 0
				Case $yy1 > $yy2
					$arr[2] = 3
					$arr[0] = $rad90
			EndSelect
		Case $xx1 < $xx2
			Select
				Case $yy1 < $yy2
					$arr[2] = 8
					$arr[0] = ATan(($CO) / ($CA)) + $rad270
					$arr[3] = $rad90 - ATan(($CO) / ($CA))
				Case $yy1 == $yy2
					$arr[2] = 1
					$arr[0] = 0
				Case $yy1 > $yy2
					$arr[2] = 2
					$arr[0] = $rad90 - ATan(($CO) / ($CA))
					$arr[3] = ATan(($CO) / ($CA)) - $rad90
			EndSelect
	EndSelect

	$arr[0] = StringFormat('%.2f', $arr[0])
	$arr[1] = Sqrt($CO ^ 2 + $CA ^ 2)
	Return $arr
EndFunc   ;==>Angulo

Func GradToRad($iGraus)
	Return $iGraus * $DegToRad
EndFunc   ;==>GradToRad

Func _ArrayAdd2D(ByRef $aInput, $mOpt1 = Default, $mOpt2 = Default, $mOpt3 = Default, $mOpt4 = Default, $mOpt5 = Default, $mOpt6 = Default, $mOpt7 = Default, $mOpt8 = Default, $mOpt9 = Default, $mOpt10 = Default)
	$aInput[0][0] = UBound($aInput, 1)
	ReDim $aInput[$aInput[0][0] + 1][UBound($aInput, 2)]
	Local $iCol = @NumParams - 1 < UBound($aInput, 2) ? @NumParams - 1 : UBound($aInput, 2)
	For $ii = 1 To $iCol
		$aInput[$aInput[0][0]][$ii - 1] = Execute("$mOpt" & $ii)
	Next
	Return $aInput[0][0]
EndFunc   ;==>_ArrayAdd2D

;~ "C:\Program Files (x86)\AutoIt3\AutoIt3.exe" "C:\Dropbox\ALL2D\ALL2D.au3" load %mapfile

error: pathspec 'GameStudy/TowerDefense.au3' did not match any file(s) known to git


Made compatible with 2.6 Python.

Made compatible with 2.6 Python.

;;  Copyright 2008 Nokia Siemens Networks Oyj
;;
;;  Licensed under the Apache License, Version 2.0 (the "License");
;;  you may not use this file except in compliance with the License.
;;  You may obtain a copy of the License at
;;
;;      http://www.apache.org/licenses/LICENSE-2.0
;;
;;  Unless required by applicable law or agreed to in writing, software
;;  distributed under the License is distributed on an "AS IS" BASIS,
;;  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;;  See the License for the specific language governing permissions and
;;  limitations under the License.

;; Robot Framework One Click Installer for Windows
;;
;; This installer installs Robot Framework and its preconditions Python and
;; Jython (optional). If installer is executed without arguments, it opens a
;; dialog explaining the options and asking the user to enter the installation
;; directory. If a command line options is given, it must be a path to an
;; existing directory and it is used as installation directory.
;;
;; For more information about this script see $USAGE below. To learn more
;; about silent Python installation, see url [1]. Silent Jython installation
;; options can be seen with command [2].
;;
;; [1] http://www.python.org/download/releases/2.5/msi/#automated
;; [2] java -jar jython_installer-2.2.x.jar --help

;;
;; Config
;;

; Expected patterns for installer names and target directory names.
$PYTHON_DIR_NAME = "Python"
$JYTHON_DIR_NAME = "Jython"
$PYTHON_PATTERN = "python-2.*.msi"
$ROBOT_PATTERN = "robotframework-2.*.exe"
$JYTHON_PATTERN = "jython_installer-2.*.jar"

; Usage to show to the user. If major versions of installed software are changed update them also here!!
; Patterns and directory names above are used in the usage so that they don't need to be updated.
$USAGE = "One Click Installer installs Robot Framework and its preconditions Python and Jython (optional). " & _
         "It also sets Robot Framework start-up scripts (pybot, jybot, rebot) as well as Python and Jython executables " & _
         "into %PATH% environment variable so that they can be executed from the command line. (Note that " & _
         "you need to restart the command prompt for these changes to take effect.)" & @CRLF & @CRLF & _
         "You should use this installer ONLY if you don't previously have Python or Jython installed. " & _
         "In that case, and also if you want to have a custom installation, you need to install needed " & _
         "components separately." & @CRLF & @CRLF & _
         "One Click Installer requires that you have all the required component installers in the same directory " & _
         "with it and that they have expected names. If Robot Framework or Python installer is missing, " & _
         "installation fails. If Jython installer doesn't exist, Jython is simply not installed. Note that " & _
         "in order to install Jython, Java 1.4 or newer must be already installed. Supported " & _
         "versions are Robot Framework 2.x, Python 2.5.x and Jython 2.2.x where '.x' means that any minor version " & _
         "(e.g. 2.5 or 2.5.2) is OK. These installers can be downloaded from respective project websites if " & _
         "they are missing. Expected patterns for installer names are '" & $ROBOT_PATTERN & "', '" & _
         $PYTHON_PATTERN & "' and '" & $JYTHON_PATTERN & "'." & @CRLF & @CRLF & _
         "The only thing you need to specify is the base directory where to install Python and Jython. " & _
         "They are installed into directories '" & $PYTHON_DIR_NAME & "' and '" & $JYTHON_DIR_NAME & "', " & _
         "respectively, inside the given base directory. Robot Framework itself is installed under Python " & _
         "installation directory and its startup scripts can be found from '[PYTHON]\Scripts' and code from " & _
         "'[PYTHON]\Lib\site-packages'." & @CRLF & @CRLF & _
         "Note that the specified base directory MUST exist and Python and Jython directories inside it must not. " & _
         "It is also not recommended to use a path containing spaces. Good candidates include directories like " & _
         "'C:\' and 'C:\APPS'."

;;
;; Main
;;

$base_dir = GetBaseDirectory()
$python_installer = GetRequiredInstaller($PYTHON_PATTERN, "Python")
$robot_installer = GetRequiredInstaller($ROBOT_PATTERN, "Robot")
$jython_installer = GetOptionalInstaller($JYTHON_PATTERN)
$python_dir = GetPythonDir($base_dir & $PYTHON_DIR_NAME)
$jython_dir = GetJythonDir($base_dir & $PYTHON_DIR_NAME, $jython_installer)
InstallPython($python_installer, $python_dir)
InstallJython($jython_installer, $jython_dir)
SetPath($python_dir, $jython_dir)  ; This must be done before InstallRobot to always have msvcrt71.dll in PATH
InstallRobot($robot_installer)
Exit

;;
;; Functions
;;

Func GetBaseDirectory()
    If $CmdLine[0] == 0 Then
        $base = InputBox("Robot Framework One Click Installer", $USAGE, "C:\", "", 500, 470)
    ElseIf $CmdLine[0] == 1 Then
        $base = $CmdLine[1]
    Else
        Cancel("Usage: " & @ScriptName & " [basedir]")
    EndIf
    If $base == "" Then
        Cancel("Installation cancelled by user.")
    ElseIf FileExists($base) == 0 Then
        Cancel("Given directory doesn't exist.")
    ElseIf StringRight($base, 1) <> "\" Then
        $base = $base & "\"
    EndIf
    Return $base
EndFunc

Func Cancel($msg)
    MsgBox(0, "Installation Cancelled", $msg)
    Exit
EndFunc

Func GetRequiredInstaller($pattern, $name)
    $installer = GetOptionalInstaller($pattern)
    If $installer == "" Then
        Cancel("Could not find " & $name & " installer with pattern '" & $pattern & "'")
    Endif
    return $installer
EndFunc

Func GetOptionalInstaller($pattern)
    $found = FileFindFirstFile($pattern)
    If $found == -1 Then
        $installer = ""
    Else
        $installer = FileFindNextFile($found)
    EndIf
    FileClose($found)
    return $installer
EndFunc

Func GetPythonDir($dir)
    VerifyInstallationDir($dir, "Python")
    return $dir
EndFunc

Func GetJythonDir($dir, $installer)
    If $installer == "" Then
        return ""
    EndIf
    VerifyInstallationDir($dir, "Jython")
    return $dir
EndFunc

Func VerifyInstallationDir($dir, $name)
    If FileExists($dir) == 1 Then
        Cancel($name & " installation directory '" & $dir & "' already exists.")
    EndIf
EndFunc

Func InstallPython($installer, $dir)
    $cmd = "msiexec /i " & $installer & " TARGETDIR=" & $dir & " /qb!"
    RunWait($cmd)
EndFunc

Func InstallJython($installer, $dir)
    If $installer == "" Then
        return
    EndIf
    $cmd = "java -jar " & $installer & " -s -d " & $dir
    RunWait($cmd)
EndFunc

Func InstallRobot($installer)
    Run($installer)
    WaitSetupWindowAndClickEnter("This Wizard will install")
    WaitSetupWindowAndClickEnter("Select python installation")
    WaitSetupWindowAndClickEnter("Ready to install")
    WaitSetupWindowAndClickEnter("Postinstall script finished")
EndFunc

Func WaitSetupWindowAndClickEnter($exp_text)
    WinWaitActive("Setup", $exp_text)
    Send("{ENTER}")
EndFunc

Func SetPath($python, $jython)
    $update = $python & ";" & $python & "\Scripts;" & $jython
    $orig = RegRead("HKCU\Environment", "PATH")

    If $orig == "" Then
        $new = $update
    ElseIf StringRight($orig, 1) == ";" Then
        $new = $orig & $update
    Else
        $new = $orig & ";" & $update
    EndIf

    RegWrite("HKCU\Environment", "PATH", "REG_EXPAND_SZ", $new)
    EnvUpdate()
EndFunc

;;  Copyright 2008 Nokia Siemens Networks Oyj
;;
;;  Licensed under the Apache License, Version 2.0 (the "License");
;;  you may not use this file except in compliance with the License.
;;  You may obtain a copy of the License at
;;
;;      http://www.apache.org/licenses/LICENSE-2.0
;;
;;  Unless required by applicable law or agreed to in writing, software
;;  distributed under the License is distributed on an "AS IS" BASIS,
;;  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;;  See the License for the specific language governing permissions and
;;  limitations under the License.

;; Robot Framework One Click Installer for Windows
;;
;; This installer installs Robot Framework and its preconditions Python and
;; Jython (optional). If installer is executed without arguments, it opens a
;; dialog explaining the options and asking the user to enter the installation
;; directory. If a command line options is given, it must be a path to an
;; existing directory and it is used as installation directory.
;;
;; For more information about this script see $USAGE below. To learn more
;; about silent Python installation, see url [1]. Silent Jython installation
;; options can be seen with command [2].
;;
;; [1] http://www.python.org/download/releases/2.5/msi/#automated
;; [2] java -jar jython_installer-2.2.x.jar --help

;;
;; Config
;;

; Expected patterns for installer names and target directory names.
$PYTHON_DIR_NAME = "Python25"
$JYTHON_DIR_NAME = "Jython22"
$PYTHON_PATTERN = "python-2.5*.msi"
$ROBOT_PATTERN = "robotframework-2.*.exe"
$JYTHON_PATTERN = "jython_installer-2.2*.jar"

; Usage to show to the user. If major versions of installed software are changed update them also here!!
; Patterns and directory names above are used in the usage so that they don't need to be updated.
$USAGE = "One Click Installer installs Robot Framework and its preconditions Python and Jython (optional). " & _
         "It also sets Robot Framework start-up scripts (pybot, jybot, rebot) as well as Python and Jython executables " & _
         "into %PATH% environment variable so that they can be executed from the command line. (Note that " & _
         "you need to restart the command prompt for these changes to take effect.)" & @CRLF & @CRLF & _
         "You should use this installer ONLY if you don't previously have Python or Jython installed. " & _
         "In that case, and also if you want to have a custom installation, you need to install needed " & _
         "components separately." & @CRLF & @CRLF & _
         "One Click Installer requires that you have all the required component installers in the same directory " & _
         "with it and that they have expected names. If Robot Framework or Python installer is missing, " & _
         "installation fails. If Jython installer doesn't exist, Jython is simply not installed. Note that " & _
         "in order to install Jython, Java 1.4 or newer must be already installed. Supported " & _
         "versions are Robot Framework 2.x, Python 2.5.x and Jython 2.2.x where '.x' means that any minor version " & _
         "(e.g. 2.5 or 2.5.2) is OK. These installers can be downloaded from respective project websites if " & _
         "they are missing. Expected patterns for installer names are '" & $ROBOT_PATTERN & "', '" & _
         $PYTHON_PATTERN & "' and '" & $JYTHON_PATTERN & "'." & @CRLF & @CRLF & _
         "The only thing you need to specify is the base directory where to install Python and Jython. " & _
         "They are installed into directories '" & $PYTHON_DIR_NAME & "' and '" & $JYTHON_DIR_NAME & "', " & _
         "respectively, inside the given base directory. Robot Framework itself is installed under Python " & _
         "installation directory and its startup scripts can be found from '[PYTHON]\Scripts' and code from " & _
         "'[PYTHON]\Lib\site-packages'." & @CRLF & @CRLF & _
         "Note that the specified base directory MUST exist and Python and Jython directories inside it must not. " & _
         "It is also not recommended to use a path containing spaces. Good candidates include directories like " & _
         "'C:\' and 'C:\APPS'."

;;
;; Main
;;

$base_dir = GetBaseDirectory()
$python_installer = GetRequiredInstaller($PYTHON_PATTERN, "Python")
$robot_installer = GetRequiredInstaller($ROBOT_PATTERN, "Robot")
$jython_installer = GetOptionalInstaller($JYTHON_PATTERN)
$python_dir = GetPythonDir($base_dir & $PYTHON_DIR_NAME)
$jython_dir = GetJythonDir($base_dir & $PYTHON_DIR_NAME, $jython_installer)
InstallPython($python_installer, $python_dir)
InstallJython($jython_installer, $jython_dir)
SetPath($python_dir, $jython_dir)  ; This must be done before InstallRobot to always have msvcrt71.dll in PATH
InstallRobot($robot_installer)
Exit

;;
;; Functions
;;

Func GetBaseDirectory()
    If $CmdLine[0] == 0 Then
        $base = InputBox("Robot Framework One Click Installer", $USAGE, "C:\", "", 500, 470)
    ElseIf $CmdLine[0] == 1 Then
        $base = $CmdLine[1]
    Else
        Cancel("Usage: " & @ScriptName & " [basedir]")
    EndIf
    If $base == "" Then
        Cancel("Installation cancelled by user.")
    ElseIf FileExists($base) == 0 Then
        Cancel("Given directory doesn't exist.")
    ElseIf StringRight($base, 1) <> "\" Then
        $base = $base & "\"
    EndIf
    Return $base
EndFunc

Func Cancel($msg)
    MsgBox(0, "Installation Cancelled", $msg)
    Exit
EndFunc

Func GetRequiredInstaller($pattern, $name)
    $installer = GetOptionalInstaller($pattern)
    If $installer == "" Then
        Cancel("Could not find " & $name & " installer with pattern '" & $pattern & "'")
    Endif
    return $installer
EndFunc

Func GetOptionalInstaller($pattern)
    $found = FileFindFirstFile($pattern)
    If $found == -1 Then
        $installer = ""
    Else
        $installer = FileFindNextFile($found)
    EndIf
    FileClose($found)
    return $installer
EndFunc

Func GetPythonDir($dir)
    VerifyInstallationDir($dir, "Python")
    return $dir
EndFunc

Func GetJythonDir($dir, $installer)
    If $installer == "" Then
        return ""
    EndIf
    VerifyInstallationDir($dir, "Jython")
    return $dir
EndFunc

Func VerifyInstallationDir($dir, $name)
    If FileExists($dir) == 1 Then
        Cancel($name & " installation directory '" & $dir & "' already exists.")
    EndIf
EndFunc

Func InstallPython($installer, $dir)
    $cmd = "msiexec /i " & $installer & " TARGETDIR=" & $dir & " /qb!"
    RunWait($cmd)
EndFunc

Func InstallJython($installer, $dir)
    If $installer == "" Then
        return
    EndIf
    $cmd = "java -jar " & $installer & " -s -d " & $dir
    RunWait($cmd)
EndFunc

Func InstallRobot($installer)
    Run($installer)
    WaitSetupWindowAndClickEnter("This Wizard will install")
    WaitSetupWindowAndClickEnter("Select python installation")
    WaitSetupWindowAndClickEnter("Ready to install")
    WaitSetupWindowAndClickEnter("Postinstall script finished")
EndFunc

Func WaitSetupWindowAndClickEnter($exp_text)
    WinWaitActive("Setup", $exp_text)
    Send("{ENTER}")
EndFunc

Func SetPath($python, $jython)
    $update = $python & ";" & $python & "\Scripts;" & $jython
    $orig = RegRead("HKCU\Environment", "PATH")

    If $orig == "" Then
        $new = $update
    ElseIf StringRight($orig, 1) == ";" Then
        $new = $orig & $update
    Else
        $new = $orig & ";" & $update
    EndIf

    RegWrite("HKCU\Environment", "PATH", "REG_EXPAND_SZ", $new)
    EnvUpdate()
EndFunc


Revert "remove extraneous script"

Revert "remove extraneous script"

This reverts commit 2c803e392e23fcb85822d266b9bd2a9641a3d915.

#include <ScreenCapture.au3>

Func Screenshots($prefix, $rows, $columns)
   $window = WinGetHandle("NPP")
   $left = 3
   $top = WinGetPos("NPP")[3] - WinGetClientSize("NPP")[1] + 3
   $right = WinGetClientSize("NPP")[0] - 3
   $bottom = WinGetClientSize("NPP")[1] - 3

   For $row = 0 To $rows - 1
	  $rowname = "A"
	  If $row == 1 Then
		 $rowname = "B"
	  ElseIf $row == 2 Then
		 $rowname = "C"
	  ElseIf $row == 3 Then
		 $rowname = "D"
	  ElseIf $row == 4 Then
 		 $rowname = "E"
	  ElseIf $row == 5 Then
		 $rowname = "X"
	  EndIf

	  For $col = 0 To $columns - 1
 		 $colname = "00"
		 If $col < 10 Then
			$colname = "0" & $col
		 Else
			$colname = "" & $col
		 EndIf

		 Send("{SPACE}")
		 Sleep(500)

		 For $level = 0 To 4
			$levelname = "0" & $level
			$filename = "C:\Users\Liam\workspace\inne++\screenshots\" & $prefix & "-" & $rowname & "-" & $colname & "-" & $levelname & ".jpg"

			Send("{ENTER}")
			Sleep(500)
			Send("{SPACE}")
			Sleep(1)
			_ScreenCapture_CaptureWnd($filename, $window, $left, $top, $right, $bottom, False)
			Send("{ESCAPE}")
 			Sleep(1)
			Send("{DOWN}")
			Sleep(1)
			Send("{DOWN}")
			Sleep(1)
			Send("{ENTER}")
			Sleep(50)
			Send("{RIGHT}")
			Sleep(50)
		 Next

		 Send("{ESCAPE}")
		 Sleep(500)

		 If $col < $columns - 1 Then
			Send("{RIGHT}")
		 EndIf
	  Next

	  Send("{DOWN}")

	  For $col = 0 To $columns - 2
		 Sleep(50)
		 Send("{LEFT}")
	  Next
   Next
EndFunc

WinWaitActive("NPP")
Send("{ENTER}")
Sleep(1)
Send("{ENTER}")
Sleep(1)

Send("{PGUP}")
Sleep(500)
Screenshots("SI", 5, 5)
Sleep(500)
Send("{PGDN}")

Sleep(500)
Screenshots("S", 6, 20)

;Sleep(500)
;Send("{PGDN}")
;Sleep(500)
;Screenshots("SL", 6, 20)

error: pathspec 'screenshots.au3' did not match any file(s) known to git


send telegram message au3

send telegram message au3

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\..\images\RT1.ico
#AutoIt3Wrapper_Outfile=SendTelegramSubteBA.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseX64=y
#AutoIt3Wrapper_Change2CUI=y
#AutoIt3Wrapper_Res_Comment="By Marcelo N. Saied "
#AutoIt3Wrapper_Res_Description="Send Telegram application Message"
#AutoIt3Wrapper_Res_Fileversion=1.0.0.1
#AutoIt3Wrapper_Res_ProductVersion=1.0
#AutoIt3Wrapper_Res_LegalCopyright=Marcelo N. Saied
#AutoIt3Wrapper_Res_Field=Productname|SendTelegramSubteBA.exe
#AutoIt3Wrapper_Res_Field=ProductVersion|Version 1.0
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/mergeonly
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
; *** Start added by AutoIt3Wrapper ***
#include <FileConstants.au3>
; *** End added by AutoIt3Wrapper ***
;===================================================================
;===================================================================
;===                                                             ===
;===   Name   = SendTelegramSubteBA.exe                                 ===
;===                                                             ===
;===   Description:Send Telegram application Message             ===
;===                                                             ===
;===   Author: Marcelo N. Saied                                  ===
;===           marcelosaied@gmail.com                            ===
;===                                                             ===
;===   Automation and Scripting Language: AUTOIT  v3.3.8.1       ===
;===           http://www.autoitscript.com/site/                 ===
;===                                                             ===
;===   Created on: Jan 9 , 2016                                  ===
;===                                                             ===
;===================================================================
;===================================================================
#Region  ------------ AutoIt3Wrapper
$chatID=""
#EndRegion
#Region  ------------ Modules
   #include <File.au3>
   #include <Constants.au3>
   #include <Date.au3>
   #include <Array.au3>
	#include <date.au3>
	#include <IE.au3>
	#include <Array.au3>
	#include "..\..\udf\WinHttp.au3"
#EndRegion
#Region  -----------------------------  parse arguments ------------------------------
; Help
   $helpText="Help:                                                                     " & @crlf & _
			"                                                                           " & @crlf & _
			"      Usage:                                                               " & @crlf & _
			"          SendTelegramSubteBA.exe -m <message> -chatid chatid <optional>   " & @crlf & _
			"                                                                           " & @crlf & _
			"          -m   message                                                     " & @crlf & _
			"          -chatid  chatid  <optional>                                      " & @crlf & _
			"                                                                           " & @crlf & _
			"            Author: Saied, Marcelo                                         " & @crlf & _
			"                                                                           " & @crlf & _
			"                                      2017                                 " & @crlf & _
			"                                                                           " & @crlf & _
			"                                                                           " & @crlf & _
			"                                                                           " & @crlf & _
			"                                                                           "
;~

   if $CmdLine[0]=0 then
	  ConsoleWrite($helpText)
	   exit 1
   endif
   if StringStripWS($CmdLine[1],4)="?"   then  ; output help
	  ConsoleWrite($helpText)
	    exit 3
	endif
;~ 	ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $CmdLine[0] = ' & $CmdLine[0] & @crlf )
    if $CmdLine[0]<2 then  ; if no 3 argumentes then exit    -f filename  -u username -p password  ([-d][-nd])
	  ConsoleWrite("No enough arguments. <Usage>: SendTelegramSubteBA.exe -m <message> -chatid  chatid  <optional>  ")
	  exit 5
   endif

   for $x=1 to $CmdLine[0]-1
	  Select
		case $CmdLine[$x] = "-m"
			$x = $x + 1
			if StringLen($CmdLine[$x]) > 2 then   $mensaje=$CmdLine[$x]
		case $CmdLine[$x] = "-chatid"
			$x = $x + 1
			if StringLen($CmdLine[$x]) > 2 then   $chatID=$CmdLine[$x]
		 Case Else
			ConsoleWrite("No enough arguments <Usage>: SendTelegram.exe -m <message>  ")
			ConsoleWrite("                              SendTelegram.exe ?  for help  ")
			ConsoleWrite(@CRLF)
			exit 6
	  EndSelect
   Next
#EndRegion

SendTelegram($mensaje)
Func SendTelegram($msgtext="testeo")
	if SendTelegramexec($msgtext) Then
		sleep(3000)
		if $chatID<>"" then	SendTelegramexec($msgtext)
	endif
EndFunc

Func SendTelegramexec($msgtext="testeo harcoded")
	local $token=IniRead("..\..\secret\config.ini","bot","token","")
;~ 	local $token="bot401033255:AAGp6iC1iAOSVXIjCAZ3hFuSrtnpJo6Z8BM"   ;  @SubteBA_bot
	$urlMSG="https://api.telegram.org/" & $token & "/sendMessage?chat_id=" & $chatid & "&text=" & $msgtext
	$sGet = HttpGet($urlMSG)

	if $sGet<>"0" then
		ConsoleWrite('Telegram Message sent = ' & $msgtext & @crlf )
		return 0
	Else
		$s_text="Error sending message to Telegram = "
		return 1
	endif
EndFunc

exit

error: pathspec 'helpers/SendTelegramSubteBA/SendTelegramSubteBA.au3' did not match any file(s) known to git


Create object_dump.au3

Create object_dump.au3

#include-once
#include <String.au3>

Func dump($oo, $key = "", $iIdent = 0)
	ConsoleWrite(dump_str($oo, $key, $iIdent) & @LF)
EndFunc   ;==>dump

; #FUNCTION# ====================================================================================================================
; Name...........: dump_str
; Description ...:
; Syntax.........:
; Parameters ....:
; Return values .:
; Author ........: Luismar Chechelaky
; Modified.......: 2015/06/10
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......:
; ===============================================================================================================================
Func dump_str($oo, $key = "", $iIdent = 0)
	Local $iTab = 4
	Local $sKeys
	Local $sString = ""
	If IsDictionary($oo) Then
		$sKeys = $oo.Keys
		For $each In $sKeys
			If IsDictionary($oo.Item($each)) Or IsArray($oo.Item($each)) Then
				$sString &= (($iIdent == 0 ? "" : (_StringRepeat(" ", $iIdent))) & $each & "{" & @LF)
				$sString &= dump_str($oo.Item($each), ($key == "" ? "" : $key & ".") & $each, $iTab + $iIdent)
				$sString &= (($iIdent == 0 ? "" : (_StringRepeat(" ", $iIdent))) & "}" & @LF)
			Else
				$sString &= (($iIdent == 0 ? "" : (_StringRepeat(" ", $iIdent))) & ($key == "" ? "" : $key & ".") & $each & " = " & $oo.Item($each) & @LF)
			EndIf
		Next
	Else
		If IsArray($oo) Then
			Switch UBound($oo, 0)
				Case 1
					For $ii = 0 To UBound($oo, 1) - 1
						If IsDictionary($oo[$ii]) Or IsArray($oo[$ii]) Then
							$sString &= dump_str($oo[$ii], $key & "[" & $ii & "]", $iTab + $iIdent)
						Else
							$sString &= (($iIdent == 0 ? "" : (_StringRepeat(" ", $iIdent))) & "[" & ($key == "" ? "" : $key & "[") & $ii & "] = " & $oo[$ii] & @LF)
						EndIf
					Next
				Case 2
					For $ii = 0 To UBound($oo, 1) - 1
						For $jj = 0 To UBound($oo, 2) - 1
							If IsDictionary($oo[$ii][$jj]) Or IsArray($oo[$ii][$jj]) Then
								$sString &= dump_str($oo[$ii][$jj], $key & "[" & $ii & "][" & $jj & "]", $iTab + $iIdent)
							Else
								$sString &= (($iIdent == 0 ? "" : (_StringRepeat(" ", $iIdent))) & ($key == "" ? "" : $key & "[") & $ii & "][" & $jj & "] = " & $oo[$ii][$jj] & @LF)
							EndIf
						Next
					Next
			EndSwitch
		Else

		EndIf
	EndIf
	Return $sString
EndFunc   ;==>dump_str

Func IsDictionary($oo = Null)
	If Not IsObj($oo) Or Not (ObjName($oo, 2) == "Scripting.Dictionary") Then Return 0
	Return 1
EndFunc   ;==>IsDictionary

error: pathspec 'object_dump.au3' did not match any file(s) known to git


Create 点击右下角系统托盘中的图标.au3

Create 点击右下角系统托盘中的图标.au3

  #include <MsgBoxConstants.au3>
  #Include <GuiToolBar.au3>

  Local $sToolTip="z00316474";
  Local $hSysTray = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')

    For $i = 1 To _GUICtrlToolbar_ButtonCount($hSystray)
      $sCurrent = _GUICtrlToolbar_GetButtonText($hSystray,$i)
      MsgBox($MB_SYSTEMMODAL, "Title", $sCurrent , 100)
      If $sCurrent == $sToolTip Then
        _GUICtrlToolbar_ClickButton($hSystray, $i, "left")
        ExitLoop
      EndIf
    Next

error: pathspec 'hobby/Au3Examples/点击右下角系统托盘中的图标.au3' did not match any file(s) known to git


simple autoit script for test

simple autoit script for test

#include <IE.au3>
;http://msdn.microsoft.com/en-us/library/Aa752084.aspx
$ourl="http://localhost:5000/"

$oIE = _IEAttach ($ourl,"url")
If @error = $_IEStatus_NoMatch Then
	$oIE = _IECreate ($ourl & "sample.html")
endIf

$oForm = _IEFormGetObjByName ($oIE, "form1")
;username, call DOM directly
$oIE.document.getElementById("username").value="helloAutoIT"
;state select
$oSelect = _IEFormElementGetObjByName ($oForm, "state")
_IEFormElementOptionSelect ($oSelect, "S2", 1, "byText")
;options raido
_IEFormElementRadioSelect($oForm, "2nd", "type", 1, "byValue")

ConsoleWrite(@Error)
Sleep(10000)
_IEFormSubmit($oForm, 0)
_IELoadWait($oIE)
Sleep(60000)
_IEQuit($oIE)

error: pathspec 'tests/examplefiles/autoit_submit.au3' did not match any file(s) known to git


au3 test

au3 test

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.16.0
 Author:         myName

 Script Function:
	Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include <MsgBoxConstants.au3>
#include <Debug.au3>

;MsgBox(0, "", "@AutoItVersion: " & AutoItVersion & ", @CPUArch: " & @CPUArch)
_DebugSetup("Start", True)
ConsoleWrite("starting" & @CRLF)
ConsoleWrite("@CPUArch: " & @CPUArch)

_DebugSetup("DllCall", True)

;Local $hDLL = DllOpen("x64\Debug\event-stream.dll")
Local $hDLL = DllOpen("Debug\event-stream.dll")
ConsoleWrite("hdll " & $hDLL  & @CRLF)

if $hDLL < 0 Then
	ConsoleWrite("Error opening dll " & $hDLL  & @CRLF)
	Return
EndIf

Local $ret = DllCall ( $hDLL, "int:cdecl", "StreamEvents", "WSTR", "Microsoft-Windows-Sysmon/Operational", "WSTR", "c:\temp\sysmon.xml")
;Local $ret = DllCall ( $hDLL, "INT", "HelloWorld0")
ConsoleWrite("dll ret " & $ret  & @CRLF)
$ret = DllCall ( $hDLL, "int:cdecl", "HelloWorld0")
ConsoleWrite("dll ret " & $ret  & @CRLF)
$ret = DllCall ( $hDLL, 'int:cdecl', "HelloWorld1", "int", 0)

ConsoleWrite("dll ret " & $ret  & @CRLF)
DllClose($hDLL)

; MsgBox($MB_OK, "Tutorial", "done")
ConsoleWrite("exit")

error: pathspec 'test-event-stream.au3' did not match any file(s) known to git


added an AutoIt script for managing the [ExternalApplications] section of the Revit.ini

; =============================================================================
; addrevitplugin
;
; adds a plugin to Autodesk Revit Architecture 2010 by altering the Revit.ini
; file.
; =============================================================================

; you might want to set this to another GUI, if you are not using
; Revit Architecture 2010 - see: http://thebuildingcoder.typepad.com/blog/2009/02/revit-install-path-and-product-guids.html
Const $guid = '{572FBF5D-3BAA-42ff-A468-A54C2C0A17C3}'

; retrieve the commandline arguments
If $CmdLine[0] == 2 Then

	$class = $CmdLine[1]
	$path = $CmdLine[2]
	AddOrUpdatePlugin($class, $path)

ElseIf $CmdLine[0] == 1 Then

	$class = $CmdLine[1]
	DeletePlugin($class)

Else

	; print usage and exit
	$message = 'usage: ' & @ScriptName & ' EAClassName [EAAssembly]'
	MsgBox(0, "addrevitplugin", $message, 10)

EndIf

; if a plugin is already defined for $class, then
; just change the path, otherwise add a new plugin
Func AddOrUpdatePlugin($class, $path)

	$inipath = RevitIni()
	$section = "ExternalApplications"

	$EACount = Int(IniRead($inipath, $section, "EACount", "0"))

	If $EACount > 0 Then

		; this fails if $EACount == 0, pity
		Dim $EAAssembly[$EACount]
		Dim $EAClassName[$EACount]

	EndIf

	; read in current values
	For $i = 0 To $EACount - 1

		$EAIndex = $i + 1 ; 1-based in ini-file, 0-based in array...
		$EAAssembly[$i] = IniRead($inipath, $section, "EAAssembly" & $EAIndex, "")
		$EAClassName[$i] = IniRead($inipath, $section, "EAClassName" & $EAIndex, "")

	Next

	$updated = False ; have we updated anything?
	; write back the values, updating the path if found
	For $i = 0 To $EACount - 1

		$EAIndex = $i + 1 ; 1-based in ini-file, 0-based in array...
		IniWrite($inipath, $section, "EAClassName" & $EAIndex, $EAClassName[$i])

		If $EAClassName[$i] == $class Then

			; update path to new assembly
			IniWrite($inipath, $section, "EAAssembly" & $EAIndex, $path)
			$updated = True

		Else

			; leave as is
			IniWrite($inipath, $section, "EAAssembly" & $EAIndex, $EAAssembly[$i])

		Endif

	Next

	; if we haven't updated anything yet, then we must add a new entry
	If Not $updated Then

		$EAIndex = $EACount + 1;
		IniWrite($inipath, $section, "EAClassName" & $EAIndex, $class)
		IniWrite($inipath, $section, "EAAssembly" & $EAIndex, $path)
		IniWrite($inipath, $section, "EACount", $EACount + 1)

	EndIf

EndFunc

; if a plugin is found with the class, delete it
Func DeletePlugin($class)

	$inipath = RevitIni()
	$section = "ExternalApplications"

	$EACount = Int(IniRead($inipath, $section, "EACount", "0"))
	If $EACount == 0 Then

		; no plugins to delete
		MsgBox(0, "addrevitplugin", "No external applications found in Revit.ini")
		Exit(0)

	EndIf

	Dim $EAAssembly[$EACount]
	Dim $EAClassName[$EACount]

	; read in current values
	For $i = 0 To $EACount - 1

		$EAIndex = $i + 1 ; 1-based in ini-file, 0-based in array...
		$EAAssembly[$i] = IniRead($inipath, $section, "EAAssembly" & $EAIndex, "")
		$EAClassName[$i] = IniRead($inipath, $section, "EAClassName" & $EAIndex, "")

	Next

	; delete current values
	IniWriteSection($inipath, $section, "")

	; write new values (skip deleted plugin)
	$EAIndex = 1
	For $i = 0 To $EACount - 1

		If $EAClassName[$i] <> $class && $EAClassName[$i] <> "" Then

			IniWrite($inipath, $section, "EAAssembly" & $EAIndex, $EAAssembly[$i])
			IniWrite($inipath, $section, "EAClassName" & $EAIndex, $EAClassName[$i])
			$EAIndex = $EAIndex + 1

		EndIf

	Next
	; new count of external assemblies
	IniWrite($inipath, $section, "EACount", $EAIndex - 1)

EndFunc

; finds the path to the Revit.ini file and returns it
Func RevitIni()

	; the location of the Autodesk Revit Architecture 2010 installation in is here
	$regpath = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & $guid
	$installpath = RegRead($regpath, "InstallLocation")
	If @error <> 0 Then

		$message = "maybe you are using a different version (e.g. not Autodesk Revit Architecture 2010 [32bit])?"
		MsgBox(48, "addrevitplugin", "Could not find registry key: " & $regpath & @CRLF & $message)
		Exit(1)

	Else

		return $installpath & "Program\Revit.ini"

	EndIf

EndFunc

error: pathspec 'addrevitplugin/addrevitplugin.au3' did not match any file(s) known to git


Create base64.au3

Create base64.au3

error: pathspec 'base64.au3' did not match any file(s) known to git


测试多点上传

测试多点上传

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/zkliuym/TradeBlazerWork.git/'


Create FRED.au3

Create FRED.au3

#include-once
#include <Array.au3>
#include <String.au3>

; FRED
; #INDEX# ==========================================================================================================================================================
; Title .........: FRED 1.01
; AutoIt Version : 3.3.10.2
; Language ......: Português Br
; Description ...: codifica: array, Scripting.Dictionary, double, int32, int64, bool, string, Null, Default em uma cadeia de caracteres
; Authors .......: Luismar Chechelaky (Luigi)
; Source.........:
; Version........: 0.0.0.2
; fixeds:
;                  30/06/2014 bug in empty code fixed
; ==================================================================================================================================================================

;~ example_01()
;~ example_02()
;~ example_03()
;~ example_04()
;~ example_05()
;~ example_06()
;~ example_07()

;~ Func example_01()
;~ 	Local $num = 1
;~ 	Local $code = code($num)
;~ 	Local $decode = decode($code)
;~ 	MsgBox(0, 'Example 01', '$num = ' & $num & @LF & '$code = ' & $code & @LF & '$decode = ' & $decode)
;~ EndFunc   ;==>example_01

;~ Func example_02()
;~ 	Local $num = 0
;~ 	Local $code = code($num)
;~ 	Local $decode = decode($code)
;~ 	MsgBox(0, 'Example 02', '$num = ' & $num & @LF & '$code = ' & $code & @LF & '$decode = ' & $decode)
;~ EndFunc   ;==>example_02

;~ Func example_03()
;~ 	Local $num = -1
;~ 	Local $code = code($num)
;~ 	Local $decode = decode($code)
;~ 	MsgBox(0, 'Example 03', '$num = ' & $num & @LF & '$code = ' & $code & @LF & '$decode = ' & $decode)
;~ EndFunc   ;==>example_03

;~ Func example_04()
;~ 	Local $string = 'É um erro ter razão cedo demais.'
;~ 	Local $code = code($string)
;~ 	Local $decode = decode($code)
;~ 	MsgBox(0, 'Example 04', '$num = ' & $string & @LF & '$code = ' & $code & @LF & '$decode = ' & $decode)
;~ EndFunc   ;==>example_04

;~ Func example_05()
;~ 	Local $aTest[2] = ['Violão', 'Argüição']
;~ 	_ArrayDisplay($aTest, 'Ex. 5')
;~ 	Local $code = code($aTest)
;~ 	MsgBox(0, 'Example 05: code array[n]', '$code = ' & $code)
;~ 	Local $decode = decode($code)
;~ 	_ArrayDisplay($decode, 'Ex. 5 decode array')
;~ EndFunc   ;==>example_05

Func example_06()
	Local $aTest1[2] = ['Violão', 'Argüição']
	Local $aTest2[2][2] = [['um', $aTest1],['três', 'quatro']]
	_ArrayDisplay($aTest2, 'Ex. 6')
	Local $code = code($aTest2)
	MsgBox(0, 'Example 06: code array[n][m]', '$code = ' & $code)
	Local $decode = decode($code)
	_ArrayDisplay($decode, 'Ex. 6 decode $aTeste2[n][m]')
	_ArrayDisplay($decode[0][1], 'Ex. 6 decode $aTest1[n]')
EndFunc   ;==>example_06

;~ Func example_07()
;~ 	Local $aTest1[2] = ["Violão", "Argüição"]
;~ 	Local $oo = ObjCreate("Scripting.Dictionary")
;~ 	$oo.Add("key1", "")
;~ 	$oo.Add("key2", "value2")
;~ 	$oo.Add("key3", $aTest1)
;~ 	Local $code = code($oo)
;~ 	MsgBox(0, "Example 07: code obj", "$code = " & $code)
;~ 	Local $decode = decode($code)
;~ 	MsgBox(0, "Example 07: decode", _
;~ 			"key1 = " & $decode.Item("key1") & _
;~ 			"key2 = " & $decode.Item("key2") & _
;~ 			"key3.0 = " & ($decode.Item("key3"))[0] & _
;~ 			"key3.1 = " & ($decode.Item("key3"))[1])
;~ EndFunc   ;==>example_07

Func decode($VAR = '')
	Local $iLenght = __lenght($VAR)
	Local $iSize = StringLeft($VAR, $iLenght)
	Local $sType = StringMid($VAR, $iLenght + 1, 1)
	Switch $sType
		Case 'a'
			Local $aMount[1]
			__mount_array($aMount, $VAR)
			__clean_var($VAR)
			Switch UBound($aMount, 0)
				Case 1
					For $iNext_1 = 0 To UBound($aMount, 1) - 1
						$aMount[$iNext_1] = __mount_next_cell($VAR)
					Next
					Return $aMount
				Case 2
					For $iNext_1 = 0 To UBound($aMount, 1) - 1
						For $iNext_2 = 0 To UBound($aMount, 2) - 1
							$aMount[$iNext_1][$iNext_2] = __mount_next_cell($VAR)
						Next
					Next
					Return $aMount
				Case 3
					For $iNext_1 = 0 To UBound($aMount, 1) - 1
						For $iNext_2 = 0 To UBound($aMount, 2) - 1
							For $iNext_3 = 0 To UBound($aMount, 3) - 1
								$aMount[$iNext_1][$iNext_2][$iNext_3] = __mount_next_cell($VAR)
							Next
						Next
					Next
					Return $aMount
				Case 4
					For $iNext_1 = 0 To UBound($aMount, 1) - 1
						For $iNext_2 = 0 To UBound($aMount, 2) - 1
							For $iNext_3 = 0 To UBound($aMount, 3) - 1
								For $iNext_4 = 0 To UBound($aMount, 4) - 1
									$aMount[$iNext_1][$iNext_2][$iNext_3][$iNext_4] = __mount_next_cell($VAR)
								Next
							Next
						Next
					Next
					Return $aMount
				Case 4
					For $iNext_1 = 0 To UBound($aMount, 1) - 1
						For $iNext_2 = 0 To UBound($aMount, 2) - 1
							For $iNext_3 = 0 To UBound($aMount, 3) - 1
								For $iNext_4 = 0 To UBound($aMount, 4) - 1
									For $iNext_5 = 0 To UBound($aMount, 5) - 1
										$aMount[$iNext_1][$iNext_2][$iNext_3][$iNext_4][$iNext_5] = __mount_next_cell($VAR)
									Next
								Next
							Next
						Next
					Next
					Return $aMount
				Case 5
					For $iNext_1 = 0 To UBound($aMount, 1) - 1
						For $iNext_2 = 0 To UBound($aMount, 2) - 1
							For $iNext_3 = 0 To UBound($aMount, 3) - 1
								For $iNext_4 = 0 To UBound($aMount, 4) - 1
									For $iNext_5 = 0 To UBound($aMount, 5) - 1
										For $iNext_6 = 0 To UBound($aMount, 6) - 1
											$aMount[$iNext_1][$iNext_2][$iNext_3][$iNext_4][$iNext_5][$iNext_6] = __mount_next_cell($VAR)
										Next
									Next
								Next
							Next
						Next
					Next
					Return $aMount
				Case 6
					For $iNext_1 = 0 To UBound($aMount, 1) - 1
						For $iNext_2 = 0 To UBound($aMount, 2) - 1
							For $iNext_3 = 0 To UBound($aMount, 3) - 1
								For $iNext_4 = 0 To UBound($aMount, 4) - 1
									For $iNext_5 = 0 To UBound($aMount, 5) - 1
										For $iNext_6 = 0 To UBound($aMount, 6) - 1
											For $iNext_7 = 0 To UBound($aMount, 7) - 1
												$aMount[$iNext_1][$iNext_2][$iNext_3][$iNext_4][$iNext_5][$iNext_6][$iNext_7] = __mount_next_cell($VAR)
											Next
										Next
									Next
								Next
							Next
						Next
					Next
					Return $aMount
				Case 7
					For $iNext_1 = 0 To UBound($aMount, 1) - 1
						For $iNext_2 = 0 To UBound($aMount, 2) - 1
							For $iNext_3 = 0 To UBound($aMount, 3) - 1
								For $iNext_4 = 0 To UBound($aMount, 4) - 1
									For $iNext_5 = 0 To UBound($aMount, 5) - 1
										For $iNext_6 = 0 To UBound($aMount, 6) - 1
											For $iNext_7 = 0 To UBound($aMount, 7) - 1
												For $iNext_8 = 0 To UBound($aMount, 8) - 1
													$aMount[$iNext_1][$iNext_2][$iNext_3][$iNext_4][$iNext_5][$iNext_6][$iNext_7][$iNext_8] = __mount_next_cell($VAR)
												Next
											Next
										Next
									Next
								Next
							Next
						Next
					Next
					Return $aMount
				Case 8
					For $iNext_1 = 0 To UBound($aMount, 1) - 1
						For $iNext_2 = 0 To UBound($aMount, 2) - 1
							For $iNext_3 = 0 To UBound($aMount, 3) - 1
								For $iNext_4 = 0 To UBound($aMount, 4) - 1
									For $iNext_5 = 0 To UBound($aMount, 5) - 1
										For $iNext_6 = 0 To UBound($aMount, 6) - 1
											For $iNext_7 = 0 To UBound($aMount, 7) - 1
												For $iNext_8 = 0 To UBound($aMount, 8) - 1
													For $iNext_9 = 0 To UBound($aMount, 9) - 1
														$aMount[$iNext_1][$iNext_2][$iNext_3][$iNext_4][$iNext_5][$iNext_6][$iNext_7][$iNext_8][$iNext_9] = __mount_next_cell($VAR)
													Next
												Next
											Next
										Next
									Next
								Next
							Next
						Next
					Next
					Return $aMount
				Case 9
					For $iNext_1 = 0 To UBound($aMount, 1) - 1
						For $iNext_2 = 0 To UBound($aMount, 2) - 1
							For $iNext_3 = 0 To UBound($aMount, 3) - 1
								For $iNext_4 = 0 To UBound($aMount, 4) - 1
									For $iNext_5 = 0 To UBound($aMount, 5) - 1
										For $iNext_6 = 0 To UBound($aMount, 6) - 1
											For $iNext_7 = 0 To UBound($aMount, 7) - 1
												For $iNext_8 = 0 To UBound($aMount, 8) - 1
													For $iNext_9 = 0 To UBound($aMount, 9) - 1
														For $iNext_10 = 0 To UBound($aMount, 10) - 1
															$aMount[$iNext_1][$iNext_2][$iNext_3][$iNext_4][$iNext_5][$iNext_6][$iNext_7][$iNext_8][$iNext_9][$iNext_10] = __mount_next_cell($VAR)
														Next
													Next
												Next
											Next
										Next
									Next
								Next
							Next
						Next
					Next
					Return $aMount
				Case Else
					Return SetError(1, 0, 0)
			EndSwitch
		Case 'o'
			__clean_var($VAR, 1)
			Local $oo = ObjCreate('Scripting.Dictionary')
			While Not $VAR = ''
				Local $key, $value
				$key = __mount_next_cell($VAR)
				$value = __mount_next_cell($VAR)
				$oo.Add($key, $value)
			WEnd
			$VAR = $oo
		Case 'f', 'F'
			If $iSize == 0 Then
				$VAR = 0.0
			Else
				$VAR = StringReplace($VAR, '_', '.')
				$VAR = Number(StringMid($VAR, __lenght($VAR) + 2))
				$VAR *= ($sType == 'F' ? 1 : -1)
			EndIf
		Case 'i', 'I'
			If $iSize == 0 Then
				$VAR = 0
			Else
				$VAR = Number(StringMid($VAR, __lenght($VAR) + 2))
				$VAR *= ($sType == 'I' ? 1 : -1)
			EndIf
		Case 'y', 'Y'
			If $iSize == 0 Then
				$VAR = 0
			Else
				$VAR = Number(StringMid($VAR, __lenght($VAR) + 2))
				$VAR *= ($sType == 'I' ? 1 : -1)
			EndIf
		Case 'b', 'B'
			$VAR = ($sType == 'b' ? False : True)
		Case 'n'
			$VAR = Null
		Case 'd'
			$VAR = Default
		Case 's'
			If $iSize Then
				$VAR = String(__decode(StringMid($VAR, __lenght($VAR) + 2)))
			Else
				$VAR = ''
			EndIf
	EndSwitch
	Return $VAR
EndFunc   ;==>decode

Func code($VAR = '', $mode = 0)
	If Number($mode) == 1 Then
		$VAR = String($VAR)
		If $VAR == '' Then Return SetError(1, 0, 0)
		$VAR = StringRegExpReplace($VAR, '[^A-Za-z0-9\-]', '')
		If StringLen($VAR) == 0 Then Return SetError(1, 0, 0)
	EndIf

	If IsArray($VAR) Then
		Local $aDim[1]
		For $num_0 = 0 To UBound($VAR, 0) - 1
			_ArrayAdd($aDim, UBound($VAR, $num_0 + 1))
		Next
		$aDim = _ArrayToString($aDim, '*', 1)
		Switch UBound($VAR, 0)
			Case 1
				Local $aTemp0[1]
				For $iNext_1 = 0 To UBound($VAR) - 1
					_ArrayAdd($aTemp0, code($VAR[$iNext_1]))
				Next
				Local $string = _ArrayToString($aTemp0, ',', 1)
				Return __return__code_array($aDim, $VAR, $aTemp0)
			Case 2
				Local $aTemp0[1]
				For $iNext_1 = 0 To UBound($VAR, 1) - 1
					Local $aTemp1[1]
					For $iNext_2 = 0 To UBound($VAR, 2) - 1
						_ArrayAdd($aTemp1, code($VAR[$iNext_1][$iNext_2]))
					Next
					_ArrayAdd($aTemp0, '[' & _ArrayToString($aTemp1, ',', 1) & ']')
				Next
				Return __return__code_array($aDim, $VAR, $aTemp0)
			Case 3
				Local $aTemp0[1]
				For $iNext_1 = 0 To UBound($VAR, 1) - 1
					Local $aTemp1[1]
					For $iNext_2 = 0 To UBound($VAR, 2) - 1
						Local $aTemp2[1]
						For $iNext_3 = 0 To UBound($VAR, 3) - 1
							_ArrayAdd($aTemp2, code($VAR[$iNext_1][$iNext_2][$iNext_3]))
						Next
						_ArrayAdd($aTemp1, '[' & _ArrayToString($aTemp2, ',', 1) & ']')
					Next
					_ArrayAdd($aTemp0, '[' & _ArrayToString($aTemp1, ',', 1) & ']')
				Next
				Return __return__code_array($aDim, $VAR, $aTemp0)
			Case 4
				Local $aTemp0[1]
				For $iNext_1 = 0 To UBound($VAR, 1) - 1
					Local $aTemp1[1]
					For $iNext_2 = 0 To UBound($VAR, 2) - 1
						Local $aTemp2[1]
						For $iNext_3 = 0 To UBound($VAR, 3) - 1
							Local $aTemp3[1]
							For $iNext_4 = 0 To UBound($VAR, 4) - 1
								_ArrayAdd($aTemp3, code($VAR[$iNext_1][$iNext_2][$iNext_3][$iNext_4]))
							Next
							_ArrayAdd($aTemp2, '[' & _ArrayToString($aTemp3, ',', 1) & ']')
						Next
						_ArrayAdd($aTemp1, '[' & _ArrayToString($aTemp2, ',', 1) & ']')
					Next
					_ArrayAdd($aTemp0, '[' & _ArrayToString($aTemp1, ',', 1) & ']')
				Next
				Return __return__code_array($aDim, $VAR, $aTemp0)
			Case 5
				Local $aTemp0[1]
				For $iNext_1 = 0 To UBound($VAR, 1) - 1
					Local $aTemp1[1]
					For $iNext_2 = 0 To UBound($VAR, 2) - 1
						Local $aTemp2[1]
						For $iNext_3 = 0 To UBound($VAR, 3) - 1
							Local $aTemp3[1]
							For $iNext_4 = 0 To UBound($VAR, 4) - 1
								Local $aTemp4[1]
								For $iNext_5 = 0 To UBound($VAR, 5) - 1
									_ArrayAdd($aTemp4, code($VAR[$iNext_1][$iNext_2][$iNext_3][$iNext_4][$iNext_5]))
								Next
								_ArrayAdd($aTemp3, '[' & _ArrayToString($aTemp4, ',', 1) & ']')
							Next
							_ArrayAdd($aTemp2, '[' & _ArrayToString($aTemp3, ',', 1) & ']')
						Next
						_ArrayAdd($aTemp1, '[' & _ArrayToString($aTemp2, ',', 1) & ']')
					Next
					_ArrayAdd($aTemp0, '[' & _ArrayToString($aTemp1, ',', 1) & ']')
				Next
				Return __return__code_array($aDim, $VAR, $aTemp0)
			Case 6
				Local $aTemp0[1]
				For $iNext_1 = 0 To UBound($VAR, 1) - 1
					Local $aTemp1[1]
					For $iNext_2 = 0 To UBound($VAR, 2) - 1
						Local $aTemp2[1]
						For $iNext_3 = 0 To UBound($VAR, 3) - 1
							Local $aTemp3[1]
							For $iNext_4 = 0 To UBound($VAR, 4) - 1
								Local $aTemp4[1]
								For $iNext_5 = 0 To UBound($VAR, 5) - 1
									Local $aTemp5[1]
									For $iNext_6 = 0 To UBound($VAR, 6) - 1
										_ArrayAdd($aTemp5, code($VAR[$iNext_1][$iNext_2][$iNext_3][$iNext_4][$iNext_5][$iNext_6]))
									Next
									_ArrayAdd($aTemp4, '[' & _ArrayToString($aTemp5, ',', 1) & ']')
								Next
								_ArrayAdd($aTemp3, '[' & _ArrayToString($aTemp4, ',', 1) & ']')
							Next
							_ArrayAdd($aTemp2, '[' & _ArrayToString($aTemp3, ',', 1) & ']')
						Next
						_ArrayAdd($aTemp1, '[' & _ArrayToString($aTemp2, ',', 1) & ']')
					Next
					_ArrayAdd($aTemp0, '[' & _ArrayToString($aTemp1, ',', 1) & ']')
				Next
				Return __return__code_array($aDim, $VAR, $aTemp0)
			Case 7
				Local $aTemp0[1]
				For $iNext_1 = 0 To UBound($VAR, 1) - 1
					Local $aTemp1[1]
					For $iNext_2 = 0 To UBound($VAR, 2) - 1
						Local $aTemp2[1]
						For $iNext_3 = 0 To UBound($VAR, 3) - 1
							Local $aTemp3[1]
							For $iNext_4 = 0 To UBound($VAR, 4) - 1
								Local $aTemp4[1]
								For $iNext_5 = 0 To UBound($VAR, 5) - 1
									Local $aTemp5[1]
									For $iNext_6 = 0 To UBound($VAR, 6) - 1
										Local $aTemp6[1]
										For $iNext_7 = 0 To UBound($VAR, 7) - 1
											_ArrayAdd($aTemp6, code($VAR[$iNext_1][$iNext_2][$iNext_3][$iNext_4][$iNext_5][$iNext_6][$iNext_7]))
										Next
										_ArrayAdd($aTemp5, '[' & _ArrayToString($aTemp6, ',', 1) & ']')
									Next
									_ArrayAdd($aTemp4, '[' & _ArrayToString($aTemp5, ',', 1) & ']')
								Next
								_ArrayAdd($aTemp3, '[' & _ArrayToString($aTemp4, ',', 1) & ']')
							Next
							_ArrayAdd($aTemp2, '[' & _ArrayToString($aTemp3, ',', 1) & ']')
						Next
						_ArrayAdd($aTemp1, '[' & _ArrayToString($aTemp2, ',', 1) & ']')
					Next
					_ArrayAdd($aTemp0, '[' & _ArrayToString($aTemp1, ',', 1) & ']')
				Next
				Return __return__code_array($aDim, $VAR, $aTemp0)
			Case 8
				Local $aTemp0[1]
				For $iNext_1 = 0 To UBound($VAR, 1) - 1
					Local $aTemp1[1]
					For $iNext_2 = 0 To UBound($VAR, 2) - 1
						Local $aTemp2[1]
						For $iNext_3 = 0 To UBound($VAR, 3) - 1
							Local $aTemp3[1]
							For $iNext_4 = 0 To UBound($VAR, 4) - 1
								Local $aTemp4[1]
								For $iNext_5 = 0 To UBound($VAR, 5) - 1
									Local $aTemp5[1]
									For $iNext_6 = 0 To UBound($VAR, 6) - 1
										Local $aTemp6[1]
										For $iNext_7 = 0 To UBound($VAR, 7) - 1
											Local $aTemp7[1]
											For $iNext_8 = 0 To UBound($VAR, 8) - 1
												_ArrayAdd($aTemp7, code($VAR[$iNext_1][$iNext_2][$iNext_3][$iNext_4][$iNext_5][$iNext_6][$iNext_7][$iNext_8]))
											Next
											_ArrayAdd($aTemp6, '[' & _ArrayToString($aTemp7, ',', 1) & ']')
										Next
										_ArrayAdd($aTemp5, '[' & _ArrayToString($aTemp6, ',', 1) & ']')
									Next
									_ArrayAdd($aTemp4, '[' & _ArrayToString($aTemp5, ',', 1) & ']')
								Next
								_ArrayAdd($aTemp3, '[' & _ArrayToString($aTemp4, ',', 1) & ']')
							Next
							_ArrayAdd($aTemp2, '[' & _ArrayToString($aTemp3, ',', 1) & ']')
						Next
						_ArrayAdd($aTemp1, '[' & _ArrayToString($aTemp2, ',', 1) & ']')
					Next
					_ArrayAdd($aTemp0, '[' & _ArrayToString($aTemp1, ',', 1) & ']')
				Next
				Return __return__code_array($aDim, $VAR, $aTemp0)
			Case 9
				Local $aTemp0[1]
				For $iNext_1 = 0 To UBound($VAR, 1) - 1
					Local $aTemp1[1]
					For $iNext_2 = 0 To UBound($VAR, 2) - 1
						Local $aTemp2[1]
						For $iNext_3 = 0 To UBound($VAR, 3) - 1
							Local $aTemp3[1]
							For $iNext_4 = 0 To UBound($VAR, 4) - 1
								Local $aTemp4[1]
								For $iNext_5 = 0 To UBound($VAR, 5) - 1
									Local $aTemp5[1]
									For $iNext_6 = 0 To UBound($VAR, 6) - 1
										Local $aTemp6[1]
										For $iNext_7 = 0 To UBound($VAR, 7) - 1
											Local $aTemp7[1]
											For $iNext_8 = 0 To UBound($VAR, 8) - 1
												Local $aTemp8[1]
												For $iNext_9 = 0 To UBound($VAR, 9) - 1
													_ArrayAdd($aTemp8, code($VAR[$iNext_1][$iNext_2][$iNext_3][$iNext_4][$iNext_5][$iNext_6][$iNext_7][$iNext_8][$iNext_9]))
												Next
												_ArrayAdd($aTemp7, '[' & _ArrayToString($aTemp8, ',', 1) & ']')
											Next
											_ArrayAdd($aTemp6, '[' & _ArrayToString($aTemp7, ',', 1) & ']')
										Next
										_ArrayAdd($aTemp5, '[' & _ArrayToString($aTemp6, ',', 1) & ']')
									Next
									_ArrayAdd($aTemp4, '[' & _ArrayToString($aTemp5, ',', 1) & ']')
								Next
								_ArrayAdd($aTemp3, '[' & _ArrayToString($aTemp4, ',', 1) & ']')
							Next
							_ArrayAdd($aTemp2, '[' & _ArrayToString($aTemp3, ',', 1) & ']')
						Next
						_ArrayAdd($aTemp1, '[' & _ArrayToString($aTemp2, ',', 1) & ']')
					Next
					_ArrayAdd($aTemp0, '[' & _ArrayToString($aTemp1, ',', 1) & ']')
				Next
				Return __return__code_array($aDim, $VAR, $aTemp0)
			Case 10
				Local $aTemp0[1]
				For $iNext_1 = 0 To UBound($VAR, 1) - 1
					Local $aTemp1[1]
					For $iNext_2 = 0 To UBound($VAR, 2) - 1
						Local $aTemp2[1]
						For $iNext_3 = 0 To UBound($VAR, 3) - 1
							Local $aTemp3[1]
							For $iNext_4 = 0 To UBound($VAR, 4) - 1
								Local $aTemp4[1]
								For $iNext_5 = 0 To UBound($VAR, 5) - 1
									Local $aTemp5[1]
									For $iNext_6 = 0 To UBound($VAR, 6) - 1
										Local $aTemp6[1]
										For $iNext_7 = 0 To UBound($VAR, 7) - 1
											Local $aTemp7[1]
											For $iNext_8 = 0 To UBound($VAR, 8) - 1
												Local $aTemp8[1]
												For $iNext_9 = 0 To UBound($VAR, 9) - 1
													Local $aTemp9[1]
													For $iNext_10 = 0 To UBound($VAR, 10) - 1
														_ArrayAdd($aTemp9, code($VAR[$iNext_1][$iNext_2][$iNext_3][$iNext_4][$iNext_5][$iNext_6][$iNext_7][$iNext_8][$iNext_9][$iNext_10]))
													Next
													_ArrayAdd($aTemp8, '[' & _ArrayToString($aTemp9, ',', 1) & ']')
												Next
												_ArrayAdd($aTemp7, '[' & _ArrayToString($aTemp8, ',', 1) & ']')
											Next
											_ArrayAdd($aTemp6, '[' & _ArrayToString($aTemp7, ',', 1) & ']')
										Next
										_ArrayAdd($aTemp5, '[' & _ArrayToString($aTemp6, ',', 1) & ']')
									Next
									_ArrayAdd($aTemp4, '[' & _ArrayToString($aTemp5, ',', 1) & ']')
								Next
								_ArrayAdd($aTemp3, '[' & _ArrayToString($aTemp4, ',', 1) & ']')
							Next
							_ArrayAdd($aTemp2, '[' & _ArrayToString($aTemp3, ',', 1) & ']')
						Next
						_ArrayAdd($aTemp1, '[' & _ArrayToString($aTemp2, ',', 1) & ']')
					Next
					_ArrayAdd($aTemp0, '[' & _ArrayToString($aTemp1, ',', 1) & ']')
				Next
				Return __return__code_array($aDim, $VAR, $aTemp0)
			Case Else
				Return SetError(1, 0, 0)
		EndSwitch
	Else
		If IsObj($VAR) Then
			Local $aTemp[1]
			Local $oKeys = $VAR.Keys
			If UBound($oKeys) == 0 Then Return SetError(1, 0, 0)
			For $ii = 0 To UBound($oKeys, 1) - 1
				Local $key = code($oKeys[$ii], 1)
				If @error Then Return SetError(1, 0, 0)
				Local $value = $VAR.Item($oKeys[$ii])
				If ($value == '') Or Not $value Then
					$value = '0s'
				Else
					$value = code($value)
				EndIf
				If @error Then Return SetError(1, 0, 0)
				_ArrayAdd($aTemp, $key & ':' & $value)
			Next
			$VAR = 'o{' & _ArrayToString($aTemp, ',', 1) & '}'
			Return StringLen($VAR) & $VAR
		Else
;~ 			ConsoleWrite('code.var[' & $VAR & '] type[' & VarGetType($VAR) & ']' & @LF)
			Local $lenght
			Switch VarGetType($VAR)
				Case 'Bool'
					$VAR = '2|' & ($VAR == True ? '1B' : '1b')
				Case 'Keyword'
					Switch $VAR
						Case Null
							$VAR = '1n'
						Case Default
							$VAR = '1d'
						Case Else
							$VAR = '1k'
					EndSwitch
				Case 'Int32'
					If $VAR == 0 Then
						$VAR = '0i'
					Else
						$lenght = StringLen($VAR)
						If $VAR > 0 Then
							$VAR = $lenght & 'I' & $VAR
						Else
							$VAR = ($lenght - 1) & 'i' & (-1 * $VAR)
						EndIf
					EndIf
					$VAR = StringReplace($VAR, '.', '_')
				Case 'Int64'
					If $VAR == 0 Then
						$VAR = '0y'
					Else
						$lenght = StringLen($VAR)
						If $VAR > 0 Then
							$VAR = $lenght & 'Y' & $VAR
						Else
							$VAR = ($lenght - 1) & 'y' & (-1 * $VAR)
						EndIf
					EndIf
					$VAR = StringReplace($VAR, '.', '_')
				Case 'Double'
					If $VAR == 0 Then
						$VAR = '0f'
					Else
						$lenght = StringLen($VAR)
						If $VAR > 0 Then
							$VAR = $lenght & 'F' & $VAR
						Else
							$VAR = ($lenght - 1) & 'f' & (-1 * $VAR)
						EndIf
					EndIf
					$VAR = StringReplace($VAR, '.', '_')
				Case 'String'
;~ 					ConsoleWrite('String[ ' & $VAR & ' ] IsString[ ' & IsString($VAR) & ' ] IsNull[ ' & ($VAR == '' ? 'Null' : 'NotNull') & ' ]' & @LF)
					If StringLen($VAR) Then
						$VAR = __code($VAR)
						$VAR = StringLen($VAR) & 's' & $VAR
					Else
						$VAR = '0s'
					EndIf
				Case Else
					$VAR = 'eNoType_' & VarGetType($VAR)
					$VAR = StringLen($VAR) & $VAR
			EndSwitch
			Return $VAR
		EndIf
	EndIf
EndFunc   ;==>code

Func __code($VAR)
	; internal function
;~ 	ConsoleWrite('__code( ' & $VAR & ' )' & @LF)
	Local $temp
	$VAR = StringSplit($VAR, '', 2)
	For $ii = 0 To UBound($VAR) - 1
;~ 		ConsoleWrite(AscW($VAR[$ii]) & ' ')
		If StringRegExp($VAR[$ii], '[a-zA-Z0-9_]') Then
			$temp &= $VAR[$ii]
		Else
			$temp &= __code_num($VAR[$ii])
		EndIf
	Next
;~ 	ConsoleWrite(@LF)
	Return $temp
EndFunc   ;==>__code

Func __code_num($VAR)
	; internal function
	; PHP
	If $VAR == '' Then Return SetError(1, 0, 0)
	Local $aPos[4] = ['^', '~', '`', '´']
	Local $pos = 0
	$VAR = Hex(AscW($VAR))
	Do
		$pos += 1
	Until Not (StringMid($VAR, $pos, 1) == 0)
	$VAR = StringTrimLeft($VAR, $pos - 1)
	Return $aPos[StringLen($VAR) - 1] & $VAR
EndFunc   ;==>__code_num

Func __return__code_array($aDim, $VAR, $aTemp0)
	; internal function
	$VAR = 'a' & $aDim & '[' & _ArrayToString($aTemp0, ',', 1) & ']'
	Return StringLen($VAR) & $VAR
EndFunc   ;==>__return__code_array

Func __decode($VAR)
	; internal function
	$VAR = StringSplit($VAR, '', 2)
	Local $arr[4] = ['^', '~', '`', '´']
	Local $return, $ignore, $pos
	For $xx = 0 To UBound($VAR) - 1
		$pos = _ArraySearch($arr, $VAR[$xx])
		If $pos >= 0 Then
			Local $wer = ''
			$ignore = $pos + 1
			For $yy = $xx + 1 To $xx + $pos + 1
				$wer &= $VAR[$yy]
			Next
			$return &= ChrW(Dec($wer))
		Else
			If $ignore Then
				$ignore -= 1
			Else
				$return &= $VAR[$xx]
			EndIf
		EndIf
	Next
	Return $return
EndFunc   ;==>__decode

Func __mount_array(ByRef $aMount, $VAR)
	; internal function
	Local $arr = _StringBetween($VAR, 'a', '[')
	$arr = StringSplit($arr[0], '*', 2)
	Switch UBound($arr)
		Case 1
			ReDim $aMount[$arr[0]]
		Case 2
			ReDim $aMount[$arr[0]][$arr[1]]
		Case 3
			ReDim $aMount[$arr[0]][$arr[1]][$arr[2]]
		Case 4
			ReDim $aMount[$arr[0]][$arr[1]][$arr[2]][$arr[3]]
		Case 5
			ReDim $aMount[$arr[0]][$arr[1]][$arr[2]][$arr[3]][$arr[4]]
		Case 6
			ReDim $aMount[$arr[0]][$arr[1]][$arr[2]][$arr[3]][$arr[4]][$arr[5]]
		Case 7
			ReDim $aMount[$arr[0]][$arr[1]][$arr[2]][$arr[3]][$arr[4]][$arr[5]][$arr[6]]
		Case 8
			ReDim $aMount[$arr[0]][$arr[1]][$arr[2]][$arr[3]][$arr[4]][$arr[5]][$arr[6]][$arr[7]]
		Case 9
			ReDim $aMount[$arr[0]][$arr[1]][$arr[2]][$arr[3]][$arr[4]][$arr[5]][$arr[6]][$arr[7]][$arr[8]]
		Case 10
			ReDim $aMount[$arr[0]][$arr[1]][$arr[2]][$arr[3]][$arr[4]][$arr[5]][$arr[6]][$arr[7]][$arr[8]][$arr[9]]
		Case Else
			Return SetError(1, 0, 0)
	EndSwitch
EndFunc   ;==>__mount_array

Func __clean_var(ByRef $VAR, $type = 0)
	; internal function, VOID
	; PHP
	Local $tag = ($type == 0 ? '[' : '{')
	Local $first = StringInStr($VAR, $tag)
	$VAR = StringTrimRight($VAR, 1)
	$VAR = StringMid($VAR, $first + 1)
EndFunc   ;==>__clean_var

Func __lenght($input)
	; internal function
	; PHP
	Local $iLenght = 0
	While StringRegExp(StringMid($input, $iLenght + 1, 1), '[0-9]')
		$iLenght += 1
	WEnd
	Return $iLenght
EndFunc   ;==>__lenght

Func __mount_next_cell(ByRef $VAR)
	; internal function
	While Not StringRegExp(StringMid($VAR, 1, 1), '[0-9]')
		$VAR = StringTrimLeft($VAR, 1)
	WEnd
	Local $iLenght = __lenght($VAR)
	Local $iSize = StringLeft($VAR, $iLenght)
	Local $sType = StringMid($VAR, $iLenght + 1, 1)
	Local $cell = StringMid($VAR, 1, $iSize + $iLenght + 1)
	$VAR = StringTrimLeft($VAR, StringLen($cell))
	While StringInStr(StringMid($VAR, 1, 1), ',')
		$VAR = StringTrimLeft($VAR, 1)
	WEnd
	Return decode($cell)
EndFunc   ;==>__mount_next_cell

error: pathspec 'FRED/FRED.au3' did not match any file(s) known to git


Create Exemplo_001.au3

Create Exemplo_001.au3

#include-once
#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <GuiTreeView.au3>
#include <TreeViewConstants.au3>
#include <GuiMenu.au3>
#include <WinAPI.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>

#include <GUICreateEx.au3>
#include <JSMN.au3>
#include <object_dump.au3>

#cs
	Exemplo de uso com TreeView
	Implementando/refatorando código...

	Autor: Luismar Chechelaky
#ce

Opt("GUIOnEventMode", 1)
Opt("GUIEventOptions", 1)
Opt("MustDeclareVars", 1)

OnAutoItExitRegister("OnExit")

HotKeySet("{F2}", "Key_Edit_Start")

Global $KEY_EDIT = False

Global $ID = 0

Global Const $SQLITE_DLL = _SQLite_Startup("sqlite3.dll", False, 0)
Global $DB = _SQLite_Open("base.db", $SQLITE_OPEN_READWRITE + $SQLITE_OPEN_CREATE, $SQLITE_ENCODING_UTF8)
Global $SQL

Global $hGui, $hTreeView, $Context, $hMenu
Global Enum $ONE = 0, $TWO, $TREE
Global $aName[3] = ["A", "B", "C"]
Global $a_TreeView[3]
Global $ah_TreeView[3]
Global $hTreeView_Focus, $TreeView_ID
Global $hTreeView_Focus_Item_Handle, $hTreeView_Focus_Item_Text, $hTreeView_Focus_Item_Param
Global $hLable_TreeView_Focus_Handle, $hLabel_TreeView_Focus_Text, $hLabel_TreeView_Focus_Param

Global $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

$hGui = GUICreateEx("TreeView", 1266, 668); , 550, 0)
_GUICreateEx_SetShortCut("KEY_EDIT", "Key_Edit_End")

$a_TreeView[$ONE] = _GUICtrlTreeView_Create($hGui, 10, 10, 300, 450, $iStyle, $WS_EX_CLIENTEDGE)
$ah_TreeView[$ONE] = ControlGetHandle($hGui, "", $a_TreeView[$ONE])

$a_TreeView[$TWO] = _GUICtrlTreeView_Create($hGui, 10 + 410, 10, 300, 450, $iStyle, $WS_EX_CLIENTEDGE)
$ah_TreeView[$TWO] = ControlGetHandle($hGui, "", $a_TreeView[$TWO])

$a_TreeView[$TREE] = _GUICtrlTreeView_Create($hGui, 10 + 820, 10, 300, 450, $iStyle, $WS_EX_CLIENTEDGE)
$ah_TreeView[$TREE] = ControlGetHandle($hGui, "", $a_TreeView[$TREE])

$hLable_TreeView_Focus_Handle = GUICtrlCreateLabel("", 10, 470, 80, 20, $SS_SUNKEN)
$hLabel_TreeView_Focus_Text = GUICtrlCreateLabel("", 10, 500, 80, 20, $SS_SUNKEN)
$hLabel_TreeView_Focus_Param = GUICtrlCreateLabel("", 10, 530, 80, 20, $SS_SUNKEN)

Global $hParent, $hItem

For $ii = 0 To 2
	$ID += 1
	_GUICtrlTreeView_BeginUpdate($a_TreeView[$ii])
	$hParent = _GUICtrlTreeView_Add($a_TreeView[$ii], 0, "root")
	_GUICtrlTreeView_SetItemParam($a_TreeView[$ii], $hParent, $ID)
	For $jj = 0 To 9
		$ID += 1
		$hItem = _GUICtrlTreeView_AddChild($a_TreeView[$ii], $hParent, $aName[$ii] & $jj)
		_GUICtrlTreeView_SetItemParam($a_TreeView[$ii], $hItem, $ID)
		_GUICtrlTreeView_Expand($a_TreeView[$ii], $hItem)
	Next
	_GUICtrlTreeView_EndUpdate($a_TreeView[$ii])
Next

Global $aButtons[4] = [3, 0, 0, 0]

Global $iDummy = GUICtrlCreateDummy()
$Context = GUICtrlCreateContextMenu($iDummy)
$hMenu = GUICtrlGetHandle($Context)
$aButtons[1] = GUICtrlCreateMenuItem("Add", $Context)
GUICtrlSetOnEvent($aButtons[1], "Add")
$aButtons[2] = GUICtrlCreateMenuItem("Rename", $Context)
GUICtrlSetOnEvent($aButtons[2], "Rename")
$aButtons[3] = GUICtrlCreateMenuItem("Del", $Context)
GUICtrlSetOnEvent($aButtons[3], "Del")

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUISetState(@SW_SHOW, $hGui)

While Sleep(20)

WEnd

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........:	OnExit
; Author ........:	Luismar Chechelaky
; Modified.......:	2016/08/21 17:00
; Link ..........:
; ===============================================================================================================================
Func OnExit()
	_SQLite_Shutdown()
EndFunc   ;==>OnExit

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........:	Key_Edit_Start
; Author ........:	Luismar Chechelaky
; Modified.......:	2016/08/21 17:00
; Link ..........:
; ===============================================================================================================================
Func Key_Edit_Start()
	ConsoleWrite("Key_Edit_Start()" & @LF)
	$hItem = _GUICtrlTreeView_GetSelection($hTreeView_Focus)
	$KEY_EDIT = True
	HotKeySet("{ENTER}", "Key_Edit_Confirm")

	_GUICtrlTreeView_EditText($hTreeView_Focus, $hItem)
EndFunc   ;==>Key_Edit_Start

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........:	Key_Edit_End
; Author ........:	Luismar Chechelaky
; Modified.......:	2016/08/21 17:00
; Link ..........:
; ===============================================================================================================================
Func Key_Edit_End()
	ConsoleWrite("Key_Edit_End()" & @LF)
	HotKeySet("{ENTER}")
	$KEY_EDIT = False
	_GUICtrlTreeView_EndEdit($hTreeView_Focus)
EndFunc   ;==>Key_Edit_End

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........:	Key_Edit_Confirm
; Author ........:	Luismar Chechelaky
; Modified.......:	2016/08/21 17:00
; Link ..........:
; source.........: http://azjio.narod.ru/autoit3_docs/libfunctions/_guictrltreeview_endedit.htm
; ===============================================================================================================================
Func Key_Edit_Confirm()
	Local $hFocus = _GUICtrlTreeView_GetSelection($hTreeView_Focus)
	Local $hEdit = _GUICtrlTreeView_GetEditControl($hTreeView_Focus)
	_GUICtrlTreeView_SetText($hTreeView_Focus, $hItem, ControlGetText($hGui, "", $hEdit))
	HotKeySet("{ENTER}")
	$KEY_EDIT = False
	_GUICtrlTreeView_EndEdit($hTreeView_Focus)
EndFunc   ;==>Key_Edit_Confirm

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........:	Add
; Author ........:	Luismar Chechelaky
; Modified.......:	2016/08/21 17:00
; Link ..........:
; ===============================================================================================================================
Func Add()
	ConsoleWrite("Add" & @LF)

	$ID += 1
	Local $h_Item
	$hItem = _GUICtrlTreeView_GetSelection($hTreeView_Focus)
	If $hItem = 0x00000000 Then
		$h_Item = _GUICtrlTreeView_AddChildFirst($hTreeView_Focus, $hItem, $aName[$TreeView_ID] & $ID)
	Else
		$h_Item = _GUICtrlTreeView_AddChild($hTreeView_Focus, $hItem, $aName[$TreeView_ID] & $ID)
	EndIf
	ConsoleWrite("$hTreeView[ " & $hTreeView_Focus & " ] $hItem[ " & $hItem & " ]" & @LF)
	Local $item = _GUICtrlTreeView_SetItemParam($hTreeView_Focus, $h_Item, $ID)
	ConsoleWrite("item[" & $item & "] $ID[ " & $ID & " ]" & @LF)

	_GUICtrlTreeView_Expand($hTreeView_Focus, $hItem)

EndFunc   ;==>Add

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........:	Rename
; Author ........:	Luismar Chechelaky
; Modified.......:	2016/08/21 17:00
; Link ..........:
; ===============================================================================================================================
Func Rename()
	ConsoleWrite("Rename" & @LF)
EndFunc   ;==>Rename

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........:	Del
; Author ........:	Luismar Chechelaky
; Modified.......:	2016/08/21 17:00
; Link ..........:
; ===============================================================================================================================
Func Del()
	ConsoleWrite("Del" & @LF)

	$hItem = _GUICtrlTreeView_GetSelection($hTreeView_Focus)
	ConsoleWrite("$hItem[ " & $hItem & " ] text[ " & _GUICtrlTreeView_GetText($hTreeView_Focus, $hItem) & " ]" & @LF)

;~ 	Local $sText = _GUICtrlTreeView_GetText($hTreeView_Focus, $hFocus)
;~ 	Local $iParam = _GUICtrlTreeView_GetItemParam($a_TreeView[$ID], $hFocus)

	Local $oo = oo()

	_DelRecursive($hItem, $oo)
	For $each In $oo
		_GUICtrlTreeView_Delete($hTreeView_Focus, $each)
	Next
	dump($oo)
EndFunc   ;==>Del

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........:	_DelRecursive
; Author ........:	Luismar Chechelaky
; Modified.......:	2016/08/21 17:00
; Link ..........:
; ===============================================================================================================================
Func _DelRecursive($handle, ByRef $oo)
	Local $sText = _GUICtrlTreeView_GetText($hTreeView_Focus, $handle)
	Local $iParam = _GUICtrlTreeView_GetItemParam($hTreeView_Focus, $handle)
	Local $oItem = oo()
	$oItem.Add("name", $sText)
	$oItem.Add("param", $iParam)
	Local $hChild
	If _GUICtrlTreeView_GetChildren($hTreeView_Focus, $handle) Then
		$hChild = _GUICtrlTreeView_GetFirstChild($hTreeView_Focus, $handle)
		Do
;~ 			If _GUICtrlTreeView_GetChildren($hTreeView_Focus, $hChild) Then
			_DelRecursive($hChild, $oo)
;~ 			EndIf
			$hChild = _GUICtrlTreeView_GetNextChild($hTreeView_Focus, $hChild)
		Until $hChild = 0
	EndIf
	$oo.Add(Number($handle), $oItem)
EndFunc   ;==>_DelRecursive

;~ Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
;~ 	Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $selitem

;~ 	$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
;~ 	$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
;~ 	$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
;~ 	$iCode = DllStructGetData($tNMHDR, "Code")
;~ 	Switch $hWndFrom
;~ 		Case $a_TreeView[$ONE]
;~ 			Switch $iCode
;~ 				Case $NM_RCLICK
;~ 					$clickPos = _WinAPI_GetMousePos(True, $hGui)
;~ 					$selitem = _GUICtrlTreeView_HitTestItem($a_TreeView[$ONE], DllStructGetData($clickPos, "X"), DllStructGetData($clickPos, "Y")-10)
;~ 					If $selitem = 0 Then Return $GUI_RUNDEFMSG
;~ 					_GUICtrlTreeView_SelectItem($a_TreeView[$ONE], $selitem)

;~ 					_GUICtrlMenu_TrackPopupMenu($hMenu, $hGui)
;~ 			EndSwitch
;~ 	EndSwitch

;~ 	Return $GUI_RUNDEFMSG
;~ EndFunc   ;==>WM_NOTIFY

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........:	_GuiCtrlTreeView_FixFocus
; Author ........:	Luismar Chechelaky
; Modified.......:	2016/08/21 17:00
; Link ..........:
; ===============================================================================================================================
Func _GuiCtrlTreeView_FixFocus($ID, $item = 0)
	ConsoleWrite("_GuiCtrlTreeView_FixFocus()" & @LF)

	Local $hFocus = $item ? $item : _GUICtrlTreeView_GetSelection($a_TreeView[$ID])
	Local $sText = _GUICtrlTreeView_GetText($a_TreeView[$ID], $hFocus)
	Local $iParam = _GUICtrlTreeView_GetItemParam($a_TreeView[$ID], $hFocus)

	GUICtrlSetData($hLable_TreeView_Focus_Handle, $aName[$ID])
	GUICtrlSetData($hLabel_TreeView_Focus_Text, $sText)
	GUICtrlSetData($hLabel_TreeView_Focus_Param, $iParam)

EndFunc   ;==>_GuiCtrlTreeView_FixFocus

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........:	_GuiCtrlTreeView_EvalAction
; Author ........:	Luismar Chechelaky
; Modified.......:	2016/08/21 17:00
; Link ..........:
; ===============================================================================================================================
Func _GuiCtrlTreeView_EvalAction($ID, $tNMHDR, $hWndFrom, $iIDFrom, $iCode, $lParam)
	$TreeView_ID = $ID
	GUICtrlSetData($hLable_TreeView_Focus_Handle, $aName[$ID])
	$hTreeView_Focus = $ah_TreeView[$ID]
	Switch $iCode
		Case $NM_CLICK ; The user has clicked the left mouse button within the control
			_DebugPrint("$NM_CLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
					"-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
					"-->Code:" & @TAB & $iCode)
			; Return 1 ; nonzero to not allow the default processing
			Return 0 ; zero to allow the default processing
		Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control
			_DebugPrint("$NM_DBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
					"-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
					"-->Code:" & @TAB & $iCode)
			; Return 1 ; nonzero to not allow the default processing
			Return 0 ; zero to allow the default processing
		Case $NM_RCLICK ; The user has clicked the right mouse button within the control
			_DebugPrint("$NM_RCLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
					"-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
					"-->Code:" & @TAB & $iCode)
			; Return 1 ; nonzero to not allow the default processing
			_GUICtrlTreeView_SelectItem($hTreeView_Focus, $hTreeView_Focus_Item_Handle)
			_GuiCtrlTreeView_FixFocus($ID, $hTreeView_Focus_Item_Handle)
			_GUICtrlMenu_TrackPopupMenu($hMenu, $hGui)
			Return 0 ; zero to allow the default processing
		Case $NM_RDBLCLK ; The user has double-clicked the right mouse button within the control
			_DebugPrint("$NM_RDBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
					"-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
					"-->Code:" & @TAB & $iCode)
			; Return 1 ; nonzero to not allow the default processing
			Return 0 ; zero to allow the default processing
		Case $NM_KILLFOCUS ; control has lost the input focus
			_DebugPrint("$NM_KILLFOCUS" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
					"-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
					"-->Code:" & @TAB & $iCode)
			; No return value
		Case $NM_RETURN ; control has the input focus and that the user has pressed the key
			_DebugPrint("$NM_RETURN" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
					"-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
					"-->Code:" & @TAB & $iCode)
			; Return 1 ; nonzero to not allow the default processing
			Return 0 ; zero to allow the default processing
		Case $NM_SETCURSOR ; control is setting the cursor in response to a WM_SETCURSOR message
			Local $tInfo = DllStructCreate($tagNMMOUSE, $lParam)
			$hWndFrom = HWnd(DllStructGetData($tInfo, "hWndFrom"))
			$iIDFrom = DllStructGetData($tInfo, "IDFrom")
			$iCode = DllStructGetData($tInfo, "Code")

			$hTreeView_Focus_Item_Handle = DllStructGetData($tInfo, "ItemSpec")
			$hTreeView_Focus_Item_Text = _GUICtrlTreeView_GetText($hTreeView_Focus, $hTreeView_Focus_Item_Handle)
			$hTreeView_Focus_Item_Param = _GUICtrlTreeView_GetItemParam($hTreeView_Focus, $hTreeView_Focus_Item_Handle)

			_DebugPrint("$NM_SETCURSOR" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
					"-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
					"-->Code:" & @TAB & $iCode & @CRLF & _
					"-->ItemSpec:" & @TAB & DllStructGetData($tInfo, "ItemSpec") & @CRLF & _
					"-->ItemData:" & @TAB & DllStructGetData($tInfo, "ItemData") & @CRLF & _
					"-->X:" & @TAB & DllStructGetData($tInfo, "X") & @CRLF & _
					"-->Y:" & @TAB & DllStructGetData($tInfo, "Y") & @CRLF & _
					"-->HitInfo:" & @TAB & DllStructGetData($tInfo, "HitInfo"))
			; Return 0 ; to enable the control to set the cursor
			Return 1 ; nonzero to prevent the control from setting the cursor
		Case $NM_SETFOCUS ; control has received the input focus
			_DebugPrint("$NM_SETFOCUS" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
					"-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
					"-->Code:" & @TAB & $iCode)
			; No return value
		Case $TVN_BEGINDRAGA, $TVN_BEGINDRAGW
			_DebugPrint("$TVN_BEGINDRAG")
		Case $TVN_BEGINLABELEDITA, $TVN_BEGINLABELEDITW
			_DebugPrint("$TVN_BEGINLABELEDIT")
		Case $TVN_BEGINRDRAGA, $TVN_BEGINRDRAGW
			_DebugPrint("$TVN_BEGINRDRAG")
		Case $TVN_DELETEITEMA, $TVN_DELETEITEMW
			_DebugPrint("$TVN_DELETEITEM")
		Case $TVN_ENDLABELEDITA, $TVN_ENDLABELEDITW

			ConsoleWrite("Edit Control Handle: 0x" & Hex(_GUICtrlTreeView_GetEditControl($hTreeView_Focus)) & @CRLF & _
					"IsPtr = " & IsPtr(_GUICtrlTreeView_GetEditControl($hTreeView_Focus)) & " IsHWnd = " & IsHWnd(_GUICtrlTreeView_GetEditControl($hTreeView_Focus)))

			Local $tInfo = DllStructCreate($tagNMTVDISPINFO, $lParam)
			Local $sBuffer = DllStructCreate("wchar Text[" & DllStructGetData($tInfo, "TextMax"))
			ConsoleWrite("$sBuffer[ " & $sBuffer & " ]" & @LF)
			If Not _GUICtrlTreeView_GetUnicodeFormat($hWndFrom) Then $sBuffer = StringTrimLeft($sBuffer, 1)
			ConsoleWrite("$sBuffer[ " & $sBuffer & " ]" & @LF)
			DllStructSetData($sBuffer, "Text", DllStructGetData($tInfo, "Text"))

			If StringLen(DllStructGetData($sBuffer, "Text")) Then Return 1

			_DebugPrint("$TVN_ENDLABELEDIT $sBuffer[ " & $sBuffer & " ]")
		Case $TVN_GETDISPINFOA, $TVN_GETDISPINFOW
			_DebugPrint("$TVN_GETDISPINFO")
		Case $TVN_GETINFOTIPA, $TVN_GETINFOTIPW
			_DebugPrint("$TVN_GETINFOTIP")
		Case $TVN_ITEMEXPANDEDA, $TVN_ITEMEXPANDEDW
			_DebugPrint("$TVN_ITEMEXPANDED")
		Case $TVN_ITEMEXPANDINGA, $TVN_ITEMEXPANDINGW
			_DebugPrint("$TVN_ITEMEXPANDING")
		Case $TVN_KEYDOWN
			_DebugPrint("$TVN_KEYDOWN")
		Case $TVN_SELCHANGEDA, $TVN_SELCHANGEDW
			_GuiCtrlTreeView_FixFocus($ID)
			_DebugPrint("$TVN_SELCHANGED")
		Case $TVN_SELCHANGINGA, $TVN_SELCHANGINGW
			_DebugPrint("$TVN_SELCHANGING")
		Case $TVN_SETDISPINFOA, $TVN_SETDISPINFOW
			_DebugPrint("$TVN_SETDISPINFO")
		Case $TVN_SINGLEEXPAND
			_DebugPrint("$TVN_SINGLEEXPAND")
	EndSwitch
EndFunc   ;==>_GuiCtrlTreeView_EvalAction

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........:
; Author ........:
; Modified.......:
; Link ..........:
; ===============================================================================================================================
Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
	#forceref $hWnd, $iMsg, $lParam
	Local $tNMHDR, $hWndFrom, $iIDFrom, $iCode

	$tNMHDR = DllStructCreate($tagNMHDR, $lParam)
	$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
	$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
	$iCode = DllStructGetData($tNMHDR, "Code")
	Switch $hWndFrom
		Case $ah_TreeView[$ONE]
			_GuiCtrlTreeView_EvalAction($ONE, $tNMHDR, $hWndFrom, $iIDFrom, $iCode, $lParam)
		Case $ah_TreeView[$TWO]
			_GuiCtrlTreeView_EvalAction($TWO, $tNMHDR, $hWndFrom, $iIDFrom, $iCode, $lParam)
		Case $ah_TreeView[$TREE]
			_GuiCtrlTreeView_EvalAction($TREE, $tNMHDR, $hWndFrom, $iIDFrom, $iCode, $lParam)
	EndSwitch
	Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........:	_DebugPrint
; Author ........:
; Modified.......:	2
; Link ..........:
; ===============================================================================================================================
Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber)
	Return
	ConsoleWrite( _
			"!===========================================================" & @CRLF & _
			"+======================================================" & @CRLF & _
			"-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _
			"+======================================================" & @CRLF)
EndFunc   ;==>_DebugPrint

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........:	oo
; Author ........:	Luismar Chechelaky
; Modified.......:	2016/08/21 17:00
; Link ..........:
; ===============================================================================================================================
Func oo()
	Return ObjCreate($SD)
EndFunc   ;==>oo

error: pathspec 'TreeView/Exemplo_001.au3' did not match any file(s) known to git


Added a deployment test script

Added a deployment test script

; ****** REMEMBER TO SWITCH OFF UAC ON TARGET MACHINE!!! *********
;
; This script will install, run and uninstall SasView
; given location of the installer. The exit code of the script
; points at failure location:
;
; 0 - OK
; 1 - Installer failure
; 2 - Problems running SasView (simple fitting)
; 3 - Uninstaller failure

#include <Constants.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>

; Custom error handler
;Global $oMyError = ObjEvent("AutoIt.Error","MyErrFunc")

; Modifiable globals
Global $fInstallerLocation = "C:\util\setupSasView.exe"
Global $lTimeout = 10          ; 10 sec timeout for waiting on windows
Global $lInstallTimeout = 120  ; 2 min timeout for the installation process

; General globals
Global $installerPID = 0

;; MAIN SCRIPT
Install()
RunSasView()
Uninstall()
Exit(0)

;==============================================================
Func Install()
   ;;;;; APPLICATION INSTALLED ;;;;;;;
   Local $sSetupWindow = "Setup - SasView"

   ; Run setup
   if FileExists($fInstallerLocation) Then
	  $installerPID = Run($fInstallerLocation)
	  Assert($installerPID, 1)
	  Sleep(1000)
   Else
	  ;$Error = ObjEvent(AutoIt.Error, "Setup file does not exist","123")
	  Exit(1)
   EndIf

   ; License click through
   Local $test = WinWaitActive($sSetupWindow, "License Agreement", $lTimeout)
   ;ConsoleWrite("license agreement: " & $test)
   Assert($test, 1)
   sleep(1000)

   Send("{TAB}{up}{ENTER}")

   ; Location
   Sleep(1000)
   $test = WinWaitActive($sSetupWindow, "Select Destination Location", $lTimeout)
   Assert($test, 1)
   Send("{ENTER}")

   ; Icons, Startup entry
   Sleep(1000)
   $test = WinWaitActive($sSetupWindow, "Select Additional Tasks", $lTimeout)
   Assert($test, 1)
   Send("{ENTER}")

   ; Ready to install...
   Sleep(1000)
   $test = WinWaitActive($sSetupWindow, "Ready to Install", $lTimeout)
   Assert($test, 1)
   Send("{ENTER}")

   ; Final OK on running
   Sleep(5000)
   $test = WinWaitActive($sSetupWindow, "Completing the SasView Setup Wizard", $lInstallTimeout)
   Assert($test, 1)
   Send("{ENTER}")
   ;ConsoleWrite("Installed" & @CRLF)

EndFunc

Func RunSasView()
   ;;;;; APPLICATION STARTED ;;;;;;;
   ; Start app - DEBUG ONLY
   ;;Run("C:\Program Files (x86)\SasView\SasView.exe")

   ; Wait for the window
   Sleep(1000)
   Local $hWnd = WinWaitActive("SasView  - Fitting -", "", $lTimeout)
   Assert($hWnd, 2)

   ;;;;; Load a File
   ; Open File Load dialog
   Send("!{f}{ENTER}")
   WinWaitActive("Choose a file", "", $lTimeout)
   Assert($hWnd, 2)
   Sleep(200)

   ; Focus is in file chooser - enter filename
   Send("C:\Program Files (x86)\SasView\test\1d_data\cyl_400_20.txt")
   Sleep(1000)
   Send("{ENTER}")

   ;; Send file to fitting
   ControlClick($hWnd, "Send To", 231)

   ;; Choose a model
   ControlCommand($hWnd, "", "ComboBox3", "SetCurrentSelection", 1)

   ;; Calculate the model
   ControlClick($hWnd, "Compute", 211)

   ;; Close SasView
   WinClose($hWnd)

   Local $hEnd = WinWaitActive("Confirm Exit", "", $lTimeout)
   Assert($hEnd, 2)
   ControlClick($hEnd, "", "[CLASS:Button; INSTANCE:1]")

   Local $sv_closed = WinWaitClose($hWnd, "", $lTimeout)
   Assert($sv_closed, 2)

EndFunc

Func Uninstall()
;;;;; UNINSTALL ;;;;;;;
   $installerPID = Run("C:\Program Files (x86)\SasView\unins000.exe")

   Local $sSetupWindow = "SasView Uninstall"

   Local $test = WinWaitActive($sSetupWindow, "", $lTimeout)
   Assert($test, 3)
   Send("{TAB}{ENTER}")

   WinActivate("SasView Uninstal")
   $test = WinWaitActive($sSetupWindow, "SasView was successfully removed", $lTimeout)
   Assert($test, 3)
   Send("{ENTER}")

EndFunc

;;; HELPER FUNCTIONS ;;;;
Func Assert($test, $lExitValue)
   ;;; Asserts $test to be non-zero and exit with code $lExitValue ;;;
   if $test == 0 Then
	  ProcessClose($installerPID)
	  Exit($lExitValue)
   EndIf
EndFunc

error: pathspec 'build_tools/sasview_deploy_test.au3' did not match any file(s) known to git