UDF json parser

UDF json parser

; This JSON/JSONPath UDF Uses the windows scripting object (instead of IE's JSON object as previously.)
; IE free version - as the IE version broke with IE11 update last 2014.
;  Added to scripting object ('polyfilled'  )
; 	-  JSON.stringify  or JSON.parse
;   -  JSONPath
;   -  Array and Object function needed for autoit to access Javascript/JSON Objects
;
; This UDF JSON.Parse - Does not use Eval to evaluate JSON.
; implementes JSON2, jsonpath-0.8.0
; You can easily change the JSON or JSONpath implementations by changing the javascript import file .

; This framework is to add OO and JSON to AutoIT
; 		- build any JSON structure using IE JSON all accessable through OO Dot syntax..
; see exmample file
;  		- use JSON strings to build objects
;		- use OO dot sysntax
;    	- add properties, methods to objects (OO)
;    	- have object arrays eg. $jsObj.array.length no more $obj[0]
;		- key values objects
; 		- access javascript objects and methods
; 		- call javascript functions from autoit
; 		- AutoIt Native JSON (no need for a JSON.UDF parser)
;		- Use javascript knowledge in AutoIt
;
;
; 	- Performance may be an issue (as its in javascript)
;   - ALL methods CASE SENSITIVE!
;

; Add methods 'item' to access array items via dot syntax.
; eg. you can't go $jsObj.array[0] in AutoIt, this frameworks lets you go $jsObj.array.item(0)
; - see example file
;

$json_text = _OO_JSON_Read_File("resources/json2.txt")

$jsonPath_text = _OO_JSON_Read_File("resources/jsonpath-0.8.0.js")

$Objectkeys_polyfill_text = _OO_JSON_Read_File("resources/Keys_polyfill.txt") ; scripting object dosen't have a keys function.

func _OO_JSON_Read_File($filename = "jsonpath-0.8.0.js")
   ;
   ; retruns a files text - you could  use it to read a JSON file into a variable.
   ; eg.
   ; $oJSON = _OO_JSON_Init()
   ; $var = _OO_JSON_Read_File("jsondata.txt")
   ; $obj = $oJSON.parse($var)

   Local $file = FileOpen($filename, 0)
   ;Local $file = FileOpen("mytest.js", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file1. "&$filename)
    Exit
 EndIf

 ; Read in 1 character at a time until the EOF is reached
;While 1
    Local $chars = FileRead($file ) ; , 1)
    ;If @error = -1 Then ExitLoop
    ;MsgBox(0, "Char read:", $chars)
;WEnd
;ConsoleWrite(""  & $chars &  @CR )
FileClose($file)
return $chars

EndFunc

; poly fill the scripting object to give us JSON, JSONpath and Keys and useful functions for access JS objects in autoit..
$JSON_COM_extentions = 	""  & _
      $Objectkeys_polyfill_text & _
	  " Object.prototype.objGet  		=function( s ) { return eval(s) }                ;  REM = ""To get an obj $obj.objGet('JSON')  ""; " & _
	  " Array.prototype.item            =function( i ) { return this[i] }                ;  REM = ' so that arrays can work in AutoIT obj.item(0)' ; " & _
	  " Object.prototype.item           =function( i ) { return this[i] }                ;  REM = ""so that dynamic key values be obtained eg. obj.item('name' ) or just obj.surname ""; " & _
	  " Object.prototype.keys    		=function(   ) { if (typeof this == 'object') { return Object.keys(this);}   }       ;  REM = ""To get an obj json properties ""; " & _
	  " Object.prototype.keys    		=function( o ) { if (typeof o == 'object') { return Object.keys(o);}   }             ;  REM = ""To get an obj json properties  - recommended usage ""; " & _
 	  " Object.prototype.arrayAdd 		=function(  i, o ) { this[i] = o; };  ;  REM = ""Add item to array  ""; " & _
	  " Object.prototype.arrayDel 		=function(  i ) { this.splice(i,1); };  ;  REM = ""Del item to array  ""; " & _
	  " Object.prototype.isArray     	=function(   ) { return this.constructor == Array;    }   ;  REM = ""Is object an array  ""; " & _
	  " Object.prototype.type    	    =function(   ) { return typeof(this);  }         ;  REM = ""To get an obj type - not recommended ""; "  & _
	  " Object.prototype.type 		   	=function( o ) { return typeof(o);  }            ;  REM = ""To get an obj type - recommended usage ""; "

	$JSON_path_framework = "" & _
	  " var JSON = new Object(); JSON.jsonPath = function( obj,expr, arg) { return jsonPath(obj,expr, arg) };  " & _
	  $jsonPath_text

	$JSON_framework = "" & _
		  $json_text & _
	  " Object.prototype.stringify    	=function(   ) { return JSON.stringify(this) }   ;  REM = ""Print out an object  ""; " & _
 	  " Object.prototype.parse    		=function( s ) { return JSON.parse(s) }          ;  REM = ""JSON String to object  ""; "  & _
	  " Object.prototype.jsonPath    	=function(  expr, arg ) { return JSON.jsonPath(this, expr, arg) }   ;  REM = ""Query object  ""; "  & _
	  " Object.prototype.objToString    =function(   ) { return JSON.stringify(this) }   ;  REM = ""Print out an object  - depreciated ""; " & _
 	  " Object.prototype.strToObject    =function( s ) { return JSON.parse(s) }          ;  REM = ""JSON String to object - deprecciated ""; "

$JSON_COM_extentions  = $JSON_COM_extentions  & $JSON_path_framework & $JSON_framework

; build Objects in AUTO IT!
$OO_extra = "" & _
	  " Object.prototype.propAdd =function(prop, val ) { eval('this.' + prop + '=' + val )   } ; " & _
	  " Object.prototype.methAdd =function(meth, def ) { eval('this.' + meth + '= new ' + def )   } ; "

; extend javascript within AutoIT! Add a method to all objects
$OO_extend_framework = 	"" & _
" Object.prototype.protoAdd 		=function( methName, jsFunction , objectTypeName) { objectTypeName = objectTypeName || 'Object'; eval( objectTypeName + '.prototype.' +  methName + '=' + jsFunction )}; "

; methods to  add native JS functions like 'URIencode'
$OO_js_native = "" & _
	  " Object.prototype.jsFunAdd =function( funname , numParams , objectTypeName ) { " & _
			" var x = buildParamlist (numParams)  ;  objectTypeName = objectTypeName || 'Object'; " & _
	        " return eval(objectTypeName + '.prototype.' + funname + ' = function(' + x + ') { return ' + funname + '(' + x + '); }'  )  } ; "  & _
	  " function buildParamlist (numParams)   { " & _
			" var x = ' p0' ; numParams = numParams || 1 ;  " & _
			" for (var i=1; i< numParams; i++) { x=  x + ' , ' + 'p'  + i ;  } ; "  & _
			" return x; } ;"

; Strings and Numbers
; This is only useful if you want to access Javascript string and number functions.
$LiteralObj = "" & _
	  "Object.prototype.dot =function( str, jsStrFun ) { if ( typeof str == 'string' )  { return eval( '""'+  protectDoubleQuotes (str)  + '"".' + jsStrFun ) } else  { return eval( ''+  str  + '.' + jsStrFun ) }  } ; " & _
	  "function oLiteral (literal) { " & _
	  "  this.literal  = literal; " & _
      "} " & _
	  "function protectDoubleQuotes (str)   { " & _
			" return str.replace(/\\/g, '\\\\').replace(/""/g,'\\""');   " & _
			"}" & _
	  " Object.prototype.toObj =function( literal ) { if ( typeof literal == 'string' )  { return eval( 'new oLiteral(""' + protectDoubleQuotes (literal) + '"")' ) }  else {return eval( 'new oLiteral(' + literal + ')' )} } ; "  & _
	  " Object.prototype.jsMethAdd =function( funname , numParams ) { " & _
			" var x = buildParamlist (numParams)  ;  " & _
			" return eval('oLiteral.prototype.' + funname + ' = function(' + x + ') { return this.literal.' + funname + '(' + x + '); }'  )  } ; "

global $g_OO_JSON_non_IE ; global
global $g_JS_framework ; global

; OO framework for basic OO and JSON to autoIT -
$g_JS_framework  = "" & _
	  $OO_extra & _
	  $OO_js_native & _
	  $OO_extend_framework & _
	  $JSON_COM_extentions  & _
	  $LiteralObj

	  ;	  $JSON_path_framework  & _
	  ;$JSON_framework  & _

global $g_JS_HTML ; global
$g_JS_HTML = "<!DOCTYPE html>  " & _
		 " " & _
		 " " & _
		 "

 " & _
		 		 " "

func _OO_JSON_Init ()
    ; see also _OO_JSON_custom_init
	$g_OO_JSON_non_IE = ObjCreate("ScriptControl")
	$js = $g_OO_JSON_non_IE;
    $js.language = "Jscript"

    $g_JS_framework  = "" & _
	  $OO_extra & _
	  $OO_js_native & _
	  $OO_extend_framework & _
	  $JSON_COM_extentions  & _
	  $LiteralObj

   $js.AddCode ($g_JS_framework)

   $jsObj = _JS_obj_create (  ) ; get a JS object!
   $oJSON = $jsObj.objGet("JSON") ; now we are OO!
   return $oJSON;

endfunc

func _JS_obj_create (  $def = "{}" )
   ; This used to get a handle on a Javascript object.
   ; Note, this can be used to process JSON text but is not secure. Use JSON.parse.

   ; prereq : must call _OO_JSON_Init ()
   ; usage
   ; $jsObj = _JS_obj_create ( "{ 'hello' : 'world' }" ) ;  ; Note, this is not secure. Use JSON.parse.

   ; notes
   ;$g_OO_JSON_non_IE.document.parentwindow.eval("var z "  & "= " & $def  ) ;  this dosen't work in IE10 boo! Scripting Object ok.

   $g_OO_JSON_non_IE.Eval("var z "  & "= " & $def   )
   return $g_OO_JSON_non_IE.Eval("z")
EndFunc

func _OO_JSON_Quit (  )
   ;$g_OO_JSON_non_IE = 0 this has no effect
   ; redundant
   ;_IEQuit($g_OO_JSON_non_IE)

EndFunc

;--- end of UDF

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


Create sha1.au3

Create sha1.au3

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


Create client_server.au3

Create client_server.au3

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


Create ExprSolver.au3

Create ExprSolver.au3

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


Create Real.au3

Create Real.au3

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


Create Angulos.au3

Create Angulos.au3

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


include update

include update

#include-once
   #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>

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


send telegram helper

send telegram helper

#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","")
	$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


added autoit v3

added autoit v3

MsgBox( 0, "Hello World", "Hello, world!" )
Exit

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


Create GuiCreateEx.au3

Create GuiCreateEx.au3

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


First AutoIT script (UI for Robocopy, useful for backups)

; AutoIt Version 3.0.103
; Language:       Spanish
; Author:         Javier Steinaker
; Email:          jsteinaker@gmail.com
; Date: September 10, 2015

#include <GuiConstantsEx.au3>
#include <ButtonConstants.au3>
#include <MsgBoxConstants.au3>

_Main()

Func _Main()
	Local $iMsg

	; Create the GUI window and controls
	GUICreate("Copia de archivos", 500, 200, (@DesktopWidth - 500) / 2, (@DesktopHeight - 500) / 2)
	GUICtrlCreateLabel("Origen", 30, 20, 131, 21)
	GUICtrlCreateLabel("Destino", 30, 50, 131, 21)
	$txtOrigin = GUiCtrlCreateEdit("", 80, 20, 300, 21)
	$txtDestination = GUiCtrlCreateEdit("", 80, 50, 300, 21)
	$broken = GUICtrlCreateCheckbox("Saltar archivos daados", 30, 80, 131, 21)
	$overwrite = GUICtrlCreateCheckbox("No sobreescribir archivos existentes", 30, 102, 190, 21)
	$selectOrigin = GUICtrlCreateButton("...", 390, 20, 21, 21)
	$selectDestination = GUICtrlCreateButton("...", 390, 50, 21, 21)
	$startCopy = GUICtrlCreateButton("Iniciar copia", 420, 20, 60, 51, $BS_MULTILINE)
	GuiCtrlCreateLabel("Lnea de comandos:", 30, 130, 131, 21)
	$commandLine = GUICtrlCreateLabel("", 170, 130, 300, 42)
	$about = GuiCtrlCreateButton("Acerca de...", 30, 160, 80, 21)

	; Run the GUI until it is closed
	GUISetState()
	While 1
		$iMsg = GUIGetMsg()
		Select
			Case $iMsg = $GUI_EVENT_CLOSE
			   ExitLoop
			Case $iMsg = $selectOrigin
			   GuiCtrlSetData($txtOrigin, FileSelectFolder("Seleccione carpeta de origen", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"))
			Case $iMsg = $selectDestination
			   GuiCtrlSetData($txtDestination, FileSelectFolder("Seleccione carpeta de destino", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"))
			Case $iMsg = $startCopy
			   $args = @ComSpec & " /k " & "robocopy /E " & Chr(34) & GuiCtrlRead($txtOrigin) & Chr(34) & " " & Chr(34) & GuiCtrlRead($txtDestination) & Chr(34) & " /eta"
			   If GuiCtrlRead($broken) = $GUI_CHECKED Then
				  $args &= " /R:0 /W:0"
			   EndIf
			   If GuiCtrlRead($overwrite) = $GUI_CHECKED Then
				  $args &= " /XO"
			   EndIf
			   GuiCtrlSetData($commandLine, $args)
			   RunWait($args)
			Case $iMsg = $about
			   MsgBox($MB_SYSTEMMODAL, "Acerca de Copia de archivos", "Copia de archivos versin 0.1" & @CRLF & "Interfaz grfica para Robocopy")
		 EndSelect
	WEnd
	Exit
 EndFunc   ;==>_Main

 Func _Copy()

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


HyperRunner

HyperRunner

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=D:\Games\HyperSpin-fe\HyperRunner.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
; Basic idea for an installer.
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <MsgBoxConstants.au3>
#include <Date.au3>
#include <File.au3>

$maxRuns = 2
$iniFile = "HyperRunner.ini"
$logFile = "HyperRunner.log.txt"

If $CmdLine[0] > 0 Then
	$iniFile = $CmdLine[1];
Endif

If Not FileExists($iniFile) Then
	MsgBox($MB_SYSTEMMODAL, "Error", $iniFile & " not found!")
	Exit
EndIf

if FileGetSize($logFile) > 1000000 Then
	FileDelete($logFile)
EndIf

myLog("----------------------------------------------------------")
myLog(_NowDate() & " " & _NowTime())
myLog("[" & $iniFile & "]")

For $i = 1 To $maxRuns Step 1
	Local $stop = IniRead($iniFile, "Stop", "Process" & $i, "")
	Local $prefix = "[Stop] Process" & $i & ": "
	If $stop <> "" Then
		If Not ProcessExists ($stop) Then
			myLog($prefix & $stop & " is not running")
		Else
			Local $result = ProcessClose($stop)
			If $result = 1 Then
				myLog($prefix & $stop & " stopped ok")
			Else
				myLog($prefix & $stop & " can't be stopped. Error: " & @error)
			EndIf
		EndIf
	EndIf
Next

For $i = 1 To $maxRuns Step 1
	Local $iniWrite = "IniWrite" & $i
	Local $file    = IniRead($iniFile, $iniWrite, "File", "")
	Local $section = IniRead($iniFile, $iniWrite, "Section", "")
	Local $key     = IniRead($iniFile, $iniWrite, "Key", "")
	Local $value   = IniRead($iniFile, $iniWrite, "Value", "")
	Local $prefix = "["& $iniWrite &"] "

	If $file <> "" And $section <> "" And $section <> "" And $section <> ""  Then
		If FileExists($file) Then
			IniWrite($file, $section, $key, $value)
			myLog($prefix & "Ini file " & $file & " updated ok:")
			myLog($prefix & "     [" & $section & "]")
			myLog($prefix & "     " & $key & "=" & $value)
		Else
			myLog($prefix & "Error: ini file not found: " & $file)
		Endif

	EndIf
Next

For $i = 1 To $maxRuns Step 1
	Local $run = IniRead($iniFile, "Run", "Cmd" & $i, "")
	Local $prefix = "[Run] Cmd" & $i & ": "
	If $run <> "" Then
		Local $pid = Run($run, "", @SW_HIDE)
		myLog($prefix & $run)
		If $pid > 0 Then
			myLog($prefix & "Pid: " & $pid)
		Else
			myLog($prefix & "Error running: " & @error)
		EndIf
	EndIf
Next

Func myLog($txt)
	Local $hFileOpen = FileOpen($logFile, $FO_APPEND)
	FileWriteLine($hFileOpen, $txt)
	FileClose($hFileOpen)
EndFunc

error: pathspec 'src/main/au3/hyperrunner/HyperRunner.au3' did not match any file(s) known to git


Create duelo.au3

Create duelo.au3

#include-once
#include <Array.au3>
#include <GUIConstantsEx.au3>
;~ Autor: José Henrique Dometerco
;~ Adaptação para AutoIt: Luismar Chechelaky (Luigi)

Global $aListaPodres[][3] = [ _
		["coelhada", 10, 30], _
		["peido", 2, 8], _
		["rugido de fome", 3, 6], _
		["suvacada", 8, 15], _
		["arroto", 11, 18], _
		["super bafo", 14, 19], _
		["super meleca", 1, 30], _
		["soprada congelante", 4, 9], _
		["desodorante do boticário", 12, 22], _
		["lux luxo", 1, 3], _
		["gargalhada fatal", 10, 20] _
		]

Global Enum $VILAO = -1, $PESSOA = 0, $HEROI = 1
Global Enum $NOME = 0, $TIPO, $VITORIAS, $DERROTAS, $PODERES
Global $aPessoa[1][5]
Global $aPoderes[1][4]

Global $p1 = Pessoa("Cebolinha")
Transforma($p1, Aleatorio())
ConcederPodres($p1)

Global $p2 = Pessoa("Mônica")
Transforma($p2, Aleatorio())
ConcederPodres($p2)

Global $p3 = Pessoa("Cascão")
Transforma($p3, Aleatorio())
ConcederPodres($p3)

Global $p4 = Pessoa("Magali")
Transforma($p4, Aleatorio())
ConcederPodres($p4)

Func Pessoa($NOME)
	Return _ArrayAdd2D($aPessoa, $NOME, 0, 0, 0) + 1
EndFunc   ;==>Pessoa

Func Poder($id, $NOME, $forca)
	_ArrayAdd2D($aPoderes, $id, $NOME, $forca)
EndFunc   ;==>Poder

Func ConcederPodres($id)
	If $aPessoa[$id][$TIPO] = $PESSOA Then Return
	Local $arr[1][2]
	For $ii = 0 To Random(2, 2, 1)
		Local $rnd = Random(0, UBound($aListaPodres, 1) - 1, 1)
		_ArrayAdd2D($arr, $aListaPodres[$rnd][0], Random($aListaPodres[$rnd][1], $aListaPodres[$rnd][2], 1))
	Next
	$aPessoa[$id][$PODERES] = $arr
EndFunc   ;==>ConcederPodres

Func Transforma($id, $mode)
	$aPessoa[$id][$TIPO] = $mode
	Return $mode
EndFunc   ;==>Transforma

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

Func Aleatorio()
	Local $arr[3] = [$VILAO, $PESSOA, $HEROI]
	Return $arr[Random(0, 2, 1)]
EndFunc   ;==>Aleatorio

Combate()

Func Combate()
	ConsoleWrite("Combate" & @LF)
	Local $aHerois = _ArrayFindAll($aPessoa, $HEROI, 1, Default, 0, 0, $TIPO)

	Local $aVilao = _ArrayFindAll($aPessoa, $VILAO, 1, Default, 0, 0, $TIPO)
	If UBound($aHerois, 1) >= 1 And UBound($aVilao, 1) >= 1 Then
		Local $iHeroi = $aHerois[Random(0, UBound($aHerois, 1) - 1, 1)]
		Local $aHeroiPodores = $aPessoa[$iHeroi][$PODERES]
		Local $iHeroiDano, $iHeroiDanoTotal
		Local $iVilao = $aVilao[Random(0, UBound($aVilao, 1) - 1, 1)]
		Local $iVilaoDano, $iVilaoDanoTotal
		Local $aVilaoPodores = $aPessoa[$iVilao][$PODERES]
		Local $golpe
		For $ii = 0 To 2
			$golpe = Random(1, UBound($aHeroiPodores, 1) - 1, 1)
			ConsoleWrite("[" & $aPessoa[$iHeroi][$NOME] & "] usou seu poder [" & $aHeroiPodores[$golpe][0] & "] e causou [" & $aHeroiPodores[$golpe][1] & "] de dano" & @LF)
			$iHeroiDanoTotal += $aHeroiPodores[$golpe][1]

			$golpe = Random(1, UBound($aVilaoPodores, 1) - 1, 1)
			ConsoleWrite("[" & $aPessoa[$iVilao][$NOME] & "] usou seu poder [" & $aVilaoPodores[$golpe][0] & "] e causou [" & $aVilaoPodores[$golpe][1] & "] de dano" & @LF)
			$iVilaoDanoTotal += $aVilaoPodores[$golpe][1]
		Next
		ConsoleWrite(@LF)
		If $iHeroiDanoTotal = $iVilaoDanoTotal Then
			ConsoleWrite("Houve empate entre [" & $aPessoa[$iHeroi][$NOME] & "] e [" & $aPessoa[$iVilao][$NOME] & "]" & @LF)
		Else
			If $iHeroiDanoTotal > $iVilaoDanoTotal Then
				ConsoleWrite("[" & $aPessoa[$iHeroi][$NOME] & "] venceu [" & $aPessoa[$iVilao][$NOME] & "] no duelo [" & $iHeroiDanoTotal & "] contra [" & $iVilaoDanoTotal & "]" & @LF)
			Else
				ConsoleWrite("[" & $aPessoa[$iVilao][$NOME] & "] venceu [" & $aPessoa[$iHeroi][$NOME] & "] no duelo [" & $iVilaoDanoTotal & "] contra [" & $iHeroiDanoTotal & "]" & @LF)
			EndIf
		EndIf
	Else
		ConsoleWrite("Não houve duelo" & @LF)
	EndIf
EndFunc   ;==>Combate

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


Create Master.au3

Create Master.au3

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


Create SerialInput.au3

Create SerialInput.au3

; Pseudo code for final SerialInput.au3
; Assumptions: SNs provided are correct.
;
; Read cleanedSNs.txt and store SNs
; navigate to Receiving module
; enter order # and bill of lading
; select appropriate SKU and enter quantity
; enter SNs
; check all SNs were entered
; submit

#include <IE.au3>
#include <File.au3>

HotKeySet("^{SPACE}", "abort")		; CTRL + SPACEBAR to abort.

Local $path = "Path Removed."
Local $serialArray[200]

If Not _FileReadToArray($path,$serialArray,$FRTA_COUNT + $FRTA_INTARRAYS," ") Then
        MsgBox($MB_SYSTEMMODAL,"","There was an error reading the file." & _
        	" @error: " & @error)
EndIf

Sleep (3000)

; Uncomment the appropriate For loop.

; Receiving.
;#comments-start
For $vElement In $serialArray[1]
	MouseClick("left",83,265,2)
	Send($vElement)
	MouseClick("left",25,304,1)
	Sleep(2000)
Next
;#comments-end

#comments-start
; Cycle counts:
For $vElement In $serialArray[1]
	If StringLen($vElement) > 5 Then
		MouseClick("left",71,336,2)
		Send($vElement)
		MouseClick("left",262,433,1)
		Sleep(3000)
	EndIf
Next
#comments-end

Func abort()
	Exit
EndFunc

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


Create _TimeUnix.au3

Create _TimeUnix.au3

; #FUNCTION# ====================================================================================================================
; Name...........: _TimeUnix
; Description ...: Convert a StringTime to UnixTime and UnixTime to StringTime
;				   All StringTime must be like this "yyyy/mm/dd hh:mm:ss"
; Syntax.........:
; Parameters ....: $mInput
;				   $iMode
; Return values .:
; Author ........: Luismar Chechelaky
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......:
;	exemple 1
;		Local $now = _TimeUnix()
;		$now = 1433967837
;
;	exemple 2
;		Convert a StringTime to UnixTime
;		Local $time = _TimeUnix("2015/06/10 20:21:22")
;		$time = 1433967682
;
;	exemple 3
;		Convert a UnixTime To StringTime in "yyyy/mm/dd hh:mm:ss"
;		Local $time = _TimeUnix(1433967837)
;		$time = "2015/06/10 20:23:57"
;
;	exemple 4
;		Convert a UnixTime To StringTime in "dd/mm/yyyy hh:mm:ss"
;		Local $time = _TimeUnix(1433967837, 1)
;		$time = "10/06/2015 20:23:57"
; ===============================================================================================================================
Func _TimeUnix($mInput = 0, $iMode = 0)
	Local $sRet = 0
	Local $sUnix = "1970/01/01 00:00:00"
	If $mInput = 0 Then
		$sRet = _DateDiff("s", $sUnix, _NowCalc())
	Else
		If String($mInput) == Number($mInput) Then
			$sRet = _DateAdd("s", $mInput, $sUnix)
			If $iMode Then $sRet = StringMid($sRet, 9, 2) & "/" & StringMid($sRet, 6, 2) & "/" & StringMid($sRet, 1, 4) & " " & StringMid($sRet, 12)
		Else
			$sRet = StringFormat("%014s", -_DateDiff("s", $mInput, $sUnix))
			$sRet = -_DateDiff("s", $mInput, $sUnix)
		EndIf
	EndIf
	Return $sRet
EndFunc   ;==>_TimeUnix

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


Create RecursiveRemove.au3

Create RecursiveRemove.au3

#include <Array.au3>
#include <File.au3>

; path do diretório
Global $sFolder = "E:\"

Global $sDrive, $sDir, $sFileName, $sExtension

; array de diretórios
Global $aFiles = _FileListToArrayRec($sFolder, "desktop.ini", 1, 1, 0, 2)

For $ii = 1 To $aFiles[0]
	_PathSplit($aFiles[$ii], $sDrive, $sDir, $sFileName, $sExtension)
	If StringLower($sFileName & $sExtension) == "desktop.ini" Then
		FileDelete($aFiles[$ii])
		ConsoleWrite($aFiles[$ii] & @LF)
	EndIf
Next

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


Epoch convertor , UDF addition

Epoch convertor , UDF addition

;~ ConsoleWrite("EPOCH time 1234567890 is " & _Epoch_decrypt(1234567890) & @CRLF)
;~ ConsoleWrite("Date 4712/12/31 23:59:59 is EPOCH " & _Epoch_encrypt("4712/12/31 23:59:59") & @CRLF)

	Func _EPOCH_decrypt($iEpochTime)
		 Local $iDayToAdd = Int($iEpochTime / 86400)
		 Local $iTimeVal = Mod($iEpochTime, 86400)
		 If $iTimeVal < 0 Then
			  $iDayToAdd -= 1
			  $iTimeVal += 86400
		 EndIf
		 Local $i_wFactor = Int((573371.75 + $iDayToAdd) / 36524.25)
		 Local $i_xFactor = Int($i_wFactor / 4)
		 Local $i_bFactor = 2442113 + $iDayToAdd + $i_wFactor - $i_xFactor
		 Local $i_cFactor = Int(($i_bFactor - 122.1) / 365.25)
		 Local $i_dFactor = Int(365.25 * $i_cFactor)
		 Local $i_eFactor = Int(($i_bFactor - $i_dFactor) / 30.6001)
		 Local $aDatePart[3]
		 $aDatePart[2] = $i_bFactor - $i_dFactor - Int(30.6001 * $i_eFactor)
		 $aDatePart[1] = $i_eFactor - 1 - 12 * ($i_eFactor - 2 > 11)
		 $aDatePart[0] = $i_cFactor - 4716 + ($aDatePart[1] < 3)
		 Local $aTimePart[3]
		 $aTimePart[0] = Int($iTimeVal / 3600)
		 $iTimeVal = Mod($iTimeVal, 3600)
		 $aTimePart[1] = Int($iTimeVal / 60)
		 $aTimePart[2] = Mod($iTimeVal, 60)
		 Return StringFormat("%.2d/%.2d/%.2d %.2d:%.2d:%.2d", $aDatePart[0], $aDatePart[1], $aDatePart[2], $aTimePart[0], $aTimePart[1], $aTimePart[2])
	EndFunc

	Func _Epoch_encrypt($date)
		 Local $main_split = StringSplit($date, " ")
		 If $main_split[0] - 2 Then
			  Return SetError(1, 0, "") ; invalid time format
		 EndIf
		 Local $asDatePart = StringSplit($main_split[1], "/")
		 Local $asTimePart = StringSplit($main_split[2], ":")
		 If $asDatePart[0] - 3 Or $asTimePart[0] - 3 Then
			  Return SetError(1, 0, "") ; invalid time format
		 EndIf
		 If $asDatePart[2] < 3 Then
			  $asDatePart[2] += 12
			  $asDatePart[1] -= 1
		 EndIf
		 Local $i_aFactor = Int($asDatePart[1] / 100)
		 Local $i_bFactor = Int($i_aFactor / 4)
		 Local $i_cFactor = 2 - $i_aFactor + $i_bFactor
		 Local $i_eFactor = Int(1461 * ($asDatePart[1] + 4716) / 4)
		 Local $i_fFactor = Int(153 * ($asDatePart[2] + 1) / 5)
		 Local $aDaysDiff = $i_cFactor + $asDatePart[3] + $i_eFactor + $i_fFactor - 2442112
		 Local $iTimeDiff = $asTimePart[1] * 3600 + $asTimePart[2] * 60 + $asTimePart[3]
		 Return $aDaysDiff * 86400 + $iTimeDiff
	EndFunc

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


Create EmptyRecycleBin.au3

Create EmptyRecycleBin.au3

#include <Array.au3>
#include <File.au3>

Global Const $SD = "Scripting.Dictionary"
Global $oo = ObjCreate($SD)

$oo.Add("WIN_7", ObjCreate($SD))
$oo.Item("WIN_7").Add($oo.Item("WIN_7").Count + 1, @HomeDrive & "\$RECYCLE.BIN")
$oo.Item("WIN_7").Add($oo.Item("WIN_7").Count + 1, @HomeDrive & "\Windows\Temp")
$oo.Item("WIN_7").Add($oo.Item("WIN_7").Count + 1, @HomeDrive & "\Windows\SoftwareDistribution\Download")
$oo.Item("WIN_7").Add($oo.Item("WIN_7").Count + 1, @HomeDrive & "\Users\" & @UserName & "\AppData\Local\Temp")

Switch @OSVersion
	Case "WIN_7"
		For $each In $oo.Item(@OSVersion)
			remove($oo.Item(@OSVersion).Item($each))
		Next
EndSwitch

Func remove($in)
	ConsoleWrite($in & @LF)
	Local $arr = _FileListToArrayRec($in, "*|desktop.ini", 1, 1, 1, 2)
	For $ii = 1 To UBound($arr, 1) - 1
		If FileDelete($arr[$ii]) Then
			ConsoleWrite("+" & $arr[$ii] & @LF) ; conseguiu apagar o arquivo
		Else
			ConsoleWrite("-" & $arr[$ii] & @LF) ; não conseguiu apagar o arquivo
		EndIf
	Next
EndFunc   ;==>remove

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


Create ContextMenu.au3

Create ContextMenu.au3

#include <GUIConstantsEx.au3>
#include <GuiMenu.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Global Enum $e_GuiOpen = 1000, $e_GuiSave, $e_GuiInfo, $e_TvAdd
Global $hGui, $iTreeView, $hTreeView

Example()

Func Example()
	; Create GUI
	$hGui = GUICreate("Menu", 400, 300)
	ConsoleWrite("$hGui[" & $hGui & "] IsPtr[" & IsPtr($hGui) & "]" & @LF)

	$iTreeView = GUICtrlCreateTreeView(10, 10, 120, 240)
	ConsoleWrite("$iTreeView[" & $iTreeView & "] IsPtr[" & IsPtr($iTreeView) & "]" & @LF)
	$hTreeView = GUICtrlGetHandle($iTreeView)
	ConsoleWrite("$hTreeView[" & $hTreeView & "] IsPtr[" & IsPtr($hTreeView) & "]" & @LF)
	GUISetState(@SW_SHOW)

	; Register message handlers
	GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
	GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU")

	; Loop until the user exits.
	Do
	Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

; Handle WM_COMMAND messages
Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
	#forceref $hWnd, $iMsg, $lParam
	ConsoleWrite("WM_COMMAND( $hWnd=" & $hWnd & ", $iMsg=" & $iMsg & ", $wParam=" & $wParam & ", $lParam=" & $lParam & ")" & @LF)
	Switch $wParam
		Case $e_GuiOpen
			_WinAPI_ShowMsg("Gui Open")
		Case $e_GuiSave
			_WinAPI_ShowMsg("Gui Save")
		Case $e_GuiInfo
			_WinAPI_ShowMsg("Gui Info")
		Case $e_TvAdd
			_WinAPI_ShowMsg("TreeView Add")
	EndSwitch
EndFunc   ;==>WM_COMMAND

; Handle WM_CONTEXTMENU messages
Func WM_CONTEXTMENU($hWnd, $iMsg, $wParam, $lParam)
	#forceref $hWnd, $iMsg, $lParam
	Local $hMenu = _GUICtrlMenu_CreatePopup()
	Local $iNotify = 0
	Switch $wParam
		Case $hGui
			_GUICtrlMenu_InsertMenuItem($hMenu, 0, "GUI Open", $e_GuiOpen)
			_GUICtrlMenu_InsertMenuItem($hMenu, 1, "GUI Save", $e_GuiSave)
			_GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0)
			_GUICtrlMenu_InsertMenuItem($hMenu, 3, "GUI Info", $e_GuiInfo)
			_GUICtrlMenu_TrackPopupMenu($hMenu, $wParam)
		Case $hTreeView
			_GUICtrlMenu_InsertMenuItem($hMenu, 0, "TreeView Add", $e_TvAdd)
			$iNotify = _GUICtrlMenu_TrackPopupMenu($hMenu, $wParam, -1, -1, 1, 1, 2)
			_SendMessage($hGui, 273, $iNotify, 0)
	EndSwitch
	_GUICtrlMenu_DestroyMenu($hMenu)
	Return True
EndFunc   ;==>WM_CONTEXTMENU

error: pathspec 'Diversos/ContextMenu.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


Initial RPC server commit

Initial RPC server commit

#include <AutoItConstants.au3>
#include <Array.au3>

Const $AUTOIT_RPC_VERSION = "0.1.0"

Const $STX = Chr(2)                     ;Start of Text (array open)
Const $ETX = Chr(3)                     ;End Of Text (array terminator)
Const $ENQ = Chr(5)                     ;Enquiry (Ping)
Const $ACK = Chr(6)                     ;Acknowledge (Ping)
Const $FS = Chr(28)                     ;File Separator (command message length / message separator)
Const $GS = Chr(29)                     ;Group Separator (command group command / args separator)
Const $RS = Chr(30)                     ;Record Separator (array entry separator)
Const $US = Chr(31)                     ;Unit separator (value type / data  separator)

Const $MAX_MESSAGE_LENGTH = 16777216    ;Max array length

Global Enum $ERROR_NONE, _
            $ERROR_SOCKET, _
            $ERROR_INVALID_MESSAGE_LENGTH, _
            $ERROR_MESSAGE_TOO_BIG, _
            $ERROR_INVALID_ARRAY_FORMAT, _
            $ERROR_INVALID_VALUE_TYPE, _
            $ERROR_INVALID_VALUE, _
            $ERROR_UNREGISTERED_VALUE_TYPE

Main()

Func Main()
    Serve("127.0.0.1", 6542)
EndFunc

Func Serve($ip, $port)
    OnAutoItExitRegister(OnExit)
    TCPStartup()
    Local $listenSocket = TCPListen($ip, $port, 100)
    Local $err = 0

    If @error Then
        ERR(@error, "Launch error on " & $ip & ":" & String($port))
		Return
    EndIf
    DBG("Serving on " & $ip & ":" & String($port))

    Local $client = 0
    Local $message = ""
    Local $result = ""
    Local $connected = False
    While True
        $client = GetClientConnection($listenSocket)
        If @error Then
		   ERR(@error)
		   $connected = False
		   ContinueLoop
	   EndIf

        $connected = True

        While $connected
            $message = ReadMessagePacket($client)
            If @error Then
                ERR(@error)
                $connected = False
            EndIf

            If ($message == Null) Then
                ContinueLoop
            EndIf

            $result = ProcessCommand($message)
            If @error Then
                ERR(@error)
            EndIf
            DBG(String($result))
            DBG("----")
            ConsoleWrite($result)
            SendResult($client, $result)
        WEnd

    WEnd
EndFunc

#cs
 Poll for an incoming client connection

 @param {Socket} $listenSocket

 @return {Socket} Client socket

 @throws {ERR_SOCKET}
#ce
Func GetClientConnection($listenSocket)
    Local $socket = 0
    Do
        $socket = TCPAccept($listenSocket)
        If @error Then
            SetError($ERROR_SOCKET)
            Return Null
        EndIf
    Until $socket <> -1
    Return $socket
EndFunc

#cs
 Read a message packet from a given client

 @param {Socket} $client

 @return {String} Message from the packet

 @throws {ERR_MESSAGE_TOO_BIG}
 @throws {ERR_INVALID_MESSAGE_LENGTH}
 @throws {ERR_SOCKET}
#ce
Func ReadMessagePacket($client)
    Local $message_length = ReadMessageLength($client)
    If @error Then
        Return Null
    EndIf
    DBG("Message Length: " & String($message_length))
    Local $message = ReadMessage($client, $message_length)
    If @error Then
        SetError(@error)
        Return Null
    EndIf
    DBG("Message: " & String($message))
    Return $message
EndFunc

#cs
 Read the message length segment of a message packet

 @param {Socket} $client

 @return {Int}

 @throws {ERR_MESSAGE_TOO_BIG}
 @throws {ERR_INVALID_MESSAGE_LENGTH}
 @throws {ERR_SOCKET}
#ce
Func ReadMessageLength($client)
    Local $raw = ""
    Local $char = ""

    ; RPC Message Structure
    ; -------------------------------
    ;| message_length | FS | message |
    ; -------------------------------

    For $i = 1 to StringLen(String($MAX_MESSAGE_LENGTH))
        $char = TCPRecv($client, 1)                     ;Read one character

        If @error Then
            SetError($ERROR_SOCKET)
            Return Null
        EndIf

        If ( $char == $FS ) Then                   ;Segment terminator, stop reading
            Local $length = Int($raw)
            If ($length > $MAX_MESSAGE_LENGTH) Then
                SetError($ERROR_MESSAGE_TOO_BIG)
                Return Null
            EndIf
            Return $length
        EndIf

        If ( Not StringIsInt($char) ) Then              ;Character must be an integer
            SetError($ERROR_INVALID_MESSAGE_LENGTH)
            Return Null
        EndIf

        $raw = $raw & $char
    Next

    ;Valid message lengths should terminate in the loop
    SetError($ERROR_INVALID_MESSAGE_LENGTH)
    Return Null
EndFunc

#cs
 Read the message segment of a message packet

 @param {Socket} $client
 @param {Int} @length

 @return {String}

 @throws {ERR_MESSAGE_TOO_BIG}
 @throws {ERR_SOCKET}
#ce
Func ReadMessage($client, $length)
    If ($length > $MAX_MESSAGE_LENGTH) Then
        SetError($ERROR_MESSAGE_TOO_BIG)
        Return Null
        EndIf

    $message = TCPRecv($client, $length)

    If @error Then
        SetError($ERROR_SOCKET)
        Return Null
    EndIf

    Return $message
EndFunc

Func StringIterable($str)
    Local $data = StringSplit($str, "")
    Local $iter[] = [0, $data[0], $data]
    Return $iter
EndFunc

Func GetNext(ByRef $iter)
    If Not HasNext($iter) Then
        Return Null
    EndIf

    Local $index = $iter[0] + 1
    $iter[0] = $index

    Local $data = $iter[2]
    Local $val = $data[$index]
    Return $val
EndFunc

Func HasNext(ByRef $iter)
    Local $index = $iter[0]
    Local $max = $iter[1]
    Return $index < $max
EndFunc

#cs
 Process the execution of a given command message

 @param {String} $message

 @return {String}
#ce
Func ProcessCommand($message)
    Local $iter = StringIterable($message)
    Local $command = ParseCommand($iter)
    Local $args = ParseArguments($iter)
    If @error Then
        ERR(@error)
        Return Null
    EndIf

    DBG($command)

    Local $result

    If ( $args == Null ) Then
        $result = Call($command)
    Else
        $result = Call($command, $args)
    EndIf

    If @error Then
        ERR(@error)
        Return Null
    EndIf

    Return $result
EndFunc

Func SendResult($client, $result)
    Local $str = SerializeValue($result)
    TCPSend($client, $str)
EndFunc

Func ParseCommand(ByRef $iter)
    Local $char = ""
    Local $command = ""

    ; message layout
    ; ---------------------
    ;| command | GS | args |
    ; ---------------------
    While HasNext($iter)
        $char = GetNext($iter)
        Switch $char
            Case $GS
                Return $command

            Case Else
                $command = $command & $char
        EndSwitch
    WEnd
    Return $command
EndFunc

Func ParseArguments(ByRef $iter)
    If HasNext($iter) Then
        Return ParseArray($iter, true)
    EndIf
    Return Null ;No arguments passed
EndFunc

Func ParseArray(ByRef $iter, $is_call_args)
    DBG("Parsing Array...")
    Local $char = ""

    ; Array Layout
    ; ---------------------------------------------
    ;| STX | value | RS | value | RS | value | ETX |
    ; ---------------------------------------------

    $char = GetNext($iter)
    If ($char <> $STX) Then
        SetError($ERROR_INVALID_ARRAY_FORMAT)
        Return Null
    EndIf

    ;Value Format
    ; ------------------------------
    ;| STX | type | US | data | ETX |
    ; ------------------------------

    Local $a[10]
    Local $size = 10
    Local $pos = 0

    If ( $is_call_args == true ) Then
        $a[0] = "CallArgArray"
        $pos = 1
    EndIf

    Local $value
    While HasNext($iter)
        $value = ParseValue($iter)

        If @error Then
            Return Null
        EndIf

        If ($pos == $size) Then     ;Array too small to add to, increase size
            $size = $size * 2
            ReDim $a[$size]
        EndIf
        $a[$pos] = $value
        $pos = $pos + 1

        Switch GetNext($iter)
            Case $RS
                ContinueLoop

            Case $ETX
                If ($pos < $size) Then  ;Shrink array back down to its final size
                    ReDim $a[$pos]
                EndIf
                Return $a

            Case Else
                SetError($ERROR_INVALID_ARRAY_FORMAT)
                Return Null
        EndSwitch
    Wend
EndFunc

Func ParseValue(ByRef $iter)
    DBG("Parsing Value...")
    ;Value Format
    ; ------------------------------
    ;| STX | type | US | data | ETX |
    ; ------------------------------

    Local $type = ParseValueType($iter)

    If @error Then
        Return Null
    EndIf

    DBG("Type: " & $type)

    ;Arrays are a special parsing case
    If ( $type == "arr" ) Then
        Return ParseArray($iter, false)
    EndIf

    Local $data = ParseValueData($iter)

    DBG("(" & $type & ") " & $data)

    Switch $type
        Case "i32"
            Return Int($data, 1)

        Case "i64"
            Return Int($data, 2)

        Case "num"
            Return Number($data)

        Case "bool"
            Return $data == "true"

        Case "hwnd"
            Return HWnd($data)

        Case "str"
            Return $data

        Case Else
            SetError($ERROR_UNREGISTERED_VALUE_TYPE)
            Return Null
    EndSwitch
EndFunc

Func ParseValueType(ByRef $iter)
    Local $char = ""
    Local $type = ""

    ;Value Format
    ; ------------------------------
    ;| STX | type | US | data | ETX |
    ; ------------------------------

    $char = GetNext($iter)

    If ($char <> $STX) Then
        SetError($ERROR_INVALID_VALUE_TYPE)
        Return Null
    EndIf

    While HasNext($iter)
        $char = GetNext($iter)
        Switch $char
            Case $US
                return $type

            Case Else
                $type = $type & $char
		 EndSwitch
    WEnd
    SetError($ERROR_INVALID_VALUE_TYPE)
    Return Null
EndFunc

Func ParseValueData(ByRef $iter)
    Local $char = ""
    Local $data = ""

    ;Value Format
    ; ------------------------------
    ;| STX | type | US | data | ETX |
    ; ------------------------------
    While HasNext($iter)
        $char = GetNext($iter)
        Switch $char
            Case $ETX                   ;End of data
                Return $data
            Case Else
                $data = $data & $char
		 EndSwitch
    WEnd
    SetError($ERROR_INVALID_VALUE_TYPE)
    Return Null
EndFunc

Func SerializeArray(Const ByRef $a)
    ;Array Format (arr)
    ; ---------------------------------------------
    ;| STX | value | RS | value | RS | value | ETX |
    ; ---------------------------------------------
    DBG(_ArrayToString($a, $ETX & $STX, 0, 0, $RS))
    Local $str = $STX
    Switch UBound($a, $UBOUND_DIMENSIONS)
        Case 1
            $str = $str & SerializeSingleArray($a)

        Case 2
            $str = $str & SerializeDoubleArray($a)
    EndSwitch
    $str = $str & $ETX

    Return $str

EndFunc

Func SerializeSingleArray(Const ByRef $a)
    Local $str = ""
    For $i = 0 To UBound($a)
        $str = $str & SerializeValue($a[$i])
        If @error Then
            ERR(@error, "Serializing array value")
            Return Null
        EndIf
    Next
    Return $str
EndFunc

Func SerializeDoubleArray(Const ByRef $a)
    Local $str = ""
	Local $end_col = UBound($a, $UBOUND_COLUMNS) - 1
	Local $end_row = UBound($a, $UBOUND_ROWS) - 1
    For $i = 0 To $end_row
        For $j = 0 To $end_col
            $str = $str & SerializeValue($a[$i][$j])
            If @error Then
              ERR(@error, "Serializing array value")
             Return Null
            EndIf
        Next
    Next
    Return $str
EndFunc

Func SerializeValue(Const ByRef $v)
    ;Value Format
    ; ------------------------------
    ;| STX | type | US | data | ETX |
    ; ------------------------------
    If IsArray($v) Then
        Return WrapValueType("arr", SerializeArray($v))
    ElseIf IsBool($v) Then
        If $v Then
            Return WrapValueType("bool", "1")
        Else
            Return WrapValueType("bool", "0")
        EndIf
    ElseIf IsHWnd($v) Then
        Return WrapValueType("hwnd", String($v))
    ElseIf IsNumber($v) Then
        If IsInt($v) Then
            Return WrapValueType("i32", String($v))
        Else
            Return WrapValueType("num", String($v))
        EndIf
    ElseIf IsString($v) Then
        Return WrapValueType("str", $v)
    Else
        SetError($ERROR_UNREGISTERED_VALUE_TYPE)
        Return Null
    EndIf
EndFunc

Func WrapValueType($type, $val)
    ;Value Format
    ; ------------------------------
    ;| STX | type | US | data | ETX |
    ; ------------------------------
    Return $STX & $type & $US & $val & $ETX
EndFunc

Func ERR($err, $msg="")
    Local $type = "Undefined Error"
    Switch $err
        Case $ERROR_SOCKET
            $type = "Socket Error"
        Case $ERROR_INVALID_MESSAGE_LENGTH
            $type = "Invalid Message Length"
        Case $ERROR_MESSAGE_TOO_BIG
            $type = "Message Too Big"
        Case $ERROR_INVALID_ARRAY_FORMAT
            $type = "Invalid Array Format"
        Case $ERROR_INVALID_VALUE_TYPE
            $type = "Invalid Value Type"
        Case $ERROR_INVALID_VALUE
            $type = "Invalid Value"
        Case $ERROR_UNREGISTERED_VALUE_TYPE
            $type = "Unregistered Value Type"
    EndSwitch
    ConsoleWrite($type & ":" & $err & ". " & $msg & @CR)
    ConsoleWrite("Error: " & $err & @CR)
EndFunc

Func DBG($msg)
    ConsoleWrite($msg & @CR)
EndFunc

Func OnExit()
   TCPShutdown()
EndFunc

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


Create _ArrayDump.au3

Create _ArrayDump.au3

#include-once
#include <Array.au3>
; autor: Luismar Chechelaky
Func _ArrayDump($arr, $name = "")
	Local $iCol = UBound($arr, 2)
	Local $aCol[$iCol]
	Local $iLen
	Local $line_head = "+"
	For $ii = 0 To UBound($arr, 1) - 1
		For $jj = 0 To UBound($arr, 2) - 1
			$iLen = StringLen($arr[$ii][$jj])
			If $iLen > $aCol[$jj] Then $aCol[$jj] = $iLen
		Next
	Next
	Local $line = "+"
	For $ii = 0 To $iCol - 1
		$line &= _StringRepeat("-", $aCol[$ii]) & "+"
		$line_head &= _StringRepeat("-", $aCol[$ii] - StringLen(String($ii))) & $ii & "+"
	Next
	If $name Then ConsoleWrite("arr[ " & $name & " ] " & UBound($arr, 1) & "x" & UBound($arr, 2) & @LF)
	ConsoleWrite($line_head & @LF)
	For $ii = 0 To UBound($arr, 1) - 1
		ConsoleWrite($ii = 1 ? $line & @LF & "|" : "|")
		For $jj = 0 To UBound($arr, 2) - 1
			$iLen = StringLen($arr[$ii][$jj])
			ConsoleWrite(Conv($arr[$ii][$jj]) & _StringRepeat(" ", $aCol[$jj] - $iLen) & "|")
		Next
		ConsoleWrite(@LF)
	Next
	ConsoleWrite($line & @LF)
EndFunc   ;==>_ArrayDump

Func Conv($var)
	Local $Pattern[][2] = [["[áãâ]", "a"], ["[éê]", "e"], ["[íî]", "i"], ["[óõô]", "o"], ["[úû]", "u"], ["[ÁÃÂ]", "A"], ["[ÉÊ]", "E"], ["[ÍÎ]", "I"], ["[ÓÕÔ]", "O"], ["[ÚÛ]", "U"], ["[Ç]", "C"], ["[ç]", "c"]]
	For $ii = 0 To UBound($Pattern, 1) - 1
		$var = StringRegExpReplace($var, $Pattern[$ii][0], $Pattern[$ii][1])
	Next
	Return $var
EndFunc   ;==>Conv

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


add a guaji script;

add a guaji script;

; AutoIt script to automatically setup.
; --------------------------------------------------------------
; Copyright (c) 2014 Cai Guanhao (Choi Goon-ho)
; Licensed under the terms of the MIT license.
; Report bugs on https://github.com/caiguanhao/xen-config/issues
; --------------------------------------------------------------

Local $dest = "C:\Documents and Settings\Administrator\桌面"

Local $file = "C:\Documents and Settings\Administrator\桌面\guaji.zip"
Local $dl = InetGet("http://d.cgh.io/bats/guaji.zip", $file, 1, 1)
Do
  Local $info = InetGetInfo($dl)
  If $info[0] > 0 Then
    TrayTip("Downloading...", Round($info[0] / $info[1] * 100, 2) & "% completed.", 10, 1)
  EndIf
  Sleep(250)
Until InetGetInfo($dl, 2)

TrayTip("Extracting...", "Extracting program files...", 10, 1)
RunWait('"C:\Program Files\WinRAR\WinRAR.exe" x "' & $file & '" -o+ -ibck "' & $dest & '"')

FileDelete($file)

Run("C:\Documents and Settings\Administrator\桌面\5-20号挂机\挂机.exe", "C:\Documents and Settings\Administrator\桌面\5-20号挂机")

$win = WinWait("挂机")

Sleep(2000)

ControlClick($win, "", "[CLASS:WindowsForms10.BUTTON.app.0.bb8560_r15_ad1; INSTANCE:1]")

WinMove($win, "", 0, 0)

SelfDelete()

Func SelfDelete()
  Local $sCmdFile
  FileDelete(@TempDir & "\temp.bat")
  $sCmdFile = 'timeout /t 1 > nul' & @CRLF _
    & ':loop' & @CRLF _
    & 'del "' & @ScriptFullPath & '"' & @CRLF _
    & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _
    & 'del ' & @TempDir & '\temp.bat'
  FileWrite(@TempDir & "\temp.bat", $sCmdFile)
  Run(@TempDir & "\temp.bat", @TempDir, @SW_HIDE)
EndFunc

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


AutoIt helper script for bank hacking

AutoIt helper script for bank hacking

makes 2 new hotkeys, PageUp and PageDown,

when you are at the transfer funds page, you can press PageUp, and it will write the ip of the connected bank, and the bank account number of the first account owned by the player in that bank, and how much credit is available on the bank account you're logged in on, in their respective slots (ahm, provided that you don't have any slot in focus when pressing the button - that's a limitation/bug)

- when you are at the transaction history page of a bank account, you can press PageDown, and it will scan all transactions on that account, and add any account number it finds that you don't already have registered, to your list of known accounts on their respective banks, which will be shown next time you go to the enter account number page on that bank, with the password "?" - with 1 limitation, it won't be shown you log out and in on the account, same like when changing your gateway (unfortunately, seems Onlink keeps its own internal copy of all access codes, and won't load the access codes from the db until you relog, and inserting access codes in-ram to the running game would be very difficult, and a huge maintenance burden, given that the methods/locations may change from compiler changes, compiler switches, game code changes, and would need to defeat ASLR, etc..) - i haven't found a good way around this.

#include <Array.au3>
#include <SQLite.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <AutoItConstants.au3>
#include <FontConstants.au3>
#include <MsgBoxConstants.au3>
#include <GuiListBox.au3>
#include <File.au3>
#include <String.au3>

HotKeySet("{PGUP}","WriteTransferMoney");
HotKeySet("{PGDN}","ParseBankLogs");

Func Paste()
   Sleep(2*1000);
   Send(ClipGet());
EndFunc
Func init()
   _SQLite_Startup() ; Load the DLL
   If @error Then Exit MsgBox($MB_SYSTEMMODAL, "SQLite Error", "error loading SQLite3.dll ! you can download it from https://www.sqlite.org/download.html , look for ""Precompiled Binaries for Windows"", should be named something like sqlite-dll-win32-x86-3220000.zip");
;why this isn't the default beats me...
   AutoItSetOption("MouseClickDelay",0);
   AutoItSetOption("MouseClickDownDelay",0);
   AutoItSetOption("MouseClickDragDelay",0);
   AutoItSetOption("SendKeyDelay",1);
   AutoItSetOption("SendKeyDownDelay",1);
   AutoItSetOption("WinWaitDelay",0);
   AutoItSetOption("MustDeclareVars",1);
   Global $playerDB=selectPlayer();
   Global $db=_SQLite_Open ( $playerDB,$SQLITE_OPEN_READWRITE, $SQLITE_ENCODING_UTF8 );
   If @error Then Exit MsgBox($MB_SYSTEMMODAL, "SQLite Error", "error loading " & $playerDB & " ! (_SQLite_Open failed, and i'm too lazy to add proper error description code atm)");
EndFunc
Func selectPlayer()
Local $FileList=_FileListToArray(@AppDataDir & "\Onlink\users\","*.db");
Local $GUI = GUICreate("Select agent", 300, 300) ;create gui
Local $ListBox = _GUICtrlListBox_Create($GUI, "", 0, 0,300,300) ;create listbox
For $i = 1 To $FileList[0]
    ;MsgBox(0, $i, $FileList[$i])
    _GUICtrlListBox_AddString($ListBox, StringReplace($FileList[$i],".db","",-1) )
Next

GUISetState() ;show the gui
WinSetOnTop($GUI,"",$WINDOWS_ONTOP);
Local $selected=-1
Do
   Sleep(100);
   $selected=_GUICtrlListBox_GetCurSel ( $ListBox );
Until $selected <> -1;
Local $ret=@AppDataDir & "\Onlink\users\" & _GUICtrlListBox_GetText($ListBox,$selected) & ".db";
ConsoleWriteError($ret);
GUIDelete() ; if autoit expect me to clean up all inner gui controls myself, and this technically leaks memory, here is a list of all the f*ks i give:
Return $ret;
EndFunc

Func SplashMessage($title,$message, $timeoutMS=500)
   Return 0;not working with onlink, onlink overrides WinSetOnTop, apparently...
	  Local $size=50+(StringLen($message)*15);
	  Local $hwnd=SplashTextOn($title, $message, $size, $size, -1, -1, $DLG_TEXTLEFT, "", 24)
	  WinSetOnTop($hwnd,"",$WINDOWS_ONTOP);
	  Sleep($timeoutMS);
	  SplashOff()
   EndFunc

Func e_SQLite_GetTable2d ( $hDB, $sSQL, ByRef $aResult, ByRef $iRows, ByRef $iColumns, $iCharSize = -1, $bSwichDimensions = False )
   if( _SQLite_GetTable2d ( $hDB, $sSQL,$aResult, $iRows,$iColumns, $iCharSize, $bSwichDimensions ) <> $SQLITE_OK) Then
	  Exit MsgBox(0,"SQL error","error executing: " & $sSql );
   EndIf

EndFunc

Func WriteTransferMoney()
   Local $aResult, $iRows, $iColumns;
   local $connectedIp;
   Send("{tab}" & _StringRepeat("{BACKSPACE}",15) & "waiting for db flush, hold on...");
   Do
	  sleep(100);
	  e_SQLite_GetTable2d($db, 'SELECT remotehost FROM player LIMIT 1', $aResult, $iRows, $iColumns) ;
	  $connectedIp=$aResult[1][0];
	  ; get player's account for current bank:
      e_SQLite_GetTable2d($db, 'SELECT SUBSTR(content,LENGTH((SELECT remotehost FROM player LIMIT 1))+2) FROM accounts WHERE content LIKE (SELECT remotehost FROM player LIMIT 1) || '' %'' AND suP_ref LIKE ''%(player)'' LIMIT 1',$aResult, $iRows, $iColumns) ;
	  ;_ArrayDisplay($aResult, "Results from the query");
	  ;ConsoleWrite(UBound($aResult) & @CRLF);
   Until (UBound($aResult) == 2) ; waiting for the game to flush db after entering transfer money screen.. sometimes it takes a few seconds.
   ;_ArrayDisplay($aResult, "Results from the query")
   ;_ArrayDisplay($aResult, "Results from the query");
   local $playerAccountNumber=$aResult[1][0];
   ;ConsoleWrite($playerAccount  & @CRLF );
   e_SQLite_GetTable2d($db, 'SELECT bankaccount.balance FROM bankaccount WHERE bankaccount.accountnumber=(SELECT remote.security_name FROM remote)',$aResult, $iRows, $iColumns) ;
   ;_ArrayDisplay($aResult, "Results from the query");
   Local $connectedAccountBalance=$aResult[1][0];
   e_SQLite_GetTable2d($db, 'SELECT remote.security_name FROM remote WHERE id=1',$aResult, $iRows, $iColumns) ;
   Local $connectedAccountNumber=$aResult[1][0];
   Send(_StringRepeat("{BACKSPACE}",33) & $connectedAccountNumber &  "{tab}" & $connectedIp & "{tab}" & $playerAccountNumber & "{tab}" & $connectedAccountBalance);
; get current connected bank account number: SELECT remote.security_name WHERE id=1

; get balance of current connected bank account: SELECT bankaccount.balance FROM bankaccount WHERE bankaccount.accountnumber=(SELECT remote.security_name FROM remote)

EndFunc
Func ParseBankLogs()
   Local $aResult, $iRows, $iColumns;
   local $connectedIp;
   ;Send("{tab}" & _StringRepeat("{BACKSPACE}",15) & "waiting for db flush, hold on...");
   Do
	  sleep(100);
	  e_SQLite_GetTable2d($db, 'SELECT remotehost FROM player LIMIT 1', $aResult, $iRows, $iColumns) ;
	  $connectedIp=$aResult[1][0];
	  ; get player's account for current bank:
      e_SQLite_GetTable2d($db, 'SELECT SUBSTR(content,LENGTH((SELECT remotehost FROM player LIMIT 1))+2) FROM accounts WHERE content LIKE (SELECT remotehost FROM player LIMIT 1) || '' %'' AND suP_ref LIKE ''%(player)'' LIMIT 1',$aResult, $iRows, $iColumns) ;
	  ;_ArrayDisplay($aResult, "Results from the query");
	  ;ConsoleWrite(UBound($aResult) & @CRLF);
   Until (UBound($aResult) == 2) ; waiting for the game to flush db after entering transfer money screen.. sometimes it takes a few seconds.
   ; current connected account number: SELECT remote.security_name FROM remote WHERE id=1
   ; logbank: SELECT logbank FROM bankaccount WHERE accountnumber = (SELECT remote.security_name FROM remote WHERE id=1)
   ; logs: SELECT data1,data2,data3,date,fromip,fromname FROM accesslog WHERE sup_ref = ((SELECT logbank FROM bankaccount WHERE accountnumber = (SELECT remote.security_name FROM remote WHERE id=1)) || ''(logbank)'')
   e_SQLite_GetTable2d($db,'SELECT data1 FROM accesslog WHERE sup_ref = ((SELECT logbank FROM bankaccount WHERE accountnumber = (SELECT remote.security_name FROM remote WHERE id=1)) || ''(logbank)'')',$aResult, $iRows, $iColumns);
   ;_ArrayDisplay($aResult, "Results from the query");
   Local $cur, $curL, $matchIp, $matchAccount, $sql, $aResult2,$iRows2,$iColumns2;
   For $i = 1 To $iRows Step 1
	  $curL=$aResult[$i][0];
	  ;ConsoleWrite($cur & @CRLF);
	  $cur=StringRegExp($curL,"^(\d+\.\d+\.\d+\.\d+)\ (\d+)$",$STR_REGEXPARRAYMATCH);
	  if @error Then ContinueLoop
	  $matchIp=$cur[0];
	  $matchAccount=$cur[1];
	  ;ConsoleWrite($matchIp & " - " & $matchAccount & @CRLF);
	  e_SQLite_GetTable2d($db,'SELECT * FROM accesscodes WHERE key = ' & _SQLite_Escape($curL) & ' AND sup_ref = ''1(player)''',$aResult2, $iRows2, $iColumns2);
	  ;_ArrayDisplay($aResult2, "Results from the query");
	  ConsoleWrite($iRows2);

	  if($iRows2 > 0) Then ContinueLoop
	  $sql='INSERT INTO accesscodes (content,key,sup_ref) VALUES(''?'', ' & _SQLite_Escape($curL) & ', ''1(player)'');';
	  if(_SQLite_Exec($db,$sql) <> $SQLITE_OK) Then
		 ; sigh...
		Exit MsgBox(0,"error","SQLite error executing " & $sql);
	  EndIf
   Next
   Beep();
EndFunc

init();
While 1
   Sleep(100);
WEnd

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


Create base64-2.au3

Create base64-2.au3

; https://www.autoitscript.com/forum/topic/145526-base64-converter-files-and-strings-can-be-modified-easily/

Global $__b64___B64_list[64]
; #FUNCTION# ====================================================================================================================
; Name ..........: B64Decode
; Description ...: Decodes the provided base64 input. It strips @CR and @LF on its own.
; Syntax ........: B64Decode([$__b64_input = ''[, $__b64_mode = 0[, $__b64_isfile = 0]]])
; Parameters ....: $__b64_input - [optional] Base64 data or path and name of file needing to be decoded. Leaving blank shows syntax messagebox.
; $__b64_mode - [optional] 1 = decoded data will be UTF-8 while 0 = decoded data will be ANSI. Default is 0. (not used for files)
; $__b64_isfile - [optional] 0 = input is a string of information. 1 = path and file name to file to be decoded. Default is 0.
; Return values .: Data decoded from base64 to the encoding given from the $__b64_mode variable. Decoded FILE data can be used or written to a file with the forced binary encoding...
; Author ........: Wesley G aka Morthawt
; Modified ......:
; Remarks .......: Decoded FILE data is in raw binary and should be written to a file with forced binary mode. No special encoding or decoding needed
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func B64Decode($__b64_input = '', $__b64_mode = 0, $__b64_isfile = 0)
	Local $__b64_openfile, $__b64_case
	If $__b64_input = '' Then MsgBox(0, 'Hint', 'B64Decode($InputData, 0 = ANSI 1 = is UTF-8, 1 = is a file (filename)')
	__init_b64_dictionary()
	If $__b64_mode = 0 Then
		$__b64_mode = 1
	Else
		$__b64_mode = 4
	EndIf
	Local $__b64_TheBitStream, $__b64_4_SixBitChunks, $__b64_FinalOutput, $__b64_tempvalue
	If $__b64_isfile Then
		$__b64_openfile = FileOpen($__b64_input, 0)
		$__b64_input = FileRead($__b64_openfile)
		FileClose($__b64_openfile)
	EndIf
	$__b64_input = StringReplace($__b64_input, '=', '')
	$__b64_input = StringReplace($__b64_input, @CR, '')
	$__b64_input = StringReplace($__b64_input, @LF, '')
	$__b64_input = StringStripWS($__b64_input, 8)
	For $__b64_a = 1 To StringLen($__b64_input)
		$__b64_case = 'N'
		If StringIsUpper(StringMid($__b64_input, $__b64_a, 1)) Then $__b64_case = 'U'
		$__b64_TheBitStream &= __init_b64_SixBitBinary(Eval($__b64_case & StringMid($__b64_input, $__b64_a, 1)))
	Next
	For $__b64_a = 1 To (Floor(StringLen($__b64_TheBitStream) / 8) * 8) Step 8
		$__b64_tempvalue &= Hex(String(__init_b64_FromEightBitBinary(StringMid($__b64_TheBitStream, $__b64_a, 8))), 2)
	Next
	If Not $__b64_isfile Then
		$__b64_FinalOutput = BinaryToString('0x' & $__b64_tempvalue, $__b64_mode)
	Else
		$__b64_FinalOutput = '0x' & $__b64_tempvalue
	EndIf
	Return $__b64_FinalOutput
EndFunc   ;==>B64Decode

; #FUNCTION# ====================================================================================================================
; Name ..........: B64Encode
; Description ...: Encodes the provided input to Base64.
; Syntax ........: B64Encode([$__b64_input = ''[, $__b64_mode = 0[, $__b64_linebreak = 0[, $__b64_isfile = 0]]]])
; Parameters ....: $__b64_input - [optional] Data or file path and name of a file needing to be encoded to base64. Leaving blank shows syntax messagebox.
; $__b64_mode [optional] 1 = decoded data will be UTF-8 while 0 = decoded data will be ANSI. Default is 0. (not used for files)
; $__b64_linebreak - [optional] Number of base64 characters per line. This should be between 0 and 76 to be standards complient.
; $__b64_isfile - [optional] 0 = input is a string of information. 1 = path and file name to file to be decoded. Default is 0.
; Return values .: Base64 encoded data from the input in the encoding dictated by $__b64_mode. Encoded file data can be used or written to a file.
; Author ........: Wesley G aka Morthawt
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func B64Encode($__b64_input = '', $__b64_mode = 0, $__b64_linebreak = 0, $__b64_isfile = 0)
	Local $__b64_openfile, $__b64_Number, $__b64_o_UTF_8
	If $__b64_input = '' Then MsgBox(0, 'Hint', 'B64Encode($InputData, 0 = ANSI 1 = is UTF-8, 0-76 Linebreak, 1 = is a file (filename)')
	__init_b64_dictionary()
	If $__b64_linebreak > 76 Then
		MsgBox(0, 'Error', 'Base64 encode linebreak cannot exceed 76 characters.')
		Exit
	EndIf
	If $__b64_mode = 0 Then
		$__b64_mode = 1
	Else
		$__b64_mode = 4
	EndIf
	Local $__b64_TheBitStream, $__b64_4_SixBitChunks, $__b64_FinalOutput, $__b64_tempvalue, $__b64_FinalOutput2
	If Not $__b64_isfile Then
		$__b64_o_UTF_8 = StringTrimLeft(StringToBinary($__b64_input, $__b64_mode), 2)
	Else
		$__b64_openfile = FileOpen($__b64_input, 16)
		$__b64_o_UTF_8 = StringTrimLeft(FileRead($__b64_openfile), 2)
		FileClose($__b64_openfile)
	EndIf
	For $__b64_a = 1 To StringLen($__b64_o_UTF_8) Step 2
		$__b64_TheBitStream &= __init_b64_EightBitBinary('0x' & StringMid($__b64_o_UTF_8, $__b64_a, 2))
	Next
	For $__b64_a = 1 To StringLen($__b64_TheBitStream) Step +6
		$__b64_Number = __init_b64_FromSixBitBinary(StringMid($__b64_TheBitStream, $__b64_a, 6))
		$__b64_FinalOutput &= $__b64___B64_list[$__b64_Number]
	Next
	While Floor(StringLen($__b64_FinalOutput) / 4) <> (StringLen($__b64_FinalOutput) / 4)
		$__b64_FinalOutput &= '='
	WEnd
	If $__b64_linebreak > 0 Then
		For $__b64_a = 1 To StringLen($__b64_FinalOutput) Step $__b64_linebreak
			$__b64_FinalOutput2 &= StringMid($__b64_FinalOutput, $__b64_a, $__b64_linebreak)
			If $__b64_linebreak > 0 Then
				If StringLen(StringMid($__b64_FinalOutput, $__b64_a, $__b64_linebreak)) = $__b64_linebreak And $__b64_a <= (StringLen($__b64_FinalOutput) - $__b64_linebreak) Then $__b64_FinalOutput2 &= @CRLF
			EndIf
		Next
	Else
		$__b64_FinalOutput2 = $__b64_FinalOutput
	EndIf
	Return $__b64_FinalOutput2
EndFunc   ;==>B64Encode

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __init_b64_dictionary
; Description ...: Used to initialize the base64 dictionary used in conversions
; Syntax ........: __init_b64_dictionary()
; Parameters ....: None
; Return values .: None
; Author ........: Wesley G aka Morthawt
; Modified ......:
; Remarks .......: Creates an array with base64 dictionary. Also creates variables with direct names for easy and quick access while decoding letters to numbers.
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __init_b64_dictionary()
	Global $__b64___B64_list[64]
	For $__b64_a = 0 To 63
		Select
			Case $__b64_a < 26
				$__b64___B64_list[$__b64_a] = ChrW(65 + $__b64_a)
				Assign('U' & ChrW(65 + $__b64_a), $__b64_a, 2)
			Case $__b64_a < 52
				$__b64___B64_list[$__b64_a] = ChrW(71 + $__b64_a)
				Assign('N' & ChrW(71 + $__b64_a), $__b64_a, 2)
			Case $__b64_a < 62
				$__b64___B64_list[$__b64_a] = ChrW($__b64_a - 4)
				Assign('N' & ChrW($__b64_a - 4), $__b64_a, 2)
			Case $__b64_a = 62
				$__b64___B64_list[$__b64_a] = ChrW(43)
				Assign('N' & ChrW(43), $__b64_a, 2)
			Case $__b64_a = 63
				$__b64___B64_list[$__b64_a] = ChrW(47)
				Assign('N' & ChrW(47), $__b64_a, 2)
		EndSelect
	Next
EndFunc   ;==>__init_b64_dictionary

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __init_b64_EightBitBinary
; Description ...: Outputs an 8-bit binary string from an input integer between 0 and 255
; Syntax ........: __init_b64_EightBitBinary([$__b64_input = 0])
; Parameters ....: $__b64_input - [optional] Integer between 0 and 255 Default is 0.
; Return values .: 8-bit binary string representing the input integer
; Author ........: Wesley G aka Morthawt
; Modified ......:
; Remarks .......: An 8-bit binary string looks like 10101010
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __init_b64_EightBitBinary($__b64_input = 0)
	Local $__b64_tmpbitstream, $__b64_start
	If $__b64_input < 256 Then
		$__b64_tmpbitstream = ''
		$__b64_start = 128
		While $__b64_start >= 1
			If Floor($__b64_input / $__b64_start) Then
				$__b64_tmpbitstream &= 1
				$__b64_input -= ($__b64_start * Floor($__b64_input / $__b64_start))
			Else
				$__b64_tmpbitstream &= 0
			EndIf
			$__b64_start /= 2
		WEnd
	Else
		$__b64_tmpbitstream = 0
	EndIf
	Return $__b64_tmpbitstream
EndFunc   ;==>__init_b64_EightBitBinary

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __init_b64_SixBitBinary
; Description ...: Outputs a 6-bit binary string from an input integer between 0 and 63
; Syntax ........: __init_b64_SixBitBinary([$__b64_input = 0])
; Parameters ....: $__b64_input - [optional] An integer between 0 and 63. Default is 0.
; Return values .: A 6-bit binary string representing the input integer
; Author ........: Wesley G aka Morthawt
; Modified ......:
; Remarks .......: A 6-bit binary string looke like 101010
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __init_b64_SixBitBinary($__b64_input = 0)
	Local $__b64_tmpbitstream, $__b64_start
	If $__b64_input < 64 Then
		$__b64_tmpbitstream = ''
		$__b64_start = 32
		While $__b64_start >= 1
			If Floor($__b64_input / $__b64_start) Then
				$__b64_tmpbitstream &= 1
				$__b64_input -= ($__b64_start * Floor($__b64_input / $__b64_start))
			Else
				$__b64_tmpbitstream &= 0
			EndIf
			$__b64_start /= 2
		WEnd
	Else
		$__b64_tmpbitstream = 0
	EndIf
	Return $__b64_tmpbitstream
EndFunc   ;==>__init_b64_SixBitBinary

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __init_b64_FromSixBitBinary
; Description ...: Outputs an integer between 0 and 63 based on a 6-bit binary input.
; Syntax ........: __init_b64_FromSixBitBinary([$__b64_input = 0])
; Parameters ....: $__b64_input - [optional] 6-bit binary input. Default is 0.
; Return values .: Integer between 0 and 63
; Author ........: Wesley G aka Morthawt
; Modified ......:
; Remarks .......: A 6-bit binary string looke like 101010
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __init_b64_FromSixBitBinary($__b64_input = 0)
	Local $__b64_base = 32, $__b64_tempvalue = 0
	For $__b64_a = 1 To 6
		If StringMid($__b64_input, $__b64_a, 1) = 1 Then
			$__b64_tempvalue += $__b64_base
		EndIf
		$__b64_base /= 2
	Next
	Return $__b64_tempvalue
EndFunc   ;==>__init_b64_FromSixBitBinary

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __init_b64_FromEightBitBinary
; Description ...: Outputs an integer between 0 and 255 from an 8-bit binary input.
; Syntax ........: __init_b64_FromEightBitBinary([$__b64_input = 0])
; Parameters ....: $__b64_input - [optional] An 8-bit binary string. Default is 0
; Return values .: Integer between 0 and 255
; Author ........: Wesley G aka Morthawt
; Modified ......:
; Remarks .......: An 8-bit binary string looks like 10101010
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __init_b64_FromEightBitBinary($__b64_input = 0)
	Local $__b64_base = 128, $__b64_tempvalue = 0
	For $__b64_a = 1 To 8
		If StringMid($__b64_input, $__b64_a, 1) = 1 Then
			$__b64_tempvalue += $__b64_base
		EndIf
		$__b64_base /= 2
	Next
	Return $__b64_tempvalue
EndFunc   ;==>__init_b64_FromEightBitBinary

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


usage edit

usage edit

;;  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 = "One Click Installer installs Robot Framework and its " & _
         "preconditions Python and Jython (optional)." & @CRLF & @CRLF & _
         "Please specify the directory where you want software to be " & _
         "installed. Also make sure that you have required Robot Framework " & _
         "and Python installers, and optionally Jython installer, in the " & _
         "same directory as this installer." & @CRLF & @CRLF & _
         "For more information see http://robotframework.org/."

;;
;; Main
;;

$base_dir = GetBaseDirectory()
$python_installer = GetRequiredInstaller($PYTHON_PATTERN, "Python")
$robot_installer = GetRequiredInstaller($ROBOT_PATTERN, "Robot Framework")
$jython_installer = GetOptionalInstaller($JYTHON_PATTERN)
$python_dir = GetPythonDir($base_dir & $PYTHON_DIR_NAME)
$jython_dir = GetJythonDir($base_dir & $JYTHON_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 = "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)." & @CRLF & @CRLF & _
         "Please specify the directory where you want to install the software. Make also sure you have the " & _
         "required Robot Framework and Python installers, optionally Jython installer, in the directory " & _
         "where you have this installer." & @CRLF & @CRLF & _
         "See more information from robotframework.org."

;;
;; Main
;;

$base_dir = GetBaseDirectory()
$python_installer = GetRequiredInstaller($PYTHON_PATTERN, "Python")
$robot_installer = GetRequiredInstaller($ROBOT_PATTERN, "Robot Framework")
$jython_installer = GetOptionalInstaller($JYTHON_PATTERN)
$python_dir = GetPythonDir($base_dir & $PYTHON_DIR_NAME)
$jython_dir = GetJythonDir($base_dir & $JYTHON_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


Create Real_Exemplo.au3

Create Real_Exemplo.au3

;~ https://www.autoitscript.com/forum/topic/54909-detecting-when-guictrlinput-change-it-value/
;~ https://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/Tidy.html
#Tidy_Parameters /gd

#include <GuiConstants.au3>
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <WinAPI.au3>

Opt("MustDeclareVars", 1)

Global $iInput, $hInput
Global $nao_usada

_Example_Internal()

Func Real($number = "")
	If $number == "" Then Return ""
	If $number == "." Then Return "0."
	$number = StringRegExpReplace(StringReplace($number, ",", "."), "[^0-9.]", "")
	Local $dot = StringInStr($number, ".")
	If Not $dot Then Return $number
	Return StringReplace(StringMid($number, 1, $dot - 1), ".", "") & "." & StringReplace(StringMid($number, $dot + 1), ".", "")
EndFunc   ;==>Real

Func _Example_Internal()
	Local $hGUI
	Local $aPartRightSide[4] = [120, 248, 378, -1]

	$hGUI = GUICreate("Exemplo: uso de máscara para número real", 400, 300)
	$iInput = GUICtrlCreateInput("123.45", 2, 2, 394, 25)
	$hInput = GUICtrlGetHandle($iInput)

	GUISetState()

	GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

	While Sleep(10) And GUIGetMsg() <> -3
	WEnd
	GUIDelete()
EndFunc   ;==>_Example_Internal

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
	Local $hWndFrom, $iIDFrom, $iCode, $hWndEdit
	$hWndFrom = $ilParam
	$iIDFrom = _WinAPI_LoWord($iwParam)
	$iCode = _WinAPI_HiWord($iwParam)
	Switch $hWndFrom
		Case $hInput
			Switch $iCode
				Case $EN_CHANGE
					GUICtrlSetData($iInput, Real(GUICtrlRead($iInput)))
			EndSwitch
	EndSwitch
	Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND

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


WatchClipBoard with Date/Time and Editor launch option

#include <MsgBoxConstants.au3>
#include <Date.au3>
#include <WinAPI.au3>

; Konstanten
Const $targetWindowName = "Unbenannt - Editor"

; hole oder ffne Notepad Fenster
Do
    $hNotepad = WinGetHandle($targetWindowName)
	If @error Then
        $hNotepad = 0
        $msgBoxResult = MsgBox(BitOR($MB_CANCELTRYCONTINUE, $MB_ICONERROR), _
		    "WatchClipBoard - Error", "Window not found: '" & $targetWindowName & "'" & @CRLF & _
			"(Press 'Continue' to open a new text editor window)")
		Switch $msgBoxResult
        Case 11   ; Weiter
            $txtOpenCommand = RegRead("HKEY_CLASSES_ROOT\txtfile\shell\open\command", "")
			Run(_WinAPI_ExpandEnvironmentStrings(StringRegExpReplace($txtOpenCommand, "( +""?%.""?)+$", "")))
			Sleep(2000)
			ContinueCase
		Case 10   ; Wiederholen
		Case Else ; insbesondere 2 = Abbrechen/Dialog-Schlieen
            Exit 1
        EndSwitch
	EndIf
Until $hNotepad <> 0

; Hauptschleife
$lastClipContents = ClipGet()
While True
    $clipContents = ClipGet()
    If Not @error And $clipContents <> $lastClipContents Then
        $hCurrentWin = WinGetHandle("")
        WinActivate($hNotepad)
        Sleep(300)
		If Not StringRegExp($clipContents, "^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d") Then
            Send(StringReplace(_Date_Time_SystemTimeToDateTimeStr(_Date_Time_GetLocalTime(), 1), "/", "-") & " -")
			If Not StringRegExp($clipContents, "^\s") Then
                Send(" ")
			EndIf
		EndIf
        Send("^v")
		If StringRight($clipContents, 2) <> @CRLF Then
            Send("{ENTER}")
	    EndIf
        Sleep(300)
        WinActivate($hCurrentWin)
        $lastClipContents = $clipContents
    EndIf
    Sleep(300)
WEnd

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


Create CloseHiddenIE.au3

Create CloseHiddenIE.au3

#include <IE.au3>

; *****************************************************************************
; closeHiddenIE()
; Closes all instances of Internet Explorer that are invisible.
; *****************************************************************************

Func closeHiddenIE()
	; Retrieve a list of IE window handles.
	Local $aList = WinList("[CLASS:IEFrame]")

	; Loop through and close all hidden IE windows.
	For $i = 1 To $aList[0][0]
		If ( $aList[$i][0] <> "" ) And _
				Not ( BitAND(WinGetState($aList[$i][1]), 2) ) Then
			WinClose( $aList[$i][1] )
		EndIf
	Next
EndFunc

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


send telegram messages binaries

send telegram messages binaries

#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","")
	$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 'helper/SendTelegramSubteBA/SendTelegramSubteBA.au3' did not match any file(s) known to git


Get-tweet functionality . scrap twiter subteba site and send messages to users

#include <Array.au3>
#include <..\..\udf\CleanString.au3>

FileInstall("../SendTelegramSubteBA/SendTelegramSubteBA.exe", @TempDir & "\SendTelegramSubteBA.exe" , 1 )
Local $sData = InetRead("https://twitter.com/subteba")
Local $nBytesRead = @extended
$htmltxt=BinaryToString($sData)

$TweetArr=""
$TweetArr = StringRegExp($htmltxt,'(?s)(?i)
(.*?)
',3)
if IsArray($TweetArr) then
$U=UBound($TweetArr)-1
  For $i = $u To 1 Step -1
	 $TweetMessage = StringRegExp($TweetArr[$i],'(?s)(?i)
(.*?)
',1)
	 $mensaje=clearstring($TweetMessage[1])
	 _sendmessages($mensaje)
  Next
  exit 10
Else
  exit 1
endif

Func _sendmessages($message)
  Local $fileh = FileOpen("..\..\secret\recipients.txt", 0)
  If $fileh = -1 Then
	  Exit
  EndIf
  While 1
	  Local $chatidLine = FileReadLine($fileh)
	  If @error = -1 Then ExitLoop
	  $chatidArr=StringSplit($chatidLine,',')
	  $chatid=$chatidArr[1]
	  ConsoleWrite('@@ $chatid = ' & $chatid & "  ->  " & $chatidArr[2] & @crlf )
	  $sCommandStart=@TempDir&'\SendTelegramSubteBA.exe -m "'&$message& '" -chatid '& $chatid
	  $respuesta=_GetDOSOutput($sCommandStart )
	  ConsoleWrite('@ $respuesta = ' & $respuesta & @crlf )
  WEnd
  FileClose($fileh)
EndFunc
 Func _ClearSciteConsole()
	 ConsoleWrite('!!!!!!!!!!!_ClearSciteConsole Func General 92!!!!!!!!!!!!  '& @crlf)
	 ControlSend("[CLASS:SciTEWindow]", "", "Scintilla2", "+{F5}")
 EndFunc
 Func _GetDOSOutput($sCommand )
;~ 	 ConsoleWrite('++_GetDOSOutput $sCommand = ' & $sCommand & @crlf )
	 Local $iPID, $sOutput = ""
	 $iPID = Run('"' & @ComSpec & '" /c ' & $sCommand, "", @SW_HIDE, 2 + 4)
	 While 1
		 $sOutput &= StdoutRead($iPID, false, False)
		 If @error Then
			 ExitLoop
		 EndIf
	 ;~ 	Sleep(10)
	 WEnd
;~ 	 ConsoleWrite('>> 	Output = ' & $sOutput & @crlf )
	 Return $sOutput
 EndFunc   ;==>_GetDOSOutput

error: pathspec 'helper/getWeb/Get-Tweet.au3' did not match any file(s) known to git