Leaderboard
Popular Content
Showing content with the highest reputation on 03/10/2015 in all areas
-
I love GifCam. Easy and handy to use for create animated gif from capture. For the fun, i have tried to do it in AutoIt. GifSicle is only used for compress animated Gif when saving or decompress when loading. Due to a lack of time, I have not re-created all the features of latest GifCam Version. Warning : Use latest AutoIt release (v3.3.12.0) and script do not work under XP. source and executable are available in the Download Section Hope you like it ! If not, try the Original !3 points
-
Sometimes you don't want the user to rename the executable to their choice. This is why I created the function _SelfRename, to ensure the executable stays exactly as you want it. Function: Using a Batch script. Save as _SelfRename.au3 #include-once #include <FileConstants.au3> #include <StringConstants.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: __SelfRename ; Description ...: Rename the running executable to a different filename. ; Syntax ........: _SelfRename($sFileName[, $fRestart = Default[, $iDelay = 5[, $fUsePID = Default]]]) ; Parameters ....: $sFileName - Filename the executable should be called e.g. Example.exe or Example ; $fRestart - [optional] Restart the application (True) or to not restart (False) after overwriting. Default is False. ; $iDelay - [optional] An integer value for the delay to wait (in seconds) before stopping the process and deleting the executable. ; If 0 is specified then the batch will wait indefinitely until the process no longer exits. Default is 5 (seconds). ; $fUsePID - [optional] Use the process name (False) or PID (True). Default is False. ; Return values .: Success - Returns the PID of the batch file. ; Failure - Returns 0 & sets @error to non-zero ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _SelfRename($sFileName, $fRestart = Default, $iDelay = 5, $fUsePID = Default) If @Compiled = 0 Then Return SetError(1, 0, 0) EndIf Local Const $iPosition = StringInStr($sFileName, '.', $STR_NOCASESENSEBASIC, -1) - 1 If $iPosition Then $sFileName = StringLeft($sFileName, $iPosition) EndIf Local $sAppID = @ScriptName If $sFileName & '.exe' = $sAppID Then Return SetError(3, 0, 0) EndIf $sFileName = @ScriptDir & '\' & $sFileName & '.exe' Local $sTempFileName = @ScriptName $sTempFileName = StringLeft($sTempFileName, StringInStr($sTempFileName, '.', $STR_NOCASESENSEBASIC, -1) - 1) While FileExists(@TempDir & '\' & $sTempFileName & '.bat') $sTempFileName &= Chr(Random(65, 122, 1)) WEnd $sTempFileName = @TempDir & '\' & $sTempFileName & '.bat' If $iDelay = Default Then $iDelay = 5 EndIf Local $sDelay = '' $iDelay = Int($iDelay) If $iDelay > 0 Then $sDelay = 'IF %TIMER% GTR ' & $iDelay & ' GOTO DELETE' EndIf Local $sImageName = 'IMAGENAME' If $fUsePID Then $sAppID = @AutoItPID $sImageName = 'PID' EndIf Local $sCmdLineRaw = '' If $CmdLineRaw <> '' Then $sCmdLineRaw = ' ' & $CmdLineRaw EndIf Local $sRestart = '' If $fRestart Or $fRestart = Default Then $sRestart = 'START "" "' & $sFileName & '"' & $sCmdLineRaw EndIf $sCmdLineRaw = '' Local Const $iInternalDelay = 2, _ $sScriptPath = @ScriptFullPath Local Const $sData = 'SET TIMER=0' & @CRLF _ & ':START' & @CRLF _ & 'PING -n ' & $iInternalDelay & ' 127.0.0.1 > nul' & @CRLF _ & $sDelay & @CRLF _ & 'SET /A TIMER+=1' & @CRLF _ & @CRLF _ & 'TASKLIST /NH /FI "' & $sImageName & ' EQ ' & $sAppID & '" | FIND /I "' & $sAppID & '" >nul && GOTO START' & @CRLF _ & 'GOTO MOVE' & @CRLF _ & @CRLF _ & ':MOVE' & @CRLF _ & 'TASKKILL /F /FI "' & $sImageName & ' EQ ' & $sAppID & '"' & @CRLF _ & 'MOVE /Y ' & '"' & $sScriptPath & '"' & ' "' & $sFileName & '"' & @CRLF _ & 'IF EXIST "' & $sScriptPath & '" GOTO MOVE' & @CRLF _ & @CRLF _ & ':END' & @CRLF _ & $sRestart & @CRLF _ & 'DEL "' & $sTempFileName & '"' Local Const $hFileOpen = FileOpen($sTempFileName, $FO_OVERWRITE) If $hFileOpen = -1 Then Return SetError(2, 0, 0) EndIf FileWrite($hFileOpen, $sData) FileClose($hFileOpen) Return Run($sTempFileName, @TempDir, @SW_HIDE) EndFunc ;==>_SelfRenameExample use of Function: #pragma compile(Out, Example_1.exe) #include <MsgBoxConstants.au3> #include '_SelfRename.au3' ; Start the SelfRename batch file if the executable doesn't match the same as Example.exe. If _SelfRename('Example.exe', True) Then MsgBox($MB_SYSTEMMODAL, '', 'The executable is currently called "' & @ScriptName & '", but it should be called "Example.exe"') Else MsgBox($MB_SYSTEMMODAL, '', 'Successful, the application is called "' & @ScriptName & '"') EndIf1 point
-
Network Connections Viewer
SkysLastChance reacted to trancexx for a topic
There are situation when you know something is going off from or to your computer and you have no idea what that is or who's doing that. On the other hand, sometimes you are just curious to know (I know I am) what's cooking. Scrip below is analyzing every connection that your machine have. Either TCP or UDP. It'll give you port numbers, IP addresses, names of the processes issuing connections, their PIDs, locations on HD, user names, connection statuses, and hints on protocols for used ports (so that you know roughly what that connection is or could be). Also you will be given an ability to disable desired connection. Script: ConnView.au3 edit: new script1 point -
GUIListViewEx - Deprecated Version
123disconnect reacted to Melba23 for a topic
Now replaced by a new version of the UDF in this link. <hr> [NEW VERSION] - 7 Mar 16 Added: A new option for $iAdded (+ 512) allows you to select just one cell of the ListView rather than the whole row. A new function _GUIListViewEx_SetDefColours allows the user to set the default colours when using either or both the "colour" and "single cell selection" options. Another new function _GUIListViewEx_BlockReDraw which prevents ListView redrawing during looped Insert/Delete/Change calls - this greatly speeds up execution by avoiding lengthy redrawing when using either or both the "colour" and "single cell selection" options, use of which forces the redraw to use a WM_NOTIFY handler within the script. Changed: A number of minor internal changes to speed up the loading of the ListView when using either or both of the "colour" and "single cell selection" options. A slightly modified Example_6 script shows the new functions in use. The LH native ListView can have rows and columns added/removed using both the old and new functions and has a context menu to allow for colour selection. The contents of this ListView can be mirrored to the RH UDF-created ListView which has "single cell selection" enabled and allows the colours of any item (including the selected cell) to be changed programmatically. New UDF in the zip below. Previous changes: ChangeLog.txt Hi, It seemed that I wanted to add, delete, edit or move items in a ListView quite often in my scripts and I got fed up with having to rewrite the code to do it each time. I also wanted to be able to drag items within and between ListViews with the mouse, plus edit the items. So I decided to write a UDF to make life easier and here is the result - GUIListViewEx. If you are interested in how it works, then read this bit - if not, then skip over it: The UDF is pretty easy to use: - You start by creating a ListView (either native or UDF) and passing the returned ControlID/handle and the array you used to fill it to the _Init function of the UDF. You also indicate whether the array has a count in the [0] (or [0][0]) element and if you create an empty ListView, the UDF will still cope and will shadow any items that you insert later. If you have a ListView filled with data but no matching array, there is a function to read that data into an array for you. You can select a colour for the insert mark when dragging items if you are going to use this feature - the default is black - and decide whether to have a shadow of the dragged item follow the mouse. Finally you can set the ListView to be sortable, editable - with various options to determine how the editing process works, determine external drag/drop behaviour and whether user colours are used. - You need to register a few Windows messages, but this is a single call to the _MsgRegister function. If you already have handlers for the relevant messages, there are functions to call within these handlers instead. If you do not want to drag, then you only need the WM_NOTIFY handler loaded. - Then you just need to call the main _Insert($vData), _Delete, _Up, and _Down functions when the appropriate button is pressed, select and drag items, or use one of the edit functions and your ListView responds automatically. - The UDF shadows the contents of the ListView (as explained in the spoiler section above) so you can get its current state at any time with the _ReturnArray function . Many of the functions actually return this data after each call just to help you keep track and there are dedicated Save/Load functions. - If enabled, the user can colour individual items within the ListView - and can set certain elements to be coloured on loading if required. - There are a couple of functions that you need to run in your idle loop if you need the functionality - they detect when items are dragged and edited. - When you have finished with the ListView, you should use the _Close function to clear the memory used by the UDF to shadow its contents. It is not vital, but if you use a lot of ListViews and do not do this, you could end up running out of memory. - You can have as many ListViews as you wish on display at any one time and the same "Insert", "Delete", "Up" and "Down" buttons can be used for them all - you just have to click on the one you want to be active. The UDF also allows you to set the active ListView programatically (_SetActive) - and to determine which is currently active (_GetActive). There are also additional Insert/DeleteSpec functions which allow you to action non-active ListViews. There are 6 example scripts to show the UDF working on native and UDF created ListViews, with single or multiple columns and either filled or empty, along with the UDF itself in this zip file: Credit to martin (for the basic drag code which I found on the forum), the Array UDF authors (for the basis of the array functions) and LarsJ (for the basic colour handler code). Happy for any feedback - hopefully positive! M231 point -
March 22, 2015 (NEW udf version in >post #12 . slight enhancement on index and multindex creation) March 21, 2015 (NEW udf version in >post #12 . slight enhancement on index creation) March 15, 2015 (NEW version in >post #9 below. It also allows creation of simple indexes) March 03, 2015 (NEW improved version in >post #7 below) This is a simple udf to manage 1D or 2D arrays by means of SQL query. I hope it can be useful both for simple educational and testing purposes about SQL that also for the management of arrays in general. New version (it makes use of the new "chain insertion" functionality of SQLite as suggested by jchd in post #5) ; save this as ArraySQL.au3 ; V2 #include-once #include <Array.au3> #include <SQLite.au3> #include <SQLite.dll.au3> ; Global Static $g__sSQliteDll = _SQLite_Startup() Global Static $g__hMemDb = _SQLite_Open() Global $g__sSQLiteError = "" ; will contains SQL error messages ; #FUNCTION# ==================================================================================================================== ; Name...........: _ArraySQL ; Description ...: Allows to execute SQL queryes against 1D or 2D arrays ; Syntax.........: _ArraySQL( ByRef $avArray, $sSQL_Query ) ; Parameters ....: $avArray - an 1D or 2D Array to be manage ; $sSQL_Query - a string containing the SQL query to execute against the array ; the passed array is referred as array as table name in the query ; the fields (column(s)) of the array are referred as column0, column1, column2 .... and so on ; ; Return values .: Success: An 1D or 2D array containing data resulting from the execution of the SQL query. ; ; Fillure: an empty string and the @error value is set as following ; 1 - First argument is not an array ; 2 - not a 1D or 2D array ; 3 - SQLite error. In this case the $g__sSQLiteError global variable contains the error description. ; =============================================================================================================================== Func _ArraySQL(ByRef $avArray, $sSQL_Query) Local $aResult, $iRows, $iColumns, $iRval, $iError $g__sSQLiteError = "" __ArrayToSqlTable($avArray) ; clone $avArray to a temporary sql db table (memory resident) ; name of the temp table will be array ; name of the filed(s) will be column0 column1 column2 columnN and so on .... ; If @error Then Return SetError(@error, 0, "") ; something went wrong ; now execute the SQL query $iRval = _SQLite_GetTable2d(-1, $sSQL_Query, $aResult, $iRows, $iColumns) If Not $iRval = $SQLITE_OK Then ; an SQLite error occurred $g__sSQLiteError = _SQLite_ErrMsg() _SQLite_Exec($g__hMemDb, "DROP TABLE array") ; delete the temporary table Return SetError(3, 0, "") Else $g__sSQLiteError = "" _SQLite_Exec($g__hMemDb, "DROP TABLE array") ; delete the temporary table Return SetError(0, 0, $aResult) EndIf EndFunc ;==>_ArraySQL ; ; #INTERNAL USE# ================================================================================================================ ; Name...........: __ArrayToSqlTable ; Description ...: clone $avArray to a temporary SQLite db table (memory resident) ; Syntax.........: __ArrayToSqlTable ( ByRef $avArray) ; Parameters ....: $avArray - Array to clone to the SQLite temporary table ; ; Remarks .......: For Internal Use Only ; =============================================================================================================================== Func __ArrayToSqlTable(ByRef $avArray) ; Pass an array to a temporary SQL table If Not IsArray($avArray) Then Return SetError(1, 0, 0) ; must be an array Local $iDimensions = UBound($avArray, 0) If $iDimensions > 2 Then Return SetError(2, 0, 0) ; must be an 1D or 2D array Local $aAutoItV = StringSplit(@AutoItVersion, ".", 2), $nAutoItVersion = StringFormat("%03i%03i%03i%03i", $aAutoItV[0], $aAutoItV[1], $aAutoItV[2], $aAutoItV[3]) Local $iStep = 10 ; the number of records we want to load in each chain <---- the chain length If $nAutoItVersion < 3003012000 Then $iStep = 1 ; if an older version of AutoIt then do not use the new SQLite "chain insertion" Local $sDBfields = "" ; will hold the names of the fields (column0, column1, column2......) (zero based) Local $vDBvalues = "" ; will hold the values of a field (1, 'aaa', 456) Local $vDBvaluesChain = "" ; will hold the chain of n values (1, 'aaa', 456), (2, 'bbb', 147), ... , (235, 'xyz', 999) Local $iRecords = UBound($avArray, 1) ; total number of rows in the array Local $iLastRecord = $iRecords - 1 Local $iChains = Ceiling($iRecords / $iStep) ; how many chains we will fill? Local $nRemainders = Mod($iRecords, $iStep) ; are there rmainders? (if so the last chain will be only partly full) Local $iFields = 0 ; we suppose an 1D array If $iDimensions = 2 Then ; if is a 2D array instead $iFields = UBound($avArray, 2) - 1 ; number of fields (columns) in the 2D array (zero based) EndIf For $x = 0 To $iFields $sDBfields &= "column" & String($x) & "," Next $sDBfields = StringTrimRight($sDBfields, 1) ; remove the last comma If Not _SQLite_Exec(-1, "CREATE TEMP TABLE array (" & $sDBfields & ");") = $SQLITE_OK Then $g__sSQLiteError = _SQLite_ErrMsg() ; _SQLite_Exec($g__hMemDb, "DROP TABLE array") ; delete the temporary table Return SetError(3, 0, "") Else #cs suggestion by jchd -> http://www.autoitscript.com/forum/topic/166536-manage-arrays-by-means-of-sql/?p=1216694 For maximizing efficiency of table population using INSERT, you can use the "chain insertion" new syntax: insert into mytable (a,b,c) values (1, 'aaa', 456), (2, 'bbb', 147), (3, 'ccc', 258), ... , (235, 'xyz', 999) You need to keep the query string under the size limit (depends on compile-time options) but you can get N-fold (for some value N) improvement on insert speed with that simple trick. #ce If Not $nRemainders Then ; there are no remainder records. ; then we can load all chains (with group of records) ; and we will have no residual records to manage For $x = 0 To $iLastRecord Step $iStep ; we read records in groups of $iStep $vDBvaluesChain = "" For $iRecord = $x To $x + $iStep - 1 $vDBvalues = "" ___BuildRecord($avArray, $iFields, $vDBvalues, $iRecord) ; build data record related to row $iRecord $vDBvaluesChain &= $vDBvalues & "),(" ; build the chain of records Next $vDBvaluesChain = StringTrimRight($vDBvaluesChain, 3) ; remove last "),(" ; insert chain to table ___InsertChain($sDBfields, $vDBvaluesChain) Next ; Else ; if we are here is because there are remainders, so: If $iChains - 1 Then ; if there are more than 1 chain (otherwise if records are less than $istep read only remainders) For $x = 0 To $iLastRecord - $nRemainders Step $iStep $vDBvaluesChain = "" For $iRecord = $x To $x + $iStep - 1 $vDBvalues = "" ___BuildRecord($avArray, $iFields, $vDBvalues, $iRecord) ; build data record related to row $iRecord $vDBvaluesChain &= $vDBvalues & "),(" ; build the chain of records Next $vDBvaluesChain = StringTrimRight($vDBvaluesChain, 3) ; remove last "),(" ___InsertChain($sDBfields, $vDBvaluesChain) Next EndIf ; -- now read remainders ----- $vDBvaluesChain = "" For $iRecord = $iLastRecord - $nRemainders + 1 To $iLastRecord ; Step $iStep $vDBvalues = "" ___BuildRecord($avArray, $iFields, $vDBvalues, $iRecord) ; build data record related to row $iRecord $vDBvaluesChain &= $vDBvalues & "),(" ; build the chain of records Next $vDBvaluesChain = StringTrimRight($vDBvaluesChain, 3) ; remove last "),(" ___InsertChain($sDBfields, $vDBvaluesChain) EndIf EndIf EndFunc ;==>__ArrayToSqlTable Func ___BuildRecord(ByRef $avArray, ByRef $iFields, ByRef $vDBvalues, ByRef $x) For $y = 0 To $iFields Switch $iFields Case 0 ; just 1 field (1D Array) If IsNumber($avArray[$x]) Then $vDBvalues &= $avArray[$x] & "," Else $vDBvalues &= _SQLite_FastEscape($avArray[$x]) & "," EndIf Case Else ; multi fields (2D Array) If IsNumber($avArray[$x][$y]) Then $vDBvalues &= $avArray[$x][$y] & "," Else $vDBvalues &= _SQLite_FastEscape($avArray[$x][$y]) & "," EndIf EndSwitch Next $vDBvalues = StringTrimRight($vDBvalues, 1) ; remove last comma EndFunc ;==>___BuildRecord Func ___InsertChain(ByRef $sDBfields, ByRef $vDBvaluesChain) If Not _SQLite_Exec(-1, "INSERT INTO array (" & $sDBfields & ") VALUES (" & $vDBvaluesChain & ");") = $SQLITE_OK Then $g__sSQLiteError = _SQLite_ErrMsg() _SQLite_Exec($g__hMemDb, "DROP TABLE array") ; delete the temporary table Return SetError(3, 0, "") EndIf EndFunc ;==>___InsertChain previous version is in the spoiler A simple example of use: #include <ArraySQL.au3> Local $x, $y, $sQuery, $aResult ; ------------------------------------------------------------ ; populate an array with random data to be managed for example Local $Array[1000][5] For $x = 0 To 999 For $y = 0 To 4 $Array[$x][$y] = Random(0, 100, 1) Next Next ; ------------------------------------------------------------ ; returns only rows where first column (column0) contains a value < 10 $sQuery = "SELECT * FROM array WHERE column0 < 10;" $aResult = _ArraySQL($Array, $sQuery) If Not @error Then _ArrayDisplay($aResult, "only data < 10 in column 0") Else MsgBox(0, "error", $g__sSQLiteError) EndIf ; ; returns all rows ordered by first column (column0) and then fourth by column (column3) $sQuery = "SELECT * FROM array ORDER BY column0,column3;" $aResult = _ArraySQL($Array, $sQuery) If Not @error Then _ArrayDisplay($aResult, "Ordered by column 0 and 3") Else MsgBox(0, "error", $g__sSQLiteError) EndIf P.S. improvements, corrections and suggestions are welcome1 point
-
A non-regexp route: $sXML = '<div class="contList" abp="100"><ul class="unstyled" id="categoryList" abp="101"><li class="btn btn-small gradient eleCat" abp="102"><a href="/b2b/Ricerche/FantaRicerca/MostraFiltri?catMerc=HE&codFamiglia=HE0" abp="103">CD PLAYERS</a></li> <li class="btn btn-small gradient eleCat" abp="104"><a href="/b2b/Ricerche/FantaRicerca/MostraFiltri?catMerc=HE&codFamiglia=HE6" abp="105">CD RECORDERS</a></li> <li class="btn btn-small gradient eleCat" abp="106"><a href="/b2b/Ricerche/FantaRicerca/MostraFiltri?catMerc=HE&codFamiglia=HE4" abp="107">CD/CASSETTE PLAYERS</a></li></ul></div>' $oXML = ObjCreate("Microsoft.XMLDOM") $oXML.loadxml($sXML) $oLinks = $oXML.selectNodes("//ul/li/a") For $oLink in $oLinks $sHref = $oLink.getattribute("href") $sAbp = $oLink.getattribute("abp") ConsoleWrite("$sHref=[" & $sHref & "]; $sAbp=[" & $sAbp & "]" & @CRLF) Next output: $sHref=[/b2b/Ricerche/FantaRicerca/MostraFiltri?catMerc=HE&codFamiglia=HE0]; $sAbp=[103] $sHref=[/b2b/Ricerche/FantaRicerca/MostraFiltri?catMerc=HE&codFamiglia=HE6]; $sAbp=[105] $sHref=[/b2b/Ricerche/FantaRicerca/MostraFiltri?catMerc=HE&codFamiglia=HE4]; $sAbp=[107]1 point
-
Here a fast hack for a 2x2 matrix: ;a fast hack version by UEZ #include <Array.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Global $hGUI = GUICreate("2x2 Matrix Invers", 500, 306, -1, -1) Global $iLabel = GUICtrlCreateLabel("2x2 Matrix Invers", 40, 20, 400, 40, $SS_CENTER) GUICtrlSetFont(-1, 20, 400, 0, "Arial", 5) Global $hLabel2 = GUICtrlCreateLabel("Matrix A", 80, 90, 100, 28, $SS_CENTER) GUICtrlSetFont(-1, 20, 400, 0, "Times New Roman", 5) Global $iInput_A = GUICtrlCreateInput("4.25", 80, 130, 40, 30, $SS_CENTER) Global $iInput_B = GUICtrlCreateInput("7/2", 130, 130, 40, 30, $SS_CENTER) Global $iInput_C = GUICtrlCreateInput("3", 80, 165, 40, 30, $SS_CENTER) Global $iInput_D = GUICtrlCreateInput("2", 130, 165, 40, 30, $SS_CENTER) Global $hLabel3 = GUICtrlCreateLabel("Matrix A'", 280, 90, 100, 28, $SS_CENTER) GUICtrlSetFont(-1, 20, 400, 0, "Times New Roman", 5) Global $iInput_Ai = GUICtrlCreateInput("", 280, 130, 100, 30, BitOR($ES_READONLY, $SS_CENTER)) Global $iInput_Bi = GUICtrlCreateInput("", 390, 130, 100, 30, BitOR($ES_READONLY, $SS_CENTER)) Global $iInput_Ci = GUICtrlCreateInput("", 280, 165, 100, 30, BitOR($ES_READONLY, $SS_CENTER)) Global $iInput_Di = GUICtrlCreateInput("", 390, 165, 100, 30, BitOR($ES_READONLY, $SS_CENTER)) Global $iButton = GUICtrlCreateButton("Calculate", 280, 230, 90, 60) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() Exit Case $iButton Calc_InversMatrix() EndSwitch WEnd Func Calc_InversMatrix() Local $aMatrix[2][2] = [[Execute(GUICtrlRead($iInput_A)), Execute(GUICtrlRead($iInput_B))], [Execute(GUICtrlRead($iInput_C)), Execute(GUICtrlRead($iInput_D))]] If Not $aMatrix[1][0] And Not $aMatrix[1][1] Then Return SetError(1, 0, 0) ; -> determinant is zero, therefore inverse matrix doesn't exist Local $fDetA = 1 / ($aMatrix[0][0] * $aMatrix[1][1] - $aMatrix[1][0] * $aMatrix[0][1]), $f $f = Number($fDetA * $aMatrix[1][1]) GUICtrlSetData($iInput_Ai, Float2Frac($f)) GUICtrlSetTip($iInput_Ai, $f) $f = Number($fDetA * -$aMatrix[0][1]) GUICtrlSetData($iInput_Bi, Float2Frac($f)) GUICtrlSetTip($iInput_Bi, $f) $f = Number($fDetA * -$aMatrix[1][0]) GUICtrlSetData($iInput_Ci, Float2Frac($f)) GUICtrlSetTip($iInput_Ci, $f) $f = Number($fDetA * $aMatrix[0][0]) GUICtrlSetData($iInput_Di, Float2Frac($f)) GUICtrlSetTip($iInput_Di, $f) EndFunc ;==>Calc_InversMatrix Func Float2Frac($fFloat, $iAccuracy = 5) ;coded by UEZ If Not IsNumber($fFloat) Then Return SetError(1, 0, 0) Local $iDec = StringLen(StringRegExpReplace($fFloat, "\d+\.(\d*)", "\1")) $iAccuracy = $iAccuracy > 10 ? 10 : $iAccuracy $iDec = $iDec > $iAccuracy ? $iAccuracy : $iDec Local $iZaehler = Round($fFloat * 10 ^ $iDec, 0) Local $iNenner = 10 ^ $iDec Local $iGGT = Number(ggT(Int($iZaehler), Int($iNenner))) ConsoleWrite("Float: " & $fFloat & @CRLF) ConsoleWrite("Dec: " & $iDec & @CRLF) ConsoleWrite("Zaehler: " & $iZaehler & @CRLF) ConsoleWrite("Nenner: " & $iNenner & @CRLF) ConsoleWrite("$iGGT: " & $iGGT & @CRLF) ConsoleWrite($fFloat & " -> " & $iZaehler / $iGGT & " / " & $iNenner / $iGGT & @CRLF & @CRLF) If $iGGT < 0 Then $iZaehler /= $iGGT * -1 $iNenner /= $iGGT * -1 Else $iZaehler /= $iGGT $iNenner /= $iGGT EndIf Return $iZaehler & " / " & $iNenner EndFunc ;==>Float2Frac Func ggT($a, $b) ;coded by UEZ 2012 If Not IsInt($a) Then Return SetError(1, 0, 0) If Not IsInt($b) Then Return SetError(2, 0, 0) If $a = $b Then Return Abs($a) If Not $a And $b Then Return Abs($a) If $a And Not $b Then Return Abs($b) If ($a And $b = 1) Or ($a = 1 And $b) Then Return 1 Local $iMod Do $iMod = Mod($a, $b) If Not $iMod Then ExitLoop $a = $b $b = $iMod Until False Return $b EndFunc ;==>ggT1 point
-
seems you are serious about it, well let me know when you are done so it can be implemented in SciTE. Jos1 point
-
Do you bid i could be able to do it in 5 lines ?1 point
-
sorry to budge in so late, have you noticed that the position of the controls inside tabs are not relative to the tab position? well, what happens if you position the tab outside of the GUI, but leave the controls position unchanged? you get "hidden" tab, with perfectly visible controls: #include <GUIConstantsEx.au3> Example() Func Example() Local $msg GUICreate('"hidden" tab') GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) GUICtrlCreateTab(1000, 10, 200, 100) ; >>>>>>>>>> x=1000 = outside of the GUI Local $gTab0 = GUICtrlCreateTabItem("tab0") GUICtrlCreateLabel("label0", 30, 80, 50, 20) GUICtrlCreateButton("OK0", 20, 50, 50, 20) GUICtrlCreateInput("default", 80, 50, 70, 20) Local $gTab1 = GUICtrlCreateTabItem("tab----1") GUICtrlCreateLabel("label1", 30, 80, 50, 20) GUICtrlCreateCombo("", 20, 50, 60, 120) GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon GUICtrlCreateButton("OK1", 80, 50, 50, 20) Local $gTab2 = GUICtrlCreateTabItem("tab2") GUICtrlSetState(-1, $GUI_SHOW) ; will be display first GUICtrlCreateLabel("label2", 30, 80, 50, 20) GUICtrlCreateButton("OK2", 140, 50, 50) GUICtrlCreateTabItem("") ; end tabitem definition GUICtrlCreateLabel("label3", 20, 130, 50, 20) Local $gShowTab0 = GUICtrlCreateButton('show contents of tab 0', 20, 200, 200, 20) Local $gShowTab1 = GUICtrlCreateButton('show contents of tab 1', 20, 230, 200, 20) Local $gShowTab2 = GUICtrlCreateButton('show contents of tab 2', 20, 260, 200, 20) GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $gShowTab0 GUICtrlSetState($gTab0, $GUI_SHOW) Case $gShowTab1 GUICtrlSetState($gTab1, $GUI_SHOW) Case $gShowTab2 GUICtrlSetState($gTab2, $GUI_SHOW) EndSwitch WEnd EndFunc ;==>Example PRO: you avoid the main window focus loss/regain that is apparent when using child GUI's. CON: transparent controls inside tab have their background color as the tab (i.e. white), not as the GUI.1 point
-
I sincerely don't trust them unless I've written them myself for the task at hand. And it's certainly not something I'd use throughout my company or commercially. Have you tried contacting the vendor? Edit: And as JohnOne said... your parameters are wrong: ControlGetText($Window_title, "", $Control_handle) Or ControlGetText($Control_handle, "", "") Might work. Or WinGetText($Control_handle, "") Might even work.1 point
-
Network Connections Viewer
coffeeturtle reacted to Chance for a topic
Well now since this has been bumped, I was wondering. Is there a way to get process receive/send bytes over network like procexp?1 point -
Please explain ActiveX & COM
SorryButImaNewbie reacted to water for a topic
AutoItX lets you call AutoIt functions from other programmling languages (VBS, C++ ...) COM allows you to interact from Autoit with products like MS Word, Excel, Outlook etc. In the AutoIt program directory there is a subdir called "AutoItX" with a CHM help file and an Examples subdir.1 point