Leaderboard
Popular Content
Showing content with the highest reputation on 04/25/2020 in all areas
-
faustf, I'm pretty sure your life will be much easier if you find yourself a job where you can use your hands. And neither on a mouse nor a keyboard.4 points
-
Excel in art
kurtykurtyboy and one other reacted to Gianni for a topic
An "improper" "unusual" use of Excel the script allows the creation of artistic images by simply coloring the background of the individual cells of the Excel workbook. Although definitely useless ... I find it quite funny though have a good time many thanks to @UEZ , @Malkey , @water p.s. I think the pixelite + color to array process can be simplified, but I used the two ready-made functions provided by UEZ and Malkey. I thank both of you (credits and links in listing) p.p.s. strange behaviour: while excell is filling cells, if you move the mouse pointer off the excell window, the fill speed increases ... (?) ; =============================================================================================================================== ; Name ..........: Excel in art ; Description ...: This script allows the creation of artistic images in Excel from a choosed picture. ; The picture is done by simply coloring the background of the individual cells of an Excel workbook. ; Although definitely useless, I find it quite funny though ; ; Return values .: An artistic image in an Excel workbook ; Author ........: Addiego Gianni (chimp) ; Modified ......: ; Remarks .......: Many thanks to UEZ, Malkey and Water ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== #include <GDIPlus.au3> #include <Excel.au3> _PixelsToCells(50) ; <-- Parameter 50 is the cumber of horizontal Excel cells to be filled MsgBox(64, "All done", "Excel art is ready") Func _PixelsToCells($iHcells = 50) ; Check application object Local $oExcel = _Excel_Open() If Not IsObj($oExcel) Then MsgBox(16, "Error", "Sorry, You need to have 'Excel' intalled") ; Choose Image File Local $sPath = FileOpenDialog("Choose Image File", @ScriptDir & "", "Images (*.gif;*.png;*.jpg;*.bmp)| All (*.*)") If $sPath = '' Then Exit MsgBox(16, "Error", "Sorry, no image was chosen") ; Create a new Excel workbook $oWorkbook = _Excel_BookNew($oExcel, 1) ; initialize GDI+ _GDIPlus_Startup() Local $hBmp = _GDIPlus_BitmapCreateFromFile($sPath) Local $iWidth = _GDIPlus_ImageGetWidth($hBmp) ; get image width ; Local $iHeight = _GDIPlus_ImageGetHeight($hBmp) ; not needed here Local $iStep = $iWidth / $iHcells ; calculate the pixelation factor Local $hBitmap_new = _GDIPlus_PixelateBitmap($hBmp, $iStep) ; pixelate the image Local $aPixelColors = _FileImageToArray($hBitmap_new) ; get pixel colors ; reduce Excel columns width Local $xx = 1, $yy = 1 For $iCol = 0 To UBound($aPixelColors, 2) - 1 Step $iStep $oWorkbook.Sheets(1).Columns($xx).ColumnWidth = 1 $xx += 1 Next ; reduce Excel rows height For $iRow = 0 To UBound($aPixelColors) - 1 Step $iStep $oWorkbook.Sheets(1).Rows($yy).RowHeight = 9 $yy += 1 Next $xx = 1 $yy = 1 For $iRow = 0 To UBound($aPixelColors) - 1 Step $iStep For $iCol = 0 To UBound($aPixelColors, 2) - 1 Step $iStep $oWorkbook.Sheets(1).Range(_Excel_ColumnToLetter($xx) & $yy).Interior.Color = Number("0x" & $aPixelColors[$iRow][$iCol]) $xx += 1 Next $yy += 1 $xx = 1 Next _GDIPlus_BitmapDispose($hBmp) _GDIPlus_Shutdown() EndFunc ;==>_PixelsToCells ; by UEZ ; https://www.autoitscript.com/forum/topic/167707-imagepixelate/?do=findComment&comment=1227509 Func _GDIPlus_PixelateBitmap($hBitmap, $iPixelate, $bSmooth = 1) Local $iWidth = _GDIPlus_ImageGetWidth($hBitmap), $iHeight = _GDIPlus_ImageGetHeight($hBitmap) Local $iNewW = Round($iWidth / $iPixelate, 0), $iNewH = Round($iHeight / $iPixelate, 0) Local $hBitmap_scaled = _GDIPlus_BitmapCreateFromScan0($iNewW, $iNewH) Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap_scaled) Local $iInterpolation = 5 If $bSmooth Then $iInterpolation = $GDIP_INTERPOLATIONMODE_BILINEAR _GDIPlus_GraphicsSetInterpolationMode($hCtxt, $iInterpolation) _GDIPlus_GraphicsDrawImageRect($hCtxt, $hBitmap, 0, 0, $iNewW, $iNewH) _GDIPlus_GraphicsDispose($hCtxt) Local $hBitmap_pixelated = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap_pixelated) _GDIPlus_GraphicsSetInterpolationMode($hCtxt, $GDIP_INTERPOLATIONMODE_NearestNeighbor) _GDIPlus_GraphicsDrawImageRectRect($hCtxt, $hBitmap_scaled, 0, 0, $iNewW, $iNewH, -$iPixelate, -$iPixelate, $iWidth + 2 * $iPixelate, $iHeight + 2 * $iPixelate) _GDIPlus_GraphicsDispose($hCtxt) Return $hBitmap_pixelated EndFunc ;==>_GDIPlus_PixelateBitmap ; by Malkey ; https://www.autoitscript.com/forum/topic/112540-is-there-a-function-for-reading-images-into-2d-arrays/?do=findComment&comment=788472 Func _FileImageToArray($hImage) Local $Reslt, $stride, $format, $Scan0, $iIW, $iIH ; , $hImage Local $v_Buffer, $width, $height ; _GDIPlus_Startup() ; $hImage = _GDIPlus_ImageLoadFromFile($sFileName) $iIW = _GDIPlus_ImageGetWidth($hImage) $iIH = _GDIPlus_ImageGetHeight($hImage) ProgressOn("Progress Bar", "Filling a " & $iIW & " x " & $iIH & " size array.", "0 percent") $Reslt = _GDIPlus_BitmapLockBits($hImage, 0, 0, $iIW, $iIH, $GDIP_ILMREAD, $GDIP_PXF32ARGB) ;Get the returned values of _GDIPlus_BitmapLockBits () $width = DllStructGetData($Reslt, "width") $height = DllStructGetData($Reslt, "height") $stride = DllStructGetData($Reslt, "stride") $format = DllStructGetData($Reslt, "format") $Scan0 = DllStructGetData($Reslt, "Scan0") Local $aArray[$height][$width] For $j = 0 To $iIH - 1 For $i = 0 To $iIW - 1 $v_Buffer = DllStructCreate("dword", $Scan0 + ($j * $stride) + ($i * 4)) $aArray[$j][$i] = StringRegExpReplace(Hex(DllStructGetData($v_Buffer, 1), 6), "(.{2})(.{2})(.{2})", "\3\2\1") ; To RGB format Next ProgressSet(Int(100 * $j / ($iIH)), Int(100 * $j / ($iIH)) & " percent") Next _GDIPlus_BitmapUnlockBits($hImage, $Reslt) ProgressOff() _GDIPlus_ImageDispose($hImage) Return $aArray EndFunc ;==>_FileImageToArray2 points -
Hi folks! It´s update time again! ISN AutoIt Studio Version 1.11 is now online! In addition, a first version of the long delayed "KODA (.kxf) to ISN Form Studio 2 (.isf) Converter" is now available for download as ISN Plugin on my website! Special thanks this time to Fernando R.! (For beta testing) Have fun with it, and as always: feedback is welcome! 😎 Here the detailed changelog:2 points
-
Ahem! ... An integer may be signed and "1.0" is converted to an integer (not a double). So back to drawing board for both == and regex guys!2 points
-
Here is a idispatch object with all the base code written in assembly and is setup in a way so that it can be easily modified to integrate your own custom methods with minimal overhead code. Credits to @genius257 (and @trancexx for helping him) for his AutoitObject udf. I learned a tremendous amount from his code and a lot of the assembly is based of his work so many many thanks! Credits also to @LarsJ for his Accessing Autoit Variables thread showing us that we can expose the autoit variables via objects and how to work with the autoit variants/safearrays within assembly code. As mentioned above this is setup for you to modify so there's not a lot of functions you'll be calling directly and a good amount of code you should not have to touch but I'm going to explain the parts that your expected modify and how that code links to the functions you should not have to mess with. There's really only two spots. The first part is your function table. At the top of the IDispatchASM() function you will find a variable like code below called $sFunctions and will get used in two functions; _CreateFuncTable() and _AsmFuncTable(). You don't call these functions but that's where it gets used. One function gathers all the addresses of the functions and the other generates the assembly code allowing you to easily call these functions within your assembly code. The format is one dll per line with a comma separated list of functions for that dll. There is also one line included for autoit functions and will handle registering and releasing the callbacks so its all nicely in one spot. Local $sFunctions = 'kernel32.dll:HeapAlloc,GlobalAlloc,GlobalFree,GlobalLock,GlobalHandle,RtlMoveMemory' & @LF & _ 'oleaut32.dll:VariantInit,VariantCopy,VariantClear,' & @LF & _ 'au3:' & _RegisterAu3Callbacks('_CreateArray,ptr,dword|_GetKeys,ptr,ptr') To call any of function in the list, you just need to first load up a register with the current memory position and call that register with the function name added to it. Here's some small snips from the code showing what I mean: _('getmempos ebx'); load ebx with memory pos ..code... _('stdcall [ebx+_CreateArray], [esi+tObj.count]'); call autoit function to create an array for us to fill ..code... _('stdcall [ebx+VariantClear], [pVarResult]') _('stdcall [ebx+VariantCopy], [pVarResult],[edx+tProp.Variant]'); copy array to result _('stdcall [ebx+_CreateArray],0'); release object The second area that you will modify is the _invoke function and you would do this to add your own methods. All the methods that are currently included are completely optional and can be replaced/removed if you choose. Whats there right now is more or less practice. All you have to do to add your own method is create a new .elseif statement with the ID your assigning and name of method. Just follow the pattern like below. The _DefineDispID() function works hand in hand with the _AsmDispIDChecks() to automatically generate the lookup code needed to lookup the ID's. The only important part to remember when creating your own methods is that they MUST begin with characters "__" and you must use a negative ID starting at -2. I've written the lookup code to only check if this is one of our methods being called when the first 2 characters begin with "__" - this saves a lot of extra checking going on when its not a method being called. ;===================================== _(' .elseif dword[dispIdMember] = ' & _DefineDispID(-5,'__keys')); .. _(' getmempos ebx') ...code... _(' stdcall [ebx+_CreateArray],0'); release object ;===================================== _(' .elseif dword[dispIdMember] = ' & _DefineDispID(-6,'__fill')); _(' mov esi, [pDispParams]') ...code... _(' xor eax,eax'); set return S_OK ;===================================== _(' .elseif dword[dispIdMember] = ' & _DefineDispID(-7,'__reverse')) ; _(' mov esi, [pDispParams]') ...code... _(' xor eax,eax'); set return S_OK ;===================================== Let me know if you have issues, questions or comments. Thanks for looking Update 05/24/2020: I got x64 support working for this now. I didn't get all the methods converted but all the base code is there it looks to be stable (fingers crossed). It should be able to run this portion of the example either 32bit or 64bit. Example: Local $aArray = [111, 222, 333] $oIDispatch = IDispatchASM() $oIDispatch.string = "string test" $oIDispatch.__string = "__string test2" $oIDispatch.float = 12.345145 $oIDispatch.array = $aArray $oIDispatch.binary = Binary(12345678) $oIDispatch.bool = True $oIDispatch.dllStruct = DllStructCreate("BYTE t") $oIDispatch.dllStruct.t = 99 ConsoleWrite('-Direct get test:' & @CRLF & _ '$oIDispatch.string = ' & $oIDispatch.string & @CRLF & _ '$oIDispatch.__string = ' & $oIDispatch.__string & @CRLF & _ '$oIDispatch.float = ' & $oIDispatch.float & @CRLF & _ '$oIDispatch.array[1] = ' & $oIDispatch.array[1] & @CRLF) ConsoleWrite('-method __keysau3 test:' & @CRLF) Local $aKeyAU3s = $oIDispatch.__keysau3() ConsoleWrite('$aKeyAU3s = ' & _ArrayToString($aKeyAU3s) & @CRLF) ConsoleWrite('-method __get test:' & @CRLF) For $k In $oIDispatch.__keysau3() $val = $oIDispatch.__get($k) ConsoleWrite('$oIDispatch.' & $k & ' = ' & (IsArray($val) ? _ArrayToString($val) : (IsDllStruct($val) ? DllStructGetData($val, 1) : $val)) & @CRLF) Next ConsoleWrite('-method __set test:' & @CRLF) Local $i = 0 For $k In $oIDispatch.__keysau3() $oIDispatch.__set($k) = $i ConsoleWrite('$oIDispatch.' & $k & ' = ' & $oIDispatch.__get($k) & @CRLF) $i += 1 Next Output: -Direct get test: $oIDispatch.string = string test $oIDispatch.__string = __string test2 $oIDispatch.float = 12.345145 $oIDispatch.array[1] = 222 -method __keysau3 test: $aKeyAU3s = string|__string|float|array|binary|bool|dllStruct -method __get test: $oIDispatch.string = string test $oIDispatch.__string = __string test2 $oIDispatch.float = 12.345145 $oIDispatch.array = 111|222|333 $oIDispatch.binary = 0x4E61BC00 $oIDispatch.bool = True $oIDispatch.dllStruct = 99 -method __set test: $oIDispatch.string = 0 $oIDispatch.__string = 1 $oIDispatch.float = 2 $oIDispatch.array = 3 $oIDispatch.binary = 4 $oIDispatch.bool = 5 $oIDispatch.dllStruct = 6 I also added 2 more methods to the 32bit part. __PrintAllParms shows how to check the number of parms that were passed and then prints each one to the console. The second is __search and is generic (1D) array search method demonstrating the use of VarCmp function. That would be a key function in creating a arraysort as well. Let me know if you have any issues. Thanks! Edit: Fixed issue with beta versions of autoit not working IDispatchASM 5-24-2020.zip Previous versions:1 point
-
That won't work. I see now where you are mixing up the functioning of the stream. CMD.exe cannot send at 2 different places the same stream. So it sends with consoleWrite, and it is captured by the script. It is impossible to send it somewhere else, since we are hook to its stream. The fact that it is showing in a DOS console, it is because the script writes to it in CUI mode. I do not believe there is any other possibilities. Of course, I could be wrong, it happened in the past...1 point
-
Further ideas can be found on the ExcelChart examples thread or the UDF page: Thermometer: Gauge: Bug, Coelacanth, Dragonfly:1 point
-
the names of the user special folders are language-dependent, so e.g. the Downloads folder may not always be titled "Downloads". you can retrieve the correct folders either from the registry or by using the function _WinAPI_ShellGetKnownFolderPath().1 point
-
Last test version with fixed version of Number() Local $aInts =["", "1", "00001", "1.00", "1e0", "001.e0", "1e-0", "1e2", "1.0e+2", "9223372036854775807", "9223372036854775808", "10000000000000000000", "1000000000000000000.0", "1e120"] For $s In $aInts ConsoleWrite($s & @TAB & IsInt(Number($s)) & @TAB & VarGetType(Number($s)) & @TAB & Number($s) & @TAB & "==>" & @TAB & VarGetType(_Number($s)) & @TAB & _Number($s) & @LF) ConsoleWrite("+" & $s & @TAB & IsInt(Number($s)) & @TAB & VarGetType(Number($s)) & @TAB & Number("+" & $s) & @TAB & "==>" & @TAB & VarGetType(_Number("+" & $s)) & @TAB & _Number("+" & $s) & @LF) ConsoleWrite("-" & $s & @TAB & IsInt(Number($s)) & @TAB & VarGetType(Number($s)) & @TAB & Number("-" & $s) & @TAB & "==>" & @TAB & VarGetType(_Number("-" & $s)) & @TAB & _Number("-" & $s) & @LF & @LF) Next ; That's the unnoticed bug AFAIK ConsoleWrite("33333333333333333333 gets erroneously converted to MaxInt64 = " & Number("33333333333333333333") & @LF & @LF) ; fixed version of Number() Func _Number($s) Local $a = StringRegExp($s, "^([-+]?)0*(\d+)$", 1) If Not @error Then Local $l = StringLen($a[1]) ; in case the int is oversized If $l > 19 Or ($a[0] <> "-" And $a[1] > "9223372036854775807") Or ($a[0] = "-" And $a[1] > "9223372036854775808") Then Return Number($s & ".0") EndIf Return Number($s) EndFunc Again sorry for multiple edits but I kept discovering missing cases. I regard the current behavior of Number($s) as buggy when it silently converts input outside the Int64 range to MaxInt64 or MinInt64. Also the exemple in help is missing the minus sign: Local $dNumber13 = Number("-30") ; Returns 301 point
-
IS this by design?
FrancescoDiMuro reacted to TheDcoder for a topic
@FrancescoDiMuro I only wanted to point out that OP was already using regex, but thanks for sharing the RegEx version1 point -
This could be an approach to test a variable whether it contains an INT, either as number or string: _TestInt("1028") _TestInt(1028) _TestInt(1028.5) _TestInt("1028.5") _TestInt("test") Func _TestInt($istr) If _IsInt($istr) Then ConsoleWrite($istr & " is INT" & @CRLF) Else ConsoleWrite($istr & " is not an INT" & @CRLF) EndIf EndFunc ; Test whether the variable contains an INT value either as string of number Func _IsInt($istr) Return $istr == Int($istr) EndFunc ;==>_IsInt Jos1 point
-
Help with saving configurations in a GUI
faustf reacted to FrancescoDiMuro for a topic
Hi @Sajadaliraqi, and welcome to the AutoIt forums You can use a flat file, or a SQLite DB to save your data permantly, and, to design a GUI, try to use Koda, which is in the Program Files (x86)\SciTE\Koda directory; from there, just use _GUICtrlListView_DeleteItem() to delete a specific item. Use the code <> tag when you post the code, so it doesn't mess up!1 point -
You must make it CUI and compile it. Then it will show in DOS console otherwise Scite will take care of it Use _WinAPI_OemToChar () to convert the DOS output.1 point
-
@careca I think you got a great idea here in keeping the stream open. I will try this in morning using cmd.exe as the base run. Allow me to totally disagree with you on this one. It is not a good practice to pull every single variables out of functions to make them Global (even though you have declared them Local, but the fact is that they are global). Good practices are, on the contrary, to reduce the use of global variables, as it makes large programs harder to follow and debug.1 point
-
Thank you Subz and Nine, you guys are fantastic. You've given me lots to work with. I'll be back in touch when I get further along with this.1 point
-
That would return an error, since 'marionette-port' isn't a recognized option. Instead, you would want to do something like this -- _WD_Option('DriverParams', '--marionette-port 2828') This value will then be passed as a parameter to the designated webdriver when you call _WD_Startup.1 point
-
Updated - 2/9/2010 - So there have been quite a few improvents since my last update 2 days ago. Added five new functions, User Calltips and Keywords, and also made changes to _SLG_UpdateGraph() and _SLG_CreateGraph() so be sure to look at the examples(and thumb) since they are new and show how too use the new functions. 5 new functions: _SLG_AddLine(), _SLG_SetLineValue(), _SLG_SetLineWidth(), _SLG_SetGridLineColor(), _SLG_EnableGridLines()-Thanks UEZ Updated 2/7/2010 - made negative value ranges possible. Here is a UDF I have been working on lately to help create scrolling line graphs. Like the ones you see for the CPU in Task Manager. Please let me know if you see or have any problems. I also want to thank and give some credit to monoceres for all his examples around the forums. I would have never made it this far without them. Example 1 #include "SLG.au3" Opt('GuiOnEventMode', 1) $GUI = GUICreate("GDI+ Scrolling Line Graph", 628, 297, -1, -1, -1, $WS_EX_TOPMOST) GUISetOnEvent(-3, '_Exit') GUISetState() $Increments = 100 $Graph1 = _SLG_CreateGraph($GUI, 18, 18, 596, 257, -100, 100, $Increments, -1,-1,-1,False) While 1 _SLG_SetLineValue($Graph1, Random(-100,100)) _SLG_UpdateGraph($Graph1) Sleep(30) WEnd Func _Exit() Exit EndFunc Example 2 #include <StaticConstants.au3> #include "SLG.au3" Opt('GuiOnEventMode', 1) Const $cBlue = 0xFF00ACFF, $cGreen = 0xFF00FF00, $cPink = 0xFFF004DE, $cYellow = 0xFFFFFF00 Const $cGray = 0xFFADADAD, $cRed = 0xFFFF0000, $cPurple = 0xFF8000FF, $cOrange = 0xFFFF8000 Const $Pi = ACos(-1), $4Pi = $Pi / 4 $GUI = GUICreate("GDI+ Scrolling Line Graph", 628, 297, -1, -1, -1, $WS_EX_TOPMOST) GUISetOnEvent(-3, '_Exit') $Label1 = GUICtrlCreateLabel("Graph 1", 66, 36, 192, 53, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Graph 2", 372, 36, 192, 53, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUISetState() $Increments = 85 $Graph1 = _SLG_CreateGraph($GUI, 18, 114, 283, 157, -1.01, 1.01, $Increments, $cPink, 2, -1, False) $G1Line2 = _SLG_AddLine($Graph1, $cGreen) $G1Line3 = _SLG_AddLine($Graph1, $cBlue) $Graph2 = _SLG_CreateGraph($GUI, 324, 114, 283, 157, -1.01, 1.01, $Increments, $cBlue) _SLG_SetGridLineColor($Graph2, 0xFF5C5C5C) $G2Line2 = _SLG_AddLine($Graph2, $cGreen) $G2Line3 = _SLG_AddLine($Graph2, $cRed) While 1 For $i = 0 To (2 * $Pi) Step 0.1 _SLG_SetLineValue($Graph1, Sin($i)) _SLG_SetLineValue($Graph2, Sin($i)) For $Line = $G1Line2 To $G1Line3 $y = Sin($i + ($4Pi * ($Line - 1))) _SLG_SetLineValue($Graph1, $y, $Line) Next For $Line = $G2Line2 To $G2Line3 $y = Sin($i + ($4Pi * ($Line - 1))) _SLG_SetLineValue($Graph2, $y, $Line) Next _SLG_UpdateGraph($Graph1) _SLG_UpdateGraph($Graph2) Sleep(25) Next WEnd Func _Exit() Exit EndFunc ;==>_Exit UDF #Region Header ; #INDEX# ======================================================================================================================= ; Title .........: SLG ; AutoIt Version : 3.3.4.0 ; Language ......: English ; Description ...: Functions to assist in creating and updating Scrolling Line Graphs ; Author(s) .....: Beege ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ;_SLG_CreateGraph ;_SLG_UpdateGraph ;_SLG_ClearGraph ;_SLG_SetLineColor ;_SLG_SetYRange ;_SLG_SetBackGroundColor ;_SLG_AddLine ;_SLG_SetLineValue ;_SLG_SetLineWidth ;_SLG_EnableGridLines ;_SLG_SetGridLineColor ; =============================================================================================================================== #Region User KeyWords and CallTips #cs Keywords: au3.keywords.user.udfs= _slg_creategraph _slg_updategraph _slg_cleargraph \ _slg_setlinecolor _slg_setyrange _slg_setbackgroundcolor _slg_addline \ _slg_setlinevalue _slg_setlinewidth _slg_enablegridlines _slg_setgridlinecolor CallTips: _SLG_CreateGraph($hGUI, $iLeft, $iTop, $iWidth, $iHeight, $iY_Min, $iY_Max, $iIncrements, $Line_Color = 0xFF00FF00, $Line_Width = 2, $iBackGround = 0xFF000000, $bGridlines = True) _SLG_UpdateGraph($iIndex) _SLG_AddLine($iIndex, $Line_Color = 0xFF00FF00, $Line_Width = 2) _SLG_ClearGraph($iIndex) _SLG_SetLineValue($iIndex, $iValue, $iLine = 1) _SLG_SetLineColor($iIndex, $iARGB, $iLine = 1) _SLG_SetLineWidth($iIndex, $iWidth, $iLine = 1) _SLG_SetYRange($iIndex, $iY_Min, $iY_Max) _SLG_SetBackGroundColor($iIndex, $iARGB = 0xFF000000) _SLG_SetGridLineColor($iIndex, $iARGB = Default) _SLG_EnableGridLines($iIndex, $bGridlines = True) #ce #EndRegion #include-once #include <GDIPlus.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() OnAutoItExitRegister('_SLG_Exit') #EndRegion Header #Region Global Variables and Constants Global Enum $g_hGraphic, $g_hBitmap, $g_hBuffer, $g_aPens, $g_iLeft, $g_iTop, $g_iWidth, $g_iHeight, $g_iIncrements, _ $g_iIncrement_Size, $g_iShift_Distance, $g_iY, $g_iY_Last, $g_iY_Min, $g_iY_Max, $g_iY_Range, $g_hDC, $g_hGUI, $g_iBackColor, _ $g_iX_counter, $g_iY_counter, $g_iX_counter_mem, $g_bGridlines, $g_iGridColor, $MAX Global $aGraphs[1][$MAX] $aGraphs[0][0] = 0 #cs $aGraphs[0][0] = List Count [0][1-17] = Nothing $aGraphs[$i][0] = $Graphic Object Handle [$i][$g_hBitmap] = Bitmap Object Handle [$i][$g_hBuffer] = Buffer Handle [$i][$g_iLeft] = Left [$i][$g_iTop] = Top [$i][$g_iWidth] = Width [$i][$g_iHeight] = Height [$i][$g_iIncrements] = Step Count [$i][$g_iIncrement_Size]= Step Size [$i][$g_iShift_Distance]= Shift Distance [$i][$g_iY_Min] = Y Min [$i][$g_iY_Max] = Y Max [$i][$g_iY_Range] = Y Range [$i][$g_hDC] = Display device context Handle [$i][$g_hGUI] = GUI Handle [$i][$g_iBackColor] = BackGround Color value [$i][$g_iY_Last] = Array containing Last Y Cordnate for each Line [$i][$g_iY] = Array containing Y Cordnate for each Line [$i][$g_aPens] = Array containing Pen Handles for each Line [$i][$g_bGridlines] = Draw GridLines flag [$i][$g_iGridColor] = GridLines Color Value [$i][$g_iX_counter] = Counter for X GridLines [$i][$g_iY_counter] = Counter for Y GridLines [$i][$g_iX_counter_mem] = Original Counter Value #ce #EndRegion Global Variables and Constants #Region Public Functions ; #FUNCTION# ==================================================================================================================== ; Name...........: _SLG_CreateGraph ; Description ...: Creates a Scrolling Line Graph ; Syntax.........: _SLG_CreateGraph($hGUI, $iLeft, $iTop, $iWidth, $iHeight, $iY_Min, $iY_Max, $iIncrement_Total, $Line_Color = 0xFF00FF00, $iBackGround = 0xFF000000) ; Parameters ....: $hGUI - Handle to parent or owner window ; $iLeft - Left side of the graph ; $iTop - Top side of the graph ; $iWidth - Width of the graph ; $iHeight - Height of the graph ; $iY_Min - Minimum Y Value ; $iY_Max - Maximum Y Value ; $iIncrements - How many parts the Graph is divided up into. More Parts means more history.. ; $Line_Color - Alpha, Red, Green and Blue Hex Value. (0xAARRGGBB). Default = Green ; $iLine_Width - Line Width. Default = 1 ; $iBackGround - BackGround Color. Alpha, Red, Green and Blue Hex Value. (0xAARRGGBB). Default = Black ; $bGridlines - Enable Gridlines. Default = True ; Return values .: Success - Graph Index ; Author ........: Beege ; Remarks .......: Line index of line created is 1. ; =============================================================================================================================== Func _SLG_CreateGraph($hGUI, $iLeft, $iTop, $iWidth, $iHeight, $iY_Min, $iY_Max, $iIncrements, $Line_Color = 0xFF00FF00, $iLine_Width = 2, $iBackGround = 0xFF000000, $bGridlines = True) ReDim $aGraphs[UBound($aGraphs) + 1][UBound($aGraphs, 2)] $aGraphs[0][0] += 1 If $Line_Color = -1 Or $Line_Color = Default Then $Line_Color = 0xFF00FF00 If $iBackGround = -1 Or $iBackGround = Default Then $iBackGround = 0xFF000000 If $iLine_Width = -1 Or $iLine_Width = Default Then $iLine_Width = 2 If $bGridlines = -1 Or $bGridlines = Default Then $bGridlines = True $aGraphs[$aGraphs[0][0]][$g_hGraphic] = _GDIPlus_GraphicsCreateFromHWND($hGUI) $aGraphs[$aGraphs[0][0]][$g_hBitmap] = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $aGraphs[$aGraphs[0][0]][$g_hGraphic]) $aGraphs[$aGraphs[0][0]][$g_hBuffer] = _GDIPlus_ImageGetGraphicsContext($aGraphs[$aGraphs[0][0]][$g_hBitmap]) $aGraphs[$aGraphs[0][0]][$g_iLeft] = $iLeft $aGraphs[$aGraphs[0][0]][$g_iTop] = $iTop $aGraphs[$aGraphs[0][0]][$g_iWidth] = $iWidth $aGraphs[$aGraphs[0][0]][$g_iHeight] = $iHeight $aGraphs[$aGraphs[0][0]][$g_iIncrements] = $iIncrements $aGraphs[$aGraphs[0][0]][$g_iIncrement_Size] = Int($iWidth / $iIncrements) $aGraphs[$aGraphs[0][0]][$g_iShift_Distance] = $iWidth - $aGraphs[$aGraphs[0][0]][$g_iIncrement_Size] _SLG_AddLine($aGraphs[0][0], $Line_Color, $iLine_Width) $aGraphs[$aGraphs[0][0]][$g_iY_Min] = $iY_Min $aGraphs[$aGraphs[0][0]][$g_iY_Max] = $iY_Max _SLG_SetYRange($aGraphs[0][0], $iY_Min, $iY_Max) $aGraphs[$aGraphs[0][0]][$g_hDC] = _WinAPI_GetDC($hGUI) $aGraphs[$aGraphs[0][0]][$g_hGUI] = $hGUI _SLG_SetBackGroundColor($aGraphs[0][0], BitOR($iBackGround, 0xFF000000)) $aGraphs[$aGraphs[0][0]][$g_bGridlines] = $bGridlines $aGraphs[$aGraphs[0][0]][$g_iX_counter] = 20;$iX_c $aGraphs[$aGraphs[0][0]][$g_iX_counter_mem] = 20;$iX_c $aGraphs[$aGraphs[0][0]][$g_iY_counter] = 20;$iY_c $aGraphs[$aGraphs[0][0]][$g_iGridColor] = Default _GDIPlus_GraphicsSetSmoothingMode($aGraphs[$aGraphs[0][0]][$g_hBuffer], 2) _GDIPlus_GraphicsClear($aGraphs[$aGraphs[0][0]][$g_hBuffer], $aGraphs[$aGraphs[0][0]][$g_iBackColor]); If $bGridlines Then _FullGridLines($aGraphs[0][0]) Return $aGraphs[0][0] EndFunc ;==>_SLG_CreateGraph ; #FUNCTION# ==================================================================================================================== ; Name...........: _SLG_UpdateGraph ; Description ...: Updates Line Graph with new values ; Syntax.........: _SLG_UpdateGraph($iIndex, $iValue) ; Parameters ....: $iIndex - Index returned from _SLG_CreateGraph() ; Return values .: Success - 1 ; Failure - 0 and sets @ERROR: ; - 1 Invalid iIndex ; Author ........: Beege ; Remarks .......: All Lines of the graph must be updated before calling this function. ; =============================================================================================================================== Func _SLG_UpdateGraph($iIndex) If $iIndex > $aGraphs[0][0] Then Return SetError(1, @extended, 0) Local $aLineY = $aGraphs[$iIndex][$g_iY] For $i = 1 To $aLineY[0] If Not $aLineY[$i] Then Return Next Local $hShift_Section = _GDIPlus_BitmapCloneArea($aGraphs[$iIndex][$g_hBitmap], $aGraphs[$iIndex][$g_iIncrement_Size], 0, $aGraphs[$iIndex][$g_iShift_Distance], $aGraphs[$iIndex][$g_iHeight]); _GDIPlus_GraphicsClear($aGraphs[$iIndex][$g_hBuffer], $aGraphs[$iIndex][$g_iBackColor]); _GDIPlus_GraphicsDrawImageRect($aGraphs[$iIndex][$g_hBuffer], $hShift_Section, 0, 0, $aGraphs[$iIndex][$g_iShift_Distance], $aGraphs[$iIndex][$g_iHeight]) If $aGraphs[$iIndex][$g_bGridlines] Then _AddGridLines($iIndex) Local $aLineYLast = $aGraphs[$iIndex][$g_iY_Last] Local $aPens = $aGraphs[$iIndex][$g_aPens] For $i = 1 To $aLineYLast[0] _GDIPlus_GraphicsDrawLine($aGraphs[$iIndex][$g_hBuffer], $aGraphs[$iIndex][$g_iShift_Distance] - 1, $aLineYLast[$i], $aGraphs[$iIndex][$g_iWidth] - 1, $aLineY[$i], $aPens[$i]) Next _WriteBuffer($iIndex) _GDIPlus_BitmapDispose($hShift_Section) For $i = 1 To $aLineY[0] $aLineYLast[$i] = $aLineY[$i] Next $aGraphs[$iIndex][$g_iY_Last] = $aLineYLast Return 1 EndFunc ;==>_SLG_UpdateGraph ; #FUNCTION# ==================================================================================================================== ; Name...........: _SLG_SetLineValue ; Description ...: Sets Line value ; Syntax.........: _SLG_SetLineValue($iIndex, $iValue, $iLine = 1) ; Parameters ....: $iIndex - Index returned from _SLG_CreateGraph() ; $iValue - Value to add to graph ; $iLine - Line index returned from _SLG_AddLine() ; Return values .: Success - 1 ; Failure - 0 and sets @ERROR: ; - 1 Invalid iIndex ; Author ........: Beege ; Remarks .......: If your graph only has 1 line then the line index is 1 ; =============================================================================================================================== Func _SLG_SetLineValue($iIndex, $iValue, $iLine = 1) If $iIndex > $aGraphs[0][0] Then Return SetError(1, @extended, 0) If $iValue > $aGraphs[$iIndex][$g_iY_Max] Then $iValue = $aGraphs[$iIndex][$g_iY_Max] ElseIf $iValue < $aGraphs[$iIndex][$g_iY_Min] Then $iValue = $aGraphs[$iIndex][$g_iY_Min] EndIf Local $Percent = Abs($iValue - $aGraphs[$iIndex][$g_iY_Min]) / $aGraphs[$iIndex][$g_iY_Range] If $Percent > .992 Then $Percent = .992 Local $iY = Int($aGraphs[$iIndex][$g_iHeight] - ($Percent * $aGraphs[$iIndex][$g_iHeight])) Local $aLineYLast = $aGraphs[$iIndex][$g_iY_Last] If Not $aLineYLast[$iLine] Then $aLineYLast[$iLine] = $iY $aGraphs[$iIndex][$g_iY_Last] = $aLineYLast Return 0 Else Local $aLineY = $aGraphs[$iIndex][$g_iY] $aLineY[$iLine] = $iY $aGraphs[$iIndex][$g_iY] = $aLineY Return 1 EndIf EndFunc ;==>_SLG_SetLineValue ; #FUNCTION# ==================================================================================================================== ; Name...........: _SLG_AddLine ; Description ...: Adds additional lines to the graph ; Syntax.........: _SLG_AddLine($iIndex, $Line_Color = 0xFF00FF00, $Line_Width = 1) ; Parameters ....: $iIndex - Index returned from _SLG_CreateGraph() ; $iLine_Color - Alpha, Red, Green and Blue Hex Value. (0xAARRGGBB) ; $Line_Width - Line Width ; Return values .: Success - Line Index ; Failure - 0 and sets @ERROR: ; - 1 Invalid iIndex ; Author ........: Beege ; Remarks .......: Every line must have its value set before you can call _SLG_UpdateGraph() ; =============================================================================================================================== Func _SLG_AddLine($iIndex, $Line_Color = 0xFF00FF00, $Line_Width = 2) If $iIndex > $aGraphs[0][0] Then Return SetError(1, @extended, 0) If $Line_Color = -1 Or $Line_Color = Default Then $Line_Color = 0xFF00FF00 If $Line_Width = -1 Or $Line_Width = Default Then $Line_Width = 1 Local $aLinesY = $aGraphs[$iIndex][$g_iY] Local $aLinesYLast = $aGraphs[$iIndex][$g_iY_Last] Local $aPens = $aGraphs[$iIndex][$g_aPens] If Not IsArray($aLinesYLast) Then Local $aLinesY[1] = [0] Local $aLinesYLast[1] = [0] Local $aPens[1] = [0] EndIf ReDim $aLinesYLast[UBound($aLinesYLast) + 1] ReDim $aLinesY[UBound($aLinesY) + 1] ReDim $aPens[UBound($aPens) + 1] $aLinesYLast[0] += 1 $aLinesY[0] += 1 $aPens[0] += 1 $aLinesYLast[$aLinesYLast[0]] = False $aLinesY[$aLinesY[0]] = False $aPens[$aPens[0]] = _GDIPlus_PenCreate($Line_Color, $Line_Width) $aGraphs[$iIndex][$g_iY_Last] = $aLinesYLast $aGraphs[$iIndex][$g_iY] = $aLinesY $aGraphs[$iIndex][$g_aPens] = $aPens Return $aLinesY[0] EndFunc ;==>_SLG_AddLine ; #FUNCTION# ==================================================================================================================== ; Name...........: _SLG_SetLineColor ; Description ...: Sets Line Color of Graph ; Syntax.........: _SLG_SetLineColor($iIndex, $iARGB) ; Parameters ....: $iIndex - Index returned from _SLG_CreateGraph() ; $iValue - Alpha, Red, Green and Blue Hex Value. (0xAARRGGBB) ; $iLine - Line index returned from _SLG_AddLine() ; Return values .: Success - 1 ; Failure - 0 and sets @ERROR: ; - 1 Invalid iIndex ; - 2 Invalid iLine ; - 3 Error setting pen color ; Author ........: Beege ; Remarks .......: If your graph only has 1 line then the line index is 1 ; =============================================================================================================================== Func _SLG_SetLineColor($iIndex, $iARGB, $iLine = 1) If $iIndex > $aGraphs[0][0] Then Return SetError(1, @extended, 0) Local $aPens = $aGraphs[$iIndex][$g_aPens] If $iLine > $aPens[0] Then Return SetError(2, @extended, 0) _GDIPlus_PenSetColor($aPens[$iLine], $iARGB) If @error Then Return SetError(3, @extended, 0) Return 1 EndFunc ;==>_SLG_SetLineColor ; #FUNCTION# ==================================================================================================================== ; Name...........: _SLG_SetLineWidth ; Description ...: Sets Line Width ; Syntax.........: _SLG_SetLineWidth($iIndex, $iWidth, $iLine = 1) ; Parameters ....: $iIndex - Index returned from _SLG_CreateGraph() ; $iValue - Width of Line ; $iLine - Line index returned from _SLG_AddLine() ; Return values .: Success - 1 ; Failure - 0 and sets @ERROR: ; - 1 Invalid iIndex ; - 2 Invalid iLine index ; - 3 Error setting pen width ; Author ........: Beege ; Remarks .......: If your graph only has 1 line then the line index is 1 ; =============================================================================================================================== Func _SLG_SetLineWidth($iIndex, $iWidth, $iLine = 1) If $iIndex > $aGraphs[0][0] Then Return SetError(1, @extended, 0) Local $aPens = $aGraphs[$iIndex][$g_aPens] If $iLine > $aPens[0] Then Return SetError(2, @extended, 0) Local $aPens = $aGraphs[$iIndex][$g_aPens] _GDIPlus_PenSetWidth($aPens[$iLine], $iWidth) If @error Then Return SetError(3, @extended, 0) Return 1 EndFunc ;==>_SLG_SetLineWidth ; #FUNCTION# ==================================================================================================================== ; Name...........: _SLG_ClearGraph ; Description ...: Clears all data from Graph ; Syntax.........: _SLG_ClearGraph($iIndex) ; Parameters ....: $iIndex - Index returned from _SLG_CreateGraph() ; Return values .: Success - 1 ; Failure - 0 and sets @ERROR: ; - 1 Invalid iIndex ; Author ........: Beege ; Remarks .......: none ; =============================================================================================================================== Func _SLG_ClearGraph($iIndex) If $iIndex > $aGraphs[0][0] Then Return SetError(1, @extended, 0) _GDIPlus_GraphicsClear($aGraphs[$iIndex][$g_hBuffer], $aGraphs[$iIndex][$g_iBackColor]); If $aGraphs[$iIndex][$g_bGridlines] Then _FullGridLines($iIndex) _WriteBuffer($iIndex) Return 1 EndFunc ;==>_SLG_ClearGraph ; #FUNCTION# ==================================================================================================================== ; Name...........: _SLG_SetYRange ; Description ...: Sets the Minimum and Maximum Y Values ; Syntax.........: _SLG_SetYRange($iIndex, $iY_Min, $iY_Max) ; Parameters ....: $iIndex - Index returned from _SLG_CreateGraph() ; $iY_Min - Minimum Y Value ; $iY_Max - Maximum Y Value ; Return values .: Success - 1 ; Failure - 0 and sets @ERROR: ; - 1 Invalid iIndex ; Author ........: Beege ; Remarks .......: User should most likly want to ClearGraph after changing Y Range ; =============================================================================================================================== Func _SLG_SetYRange($iIndex, $iY_Min, $iY_Max) If $iIndex > $aGraphs[0][0] Then Return SetError(1, @extended, 0) $aGraphs[$iIndex][$g_iY_Min] = $iY_Min $aGraphs[$iIndex][$g_iY_Max] = $iY_Max $aGraphs[$iIndex][$g_iY_Range] = Abs($iY_Max - $iY_Min) Return 1 EndFunc ;==>_SLG_SetYRange ; #FUNCTION# ==================================================================================================================== ; Name...........: _SLG_SetBackGroundColor ; Description ...: Sets Graph BackGround Color ; Syntax.........: _SLG_SetBackGroundColor($iIndex, $iARGB = 0xFF000000) ; Parameters ....: $iIndex - Index returned from _SLG_CreateGraph() ; $iARGB - Alpha, Red, Green and Blue Hex Value. (0xAARRGGBB). Default = Black ; Return values .: Success - 1 ; Failure - 0 and sets @ERROR: ; - 1 Invalid iIndex ; Author ........: Beege ; Remarks .......: All previous data will be cleared ; =============================================================================================================================== Func _SLG_SetBackGroundColor($iIndex, $iARGB = 0xFF000000) If $iIndex > $aGraphs[0][0] Then Return SetError(1, @extended, 0) $aGraphs[$iIndex][$g_iBackColor] = $iARGB _SLG_ClearGraph($iIndex) Return 1 EndFunc ;==>_SLG_SetBackGroundColor ; #FUNCTION# ==================================================================================================================== ; Name...........: _SLG_SetGridLineColor($iIndex) ; Description ...: Sets Graph GridLines Color Value ; Syntax.........: _SLG_SetGridLineColor($iIndex, $iARGB = Default) ; Parameters ....: $iIndex - Index returned from _SLG_CreateGraph() ; $iARGB - Alpha, Red, Green and Blue Hex Value. (0xAARRGGBB). Default = Invert of Background Color. ; Return values .: Success - 1 ; Failure - 0 and sets @ERROR: ; - 1 Invalid iIndex ; Author ........: Beege ; Remarks .......: All previous data will be cleared ; =============================================================================================================================== Func _SLG_SetGridLineColor($iIndex, $iARGB = Default) If $iIndex > $aGraphs[0][0] Then Return SetError(1, @extended, 0) $aGraphs[$iIndex][$g_iGridColor] = $iARGB _SLG_ClearGraph($iIndex) Return 1 EndFunc ;==>_SLG_SetGridLineColor ; #FUNCTION# ==================================================================================================================== ; Name...........: _SLG_EnableGridLines ; Description ...: Enables or Disables Drawing of Gridlines for Graph ; Syntax.........: _SLG_EnableGridLines($iIndex, $bGridlines = True) ; Parameters ....: $iIndex - Index returned from _SLG_CreateGraph() ; $bGridlines - GridLines flag: ; |True - GridLines will be drawn ; |False - GridLines will not be drawn ; Return values .: Success - 1 ; Failure - 0 and sets @ERROR: ; - 1 Invalid iIndex ; - 2 Invalid $bGridlines Value ; Author ........: Beege ; Remarks .......: none ; =============================================================================================================================== Func _SLG_EnableGridLines($iIndex, $bGridlines = True) If $iIndex > $aGraphs[0][0] Then Return SetError(1, @extended, 0) If $bGridlines <> True And $bGridlines <> False Then SetError(2, @extended, 0) $aGraphs[$iIndex][$g_bGridlines] = $bGridlines Return 1 EndFunc ;==>_SLG_EnableGridLines #EndRegion Public Functions #Region Internel Functions ; #FUNCTION# ==================================================================================================================== ; Author ........: UEZ ; Modified ......: Beege ; =============================================================================================================================== Func _AddGridLines($iIndex) Local $iGridlineColor = $aGraphs[$iIndex][$g_iGridColor] If $iGridlineColor = Default Or $iGridlineColor = -1 Then $iGridlineColor = BitOR(0xFF000000, (0xFFFFFFFF - $aGraphs[$iIndex][$g_iBackColor]));Invert Background RGB Local $iY1, $hPen = _GDIPlus_PenCreate($iGridlineColor) For $iY1 = 0 To $aGraphs[$iIndex][$g_iHeight] Step $aGraphs[$iIndex][$g_iY_counter] _GDIPlus_GraphicsDrawLine($aGraphs[$iIndex][$g_hBuffer], $aGraphs[$iIndex][$g_iShift_Distance] - 1, $iY1, $aGraphs[$iIndex][$g_iWidth], $iY1, $hPen) Next If $aGraphs[$iIndex][$g_iX_counter] <= 0 Then _GDIPlus_GraphicsDrawLine($aGraphs[$iIndex][$g_hBuffer], $aGraphs[$iIndex][$g_iWidth] - 1, 0, $aGraphs[$iIndex][$g_iWidth] - 1, $aGraphs[$iIndex][$g_iHeight], $hPen) $aGraphs[$iIndex][$g_iX_counter] = $aGraphs[$iIndex][$g_iX_counter_mem] EndIf $aGraphs[$iIndex][$g_iX_counter] -= $aGraphs[$iIndex][$g_iIncrement_Size] _GDIPlus_PenDispose($hPen) EndFunc ;==>_AddGridLines Func _FullGridLines($iIndex) Local $iGridlineColor = $aGraphs[$iIndex][$g_iGridColor] If $iGridlineColor = Default Or $iGridlineColor = -1 Then $iGridlineColor = BitOR(0xFF000000, (0xFFFFFFFF - $aGraphs[$iIndex][$g_iBackColor]));Invert Background RGB Local $iY1, $hPen = _GDIPlus_PenCreate($iGridlineColor) Local $hShift_Section = _GDIPlus_BitmapCloneArea($aGraphs[$iIndex][$g_hBitmap], 0, 0, $aGraphs[$iIndex][$g_iWidth], $aGraphs[$iIndex][$g_iHeight]); _GDIPlus_GraphicsClear($aGraphs[$iIndex][$g_hBuffer], $aGraphs[$iIndex][$g_iBackColor]); _GDIPlus_GraphicsDrawImageRect($aGraphs[$iIndex][$g_hBuffer], $hShift_Section, 0, 0, $aGraphs[$iIndex][$g_iWidth], $aGraphs[$iIndex][$g_iHeight]) For $iY1 = 0 To $aGraphs[$iIndex][$g_iHeight] Step $aGraphs[$iIndex][$g_iY_counter] _GDIPlus_GraphicsDrawLine($aGraphs[$iIndex][$g_hBuffer], 0, $iY1, $aGraphs[$iIndex][$g_iWidth], $iY1, $hPen) Next For $iX = 0 To $aGraphs[$iIndex][$g_iWidth] Step $aGraphs[$iIndex][$g_iIncrement_Size] If $aGraphs[$iIndex][$g_iX_counter] <= 0 Then _GDIPlus_GraphicsDrawLine($aGraphs[$iIndex][$g_hBuffer], $iX, 0, $iX, $aGraphs[$iIndex][$g_iHeight], $hPen) $aGraphs[$iIndex][$g_iX_counter] = $aGraphs[$iIndex][$g_iX_counter_mem] EndIf $aGraphs[$iIndex][$g_iX_counter] -= $aGraphs[$iIndex][$g_iIncrement_Size] Next _WriteBuffer($iIndex) _GDIPlus_BitmapDispose($hShift_Section) _GDIPlus_PenDispose($hPen) EndFunc ;==>_FullGridLines Func _WriteBuffer($iIndex) Local $hGDI_HBitmap, $hDC $hGDI_HBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($aGraphs[$iIndex][$g_hBitmap]) $hDC = _WinAPI_CreateCompatibleDC($aGraphs[$iIndex][$g_hDC]) _WinAPI_SelectObject($hDC, $hGDI_HBitmap) _WinAPI_BitBlt($aGraphs[$iIndex][$g_hDC], $aGraphs[$iIndex][$g_iLeft], $aGraphs[$iIndex][$g_iTop], $aGraphs[$iIndex][$g_iWidth], $aGraphs[$iIndex][$g_iHeight], $hDC, 0, 0, $SRCCOPY) _WinAPI_DeleteObject($hGDI_HBitmap) _WinAPI_DeleteDC($hDC) EndFunc ;==>_WriteBuffer Func _SLG_Exit() Local $i, $j, $aPens If $aGraphs[0][0] Then For $i = 1 To $aGraphs[0][0] _GDIPlus_GraphicsDispose($aGraphs[$i][$g_hBuffer]) _GDIPlus_BitmapDispose($aGraphs[$i][$g_hBitmap]) _GDIPlus_GraphicsDispose($aGraphs[$i][$g_hGraphic]) $aPens = $aGraphs[$i][$g_aPens] For $j = 1 To $aPens[0] _GDIPlus_PenDispose($aPens[$j]) Next _WinAPI_ReleaseDC($aGraphs[$i][$g_hGUI], $aGraphs[$i][$g_hDC]) Next EndIf _GDIPlus_Shutdown() EndFunc ;==>_SLG_Exit #EndRegion Internel Functions SLG.au3 Previous DL = 551 point
-
Manually Inputting data during Autoit Script?
sadasivam73 reacted to Badlmixture for a topic
Ok thanks everyone! After checking out kelsets code and a few other posts I understand how to easily accomplish what I was after, which is using inputbox to configure a variable within a script. $userName = InputBox("Security Check", "Enter your user name.") Send($userName, 1) This will send whatever I type in the inputbox when it pops up to whatever program I'm working with! Awesome!1 point -
Before I start this topic, this is NOT going to turn into a flame topic and no product names will be mentioned. Anyone doing so will have their posts deleted and will be warned. This is a serious topic and it is to determine the future of AutoIt intellectual property. I've just about had it with numerous other projects repeatedly taking AutoIt code - against the expressed wishes of the developers - including it whole in their own code and then setting themselves up as competitors. In extreme cases bad mouthing AutoIt in favour of their own while using the AutoIt name for advertising purposes. When we complain we generally get the response "it's GPL so tough". After the success of of AutoIt 2 and the community support it received I wanted to do something better that met these goals: - Free for all. Personal and business. - Allow people to easily contribute code and documentation, nothing cements community more than feeling you helped to create something great. - Decent forums and other things (even if at personal expense) I'm not one of those doey-eyed Linux types who think that open source software is some sort of holy right - the GPL license was chosen as it is generally accepted as the most restrictive. So how did we do? Well, the community is thriving and there are a handful of core developers that put insane amounts of time in writing code and documentation specifically for AutoIt. Currently all code in the AutoIt core has been written by myself or written for AutoIt by people who love the language. Now the rub. Over the last year 70+ functions and code sections containing over a year of work have been "leeched" whole, mostly without proper credit. I make pains to credit all the people involved in AutoIt in the helpfile - even down to the functions of AutoIt they have worked on - and would expect anyone using our code to do the same. Not for any "license" reasons, but just out of common courtesy. I write code because I love AutoIt and I know this feeling is shared by most of the developers. The feeling when your code is used against your wishes in order to diminish the product your wrote it for is gut wrenching. In this respect I feel the GPL has failed us. Has the GPL given us anything? Debatable. I think all the core developers would still be in place if the source was semi-closed and available to those who showed an interest - but only they can answer that for themselves. And end-users generally don't care as long as it free (Actually I've had a few criticisms about companies not being able to use AutoIt as they are disallowed GPL!) So what do we do? Because we wrote all the code for AutoIt we actually have a lot of options but I want to see how other feel. Some ideas are: - Keep with the GPL and put up with leeching. - Open source with a "no leeching, you must ask permission" license (wouldn't stop leeching but would give a moral victory for us). - Semi-closed source, source available for download to the devs and those who have demonstrated commitment to improving AutoIt on the forum. - Closed source, available only to the devs and invitation only. As we wrote the all code we can depart from the GPL if we choose. Previously downloaded source would still be under GPL (as per the license) but new copies of the source would be under whatever license we care to make. I was always wary of what might happen under the GPL which is why I only wanted custom written code in AutoIt. It gives us options when things turn to shit. I wouldn't want to go back to completely closed source as in AutoIt v2 but the current situation is just far too demoralising for me. Looking down the changelog for 3.0.103 fills me with pride, I managed to get ControlListView working and the long elusive DllCall, JP must have put all of his spare time into the GUI and the contributions of the other devs (larry, valik, nutser, holger, jdeb, cyberslug, tylo, etc etc - see help file ) have continued to be outstanding. We have great window spys, reg exps, guis, docs, forum, forum help, editors, code tidying...the list is endless. When I know that within a day of the release of that source it will be ripped out in 5 minutes (damn my modular coding style) and waved in our faces I get really angry. I can't be alone in that respect. Discuss. No flames, no "that sux" posts, no hunting for the offending programs and starting hate campaigns. NOTHING. That is not what I want. This is about AutoIt and nothing more. Serious chat only.1 point