Jump to content

Search the Community

Showing results for tags 'memory'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 24 results

  1. I'm trying to get a "double" value from memory . However my code gives me error. Opt("WinTitleMatchMode", 4)     Global $ProcessID = WinGetProcess("TI Pro")     If $ProcessID = -1 Then         MsgBox(4096, "ERROR", "Failed to detect process.")         Exit     EndIf     Local $DllInformation = _MemoryOpen($ProcessID)     If @Error Then         MsgBox(4096, "ERROR", "Failed to open memory.")         Exit     EndIf   Local $dAddress = 0x1FECD474   Local $tNbSteps = DllStructCreate("double", $dAddress)   Local $value = DllStructSetData($tNbSteps, 1, (_MemoryRead($dAddress, $DllInformation)))      MsgBox($MB_SYSTEMMODAL, $value)
  2. I updated the UDF by Patric Pendelin to use the MemoryDLL UDF. There are only two new functions: _SevenZip_Load & _SevenZip_Free The first function must be called before using any other functions included in the UDF and the other should be called to free memory when the UDF is no longer needed! The size of binary from the module was excessive so I used the ZLMA UDF to compress it. It will be decompressed at run time before its loaded into memory. The only advantage of using this UDF is that it removes the need to included any DLLs in your script. A lot of functions haven't been added yet! For those that dare: The API for the 7-Zip32.dll module is included in the attachment. These functions work in the same way you would you use the standalone 7za.exe executable so the Help.chm file applies to these functions aswell. Thats it, Enjoy! The code below is a sneak peak at the actually UDF, meaning it dosen't work without the other includes and the embed binary. - Download the attachment. #include-once #include "MemoryDLL.au3" #include "LZMA.au3" Global $__7ZIPDLL = Default, $__7ZIPINIT = False #cs =============================================================================== Name: 7-Zip.au3 Version: 1.0 Datum: 08.07.2008 Author: Patric Pendelin eMail: <patric.pendelin (a) gmx.de> Modified By: Decipher Script Function: _SevenZip_Load() _SevenZip_Extract($s_Archive, $s_Out="", $s_Pass="", $szCmdLine="", $s_Overwrite="", $hwnd=0, $szOutput="NULL", $dwSize=0) Extracts files from an archive _SevenZip_Add($s_Archive, $s_Out = "", $s_Typ = "7z32", $i_Comp = 5, $s_Pass = "", $szCmdLine = "", $hwnd = 0, $szOutput = "NULL", $dwSize = 0) Add files to an archive _SevenZip_GetVersion() Get 7_zip32.dll Version _SevenZip_GetRunning() _SevenZip_CheckArchive($s_Archive, $i_iMode = 0) _SevenZip_GetArchiveType($s_Archive) _SevenZip_GetFileCount($s_Archive) _SevenZip_GetUDFVersion() Returns UDF version number _SevenZip_Free() #ce =============================================================================== Func _SevenZip_Load() If Not $__7ZIPINIT Then $__7ZIPDLL = MemoryDllOpen(__7ZIPBIN()) $__7ZIPINIT = True EndIf EndFunc Func _SevenZip_Free() If $__7ZIPINIT Then MemoryDllClose($__7ZIPDLL) $__7ZIPINIT = False $__7ZIPDLL = Default EndIf EndFunc ;=============================================================================== ; Function Name: _SevenZip_Extract ; Description: Extracts files from an archive ; ; Parameter(s): $s_Archive: Fullpath to Archive-File ; $s_Out: Specifies a destination directory where files are to be extracted. (Def. "") ; $s_Pass: Specifies password. (Def. "") ; $szCmdLine: Command Line Commands. (Def. "") ; $s_Overwrite: Specifies the overwrite mode during extraction, to overwrite files already present on disk. (Def. "") ; -1: Overwrite All existing files without prompt. ; -2: Skip extracting of existing files. ; -3: aUto rename extracting file (for example, name.txt will be renamed to name_1.txt). ; -4: auto rename existing file (for example, name.txt will be renamed to name_1.txt). ; $hwnd: The window handle of the application which calls 7-zip32.dll. (Def. 0) ; $szOutput: The buffer because 7-zip32.dll returns the result. (Def. "NULL") ; $dwSize: Größe des Puffers. When the result exceeds designated size, it is economized in this size. ; If size is 1 or more, always NULL letter is added lastly. (Def. 0) ; ; Syntax: _SevenZip_Extract($s_Archive, $s_Out="", $s_Pass="", $szCmdLine="", $s_Overwrite="", $hwnd=0, $szOutput="NULL", $dwSize=0) ; Return Value(s): On Success -Return 1 ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_Extract($s_Archive, $s_Out = "", $s_Pass = "", $szCmdLine = "", $s_Overwrite = "", $hwnd = 0, $szOutput = "NULL", $dwSize = 0) ; Set Output directory If $s_Out = "" Then Local $as_Res = StringSplit($s_Archive, "\") For $i = 1 To $as_Res[0] - 1 $s_Out &= $as_Res[$i] & "\" Next EndIf ; (Overwrite mode) switch: If $s_Overwrite = 1 Then $s_Overwrite = "-aoa"; Overwrite All existing files without prompt. ElseIf $s_Overwrite = 2 Then $s_Overwrite = "-aos"; Skip extracting of existing files. ElseIf $s_Overwrite = 3 Then $s_Overwrite = "-aou"; Auto rename extracting file (for example, name.txt will be renamed to name_1.txt). ElseIf $s_Overwrite = 4 Then $s_Overwrite = "-aot"; Auto rename existing file (for example, name.txt will be renamed to name_1.txt). EndIf If $szCmdLine = "" Then $szCmdLine = ' x "' & $s_Archive & '" ' & $s_Overwrite & ' -o"' & $s_Out & '" -p"' & $s_Pass & '"' Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZip", "hwnd", $hwnd, "str", $szCmdLine, "str", $szOutput, "int", $dwSize) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_Extract ;=============================================================================== ; Function Name: _SevenZip_Add ; Description: Extracts files from an archive ; ; Parameter(s): $s_Archive: Fullpath to Archive-File ; $s_Out: Specifies a destination directory where files are to be extracted. (Def. "") ; $s_Typ: Specifies the type of archive. ; $i_Comp: Sets level of compression. [0 | 1 | 3 | 5 | 7 | 9 ] ; $s_Pass: Specifies password. (Def. "") ; $szCmdLine: Command Line Commands. (Def. "") ; $hwnd: The window handle of the application which calls 7-zip32.dll. (Def. 0) ; $szOutput: The buffer because 7-zip32.dll returns the result. (Def. "NULL") ; $dwSize: Größe des Puffers. When the result exceeds designated size, it is economized in this size. ; If size is 1 or more, always NULL letter is added lastly. (Def. 0) ; ; Syntax: _SevenZip_Add($s_Archive, $s_Out = "", $s_Typ = "7z32", $i_Comp = 5, $s_Pass = "", $szCmdLine = "", $hwnd = 0, $szOutput = "NULL", $dwSize = 0) ; Return Value(s): On Success -Return 1 ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_Add($s_Archive, $s_Out = "", $s_Typ = "7z32", $i_Comp = 5, $s_Pass = "", $szCmdLine = "", $hwnd = 0, $szOutput = "NULL", $dwSize = 0) If $szCmdLine = "" Then If $s_Pass = "" Then $szCmdLine = '-t' & $s_Typ & ' a "' & $s_Archive & '" "' & $s_Out & '" -mx=' & $i_Comp Else $szCmdLine = '-t' & $s_Typ & ' a "' & $s_Archive & '" "' & $s_Out & '" -p"' & $s_Pass & '" -mhe=on -mx=' & $i_Comp EndIf EndIf Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZip", "hwnd", $hwnd, "str", $szCmdLine, "str", $szOutput, "int", $dwSize) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_Add ;=============================================================================== ; Function Name: _SevenZip_GetVersion ; Description: The version of 7-zip32.dll is returned. ; ; Parameter(s): None. ; ; Syntax: _SevenZip_GetVersion() ; Return Value(s): On Success -Return File Version ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_GetVersion() Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipGetVersion") Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_GetVersion ;=============================================================================== ; Function Name: _SevenZip_GetRunning ; Description: Whether or not presently 7-zip32.dll while operating, you obtain. ; Application side before executing API which by all means accompanies file access such as compressing/thawing, ; it is necessary to check whether because of this feasibility. ; ; Parameter(s): None. ; ; Syntax: _SevenZip_GetRunning() ; Return Value(s): On Success -Return 1(It is in the midst of executing.) ; Return 0(Is not in the midst of executing, (feasibility).) ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_GetRunning() Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipGetRunning") Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_GetRunning ;=============================================================================== ; Function Name: _SevenZip_CheckArchive ; Description: Whether or not presently 7-zip32.dll while operating, you obtain. ; As the archive file which the designated file supports ; It returns whether or not it is correct. ; ; Parameter(s): $s_Archive: Fullpath to Archive file ; ; Syntax: _SevenZip_CheckArchive($s_Archive) ; Return Value(s): On Success -Return 1 (At the time of correct archive file.) ; Return 0 (When the file is illegitimate.) ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_CheckArchive($s_Archive, $i_iMode = 0) Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipCheckArchive", "str", $s_Archive, "int", $i_iMode) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_CheckArchive ;=============================================================================== ; Function Name: _SevenZip_GetArchiveType ; Description: Type of the archive file ; ; Parameter(s): $s_Archive: Fullpath to Archive file ; ; Syntax: _SevenZip_GetArchiveType($s_Archive) ; Return Value(s): On Success -Return 1 (ZIP type) ; Return 2 (7z32 type) ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_GetArchiveType($s_Archive) Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipGetArchiveType", "str", $s_Archive) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_GetArchiveType ;=============================================================================== ; Function Name: _SevenZip_GetFileCount ; Description: Type of the archive file ; ; Parameter(s): $s_Archive: The number of files in the Archive file. ; ; Syntax: _SevenZip_GetFileCount($s_Archive) ; Return Value(s): On Success -Return Numer of files ; On Failure -@error 1: Can´t opens a DLL file for use in MemoryDllCall. ; @error 2: Error in MemoryDllCall ; ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_GetFileCount($s_Archive) Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipGetFileCount", "str", $s_Archive) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_GetFileCount #region ### BINARY ### Func __7ZIPBIN() #cs Name: 7-ZIP32 BINARY Version 9.20.00.02 Requirements: Windows9x/Me/NT/200x/XP/Vista/7 Author: Akita Minoru ( Http://Akky.Xrea.Jp/support.Html ) Download the Library: 7-Zip-Library.7z Basic Usage: #include "7-Zip.au3" _SevenZip_Load() Dim $sCommandLine = "Accepts Switches and etc" _SevenZip_Exec($sCommandLine) ; See the included 7-Zip.chm documentation _SevenZip_Free() Exit
  3. Please answer me these questions three, ere the other side you see: Are you running a 64-bit machine with a 64-bit Windows operating system? Can your AutoIt scripts cope with having directive #AutoIt3Wrapper_UseX64=Y, and thus @AutoItX64=True? Are you sick and tired of seeing this error message? If you (like me) answered "YES" to all three questions, then the _HighMem library may ease your pain (the name commemorates a useful utility from the days when CPUs were still steam-powered). Forget about pathetic boot switches /3GB and /userva; in a full-fledged 64-bit environment, _HighMem can pre-allocate all available physical/virtual RAM you've got (or any smaller size you need), and manage individual allocations therein with four simple functions: _HighMem_StartUp( $nSize, $sUnit="GB" ) ; parse size of total region to pre-allocate, e.g. (10,"GB") _HighMem_Allocate( $nSize, $sUnit="B" ) ; returns $pOffset (new allocation's base address) _HighMem_Release( $pOffset ) ; existing allocations are identified by their offset (base address) _HighMem_CleanUp() ; close handles, release all pre-allocated memory Of course, existing AutoIt limitations remain in force (e.g., DllstructCreate() is still limited to 2 GB per call), but the maximum of 2-4 GB of virtual memory per Windows process can (under the right circumstances, in the proper environment) be circumvented. However, this is the first beta release, so glitches are likely, and performance may vary. In fact, it may not work at all for you (if you're running 32-bit, for example). And since this involves your own hardware, it's unlikely I would be able to reproduce your issues in my own work environment. Nevertheless, if you find obvious bugs or mistakes in the code, please do post. And if it works for you, that's also good to hear. My own motivation for developing it was to supercharge my matrix computing environment (Eigen4AutoIt), so it can handle matrices of any size that fit in machine RAM. The attached zip contains the library itself (HighMem.au3) and two test examples. HighMem_Test1 performs a dry run stress test of the allocation management system; it does not actually do any memory I/O. By contrast, HighMem_Test2 pre-allocates a 6 GB space, stores 3 x 2GB structs there, performs some basic I/O, and releases the allocations one by one. Obviously, for this to work you'll need at least that much free RAM to begin with (check with Task Manager -> Performance -> Memory if you're unsure). My own test environment has 16 GB of physical RAM, and runs W10Pro/64. EDIT: minor edits added to improve user experience (many more status messages if $_HighMem_Verbose=True) HighMem.v0.85.7z EDIT: from beta version 0.9, HighMem supports shared memory, including mutex negotiation. HighMemv0.9.2.7z
  4. When I use DllStructCreate() to reserve a chunk of memory I would like to know if I can rely on that memory being initialized to zero. Experience suggests that it is, but I have been searching to try and find a definitive statement anywhere that this is the case. I apologise if I have missed somewhere. Part of the reason for this question is so that my next search (after my personal memory has dimmed) should yield a link to this post, hopefully with an answer. A number of DLLs I use have structs where a few parts have to be explicitly set and other parts are reserved with the instruction that they must be set to zero. Because DllStructCreate() appears to zero-initialise the memory, I tend to forget to do it explicitly and everything seems to work. I am wondering whether I have been lucky and am storing up trouble for myself. It seems likely that the OS has been asked for zeroed memory, but without a promise in the documentation for DllStructCreate(), perhaps that could change? Perhaps the developers wish to reserve the right to change their minds?
  5. After watching this movie (https://www.youtube.com/watch?v=cPiDHXtM0VA) I wanted to try the test to see how much i could compete with that chimpanzee so i created this script. well, actually passing that test is a lot harder than it sounds. With the difficulty set to seven numbers and a display time of one second, I can only remember 2 or 3 numbers ... (what a disappointment) I can only do better if I reduce the slider to 5 numbers and increase the storage time to 2 seconds (the easyest level), a very poor performance. That chimpanzee is great. The script offers you a sequence of 10 random quizzes. At the end it gives you the percentage of your "level". The chimpanzee resolves on average 8 out of 10 (80%), so you can compare your performance to that of the chimpanzee. How to play: Run the script. At the beginning there are 2 sliders at the bottom of the screen where you can set the difficulty level by varying the memorization time and the amount of numbers to memorize as you like. After setting the difficulty, click the circle on the bottom left to get started. after the first move the sliders are no longer displayed until the next game, (the game lasts 10 attempts, there is a progress bar at the bottom of the screen to see where you are) between one test and the other of the ten, click on the circle to move on to the next test have fun. (here a related interesting video: https://www.youtube.com/watch?v=ktkjUjcZid0 ) #include <GUIConstants.au3> #include <MsgBoxConstants.au3> #include <Array.au3> #include <WinAPIMisc.au3> ; HotKeySet("{ESC}", "_EndOfGame") Global $iNumbersToGuess = 7, $iExpositionTime = 1000, $iMatches = 10, $iMatchesWon Global $aNumbers[10] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Global $aButtons[10], $aControls[5] Global $iWinWidth = @DesktopWidth / 2, $iWinHeight = @DesktopHeight / 2, $iButtonXSide = Int($iWinWidth / UBound($aNumbers)), $iButtonYSide = Int($iWinHeight / UBound($aNumbers)), $sWinTitle = "Beat the Chimp" Global $aX[Int($iWinWidth / $iButtonXSide)], $aY[Int($iWinHeight / $iButtonYSide)], $iNdx = 0, $aPoints[3], $score, $GUIGetMsg, $iDockHeight = 50, $iProgrssHeight = 5 For $i = 0 To (Int($iWinWidth / $iButtonXSide) - 1) * $iButtonXSide Step $iButtonXSide $aX[$iNdx] = $i $iNdx += 1 Next $iNdx = 0 For $i = 0 To (Int($iWinHeight / $iButtonYSide) - 1) * $iButtonYSide Step $iButtonYSide $aY[$iNdx] = $i $iNdx += 1 Next Global Const $iDockLeftBorder = 200, $iForeColor = 0xFFFFFF, $iBackColor = 0x000000 Global $hGUI = GUICreate($sWinTitle, $iWinWidth, $iWinHeight + $iDockHeight + $iProgrssHeight, @DesktopWidth / 4, @DesktopHeight / 5) GUISetBkColor($iBackColor, $hGUI) ; the circle to continue playing $aControls[0] = GUICtrlCreateLabel(ChrW(0x25EF), 0, $iWinHeight + 1, 100, $iDockHeight, 0x01) ; GUICtrlSetTip(-1, "Click the circle," & @CRLF & "then click the squares" & @CRLF & "in numeric order.") GUICtrlSetFont(-1, 24, 900) GUICtrlSetColor(-1, $iForeColor) GUICtrlSetBkColor(-1, $iBackColor) ; slider for the amount of numbers to guess $aControls[2] = GUICtrlCreateSlider($iDockLeftBorder, $iWinHeight, $iWinWidth - $iDockLeftBorder, Int($iDockHeight / 2)) GUICtrlSetLimit(-1, 10, 5) ; 5 steps 5 (easy) to 10 (hard) GUICtrlSetData(-1, $iNumbersToGuess) ; label for the amount of quizzes $aControls[1] = GUICtrlCreateLabel("Numbers : " & GUICtrlRead($aControls[2]), 100, $iWinHeight + 1, 100) GUICtrlSetColor(-1, $iForeColor) ; slider for the exposition time $aControls[4] = GUICtrlCreateSlider($iDockLeftBorder, $iWinHeight + (Int($iDockHeight / 2)), $iWinWidth - $iDockLeftBorder, $iDockHeight / 2) GUICtrlSetLimit(-1, 8, 1) ; 8 steps (0f 250ms each) GUICtrlSetData(-1, $iExpositionTime / 250) ; label for the exposition time $aControls[3] = GUICtrlCreateLabel("ms to show : " & GUICtrlRead($aControls[4]) * 250, 100, $iWinHeight + 1 + (Int($iDockHeight / 2)), 100) GUICtrlSetColor(-1, $iForeColor) ; progress bar of the match Global $idProgressbar = GUICtrlCreateProgress(0, $iWinHeight + $iDockHeight, $iWinWidth, $iProgrssHeight) ; Create buttons For $i = 0 To 9 $aButtons[$i] = GUICtrlCreateLabel($i + 1, $iWinWidth + 5, $iWinHeight + $iDockHeight + $iProgrssHeight + 5, $iButtonXSide, $iButtonYSide, 0x01) GUICtrlSetFont($aButtons[$i], 24) GUICtrlSetColor($aButtons[$i], $iForeColor) GUICtrlSetBkColor($aButtons[$i], $iBackColor) Next GUISetState(@SW_SHOW) ; --- Main loop --- Do ; New game $iMatchesWon = 0 GUICtrlSetData($idProgressbar, 0) For $iRound = 1 To $iMatches ; the game lasts $iMatches rounds $iNdx = 0 ; reset pointer (index to the next correct answer) _HideControls(__get_IDs_by_indexes($aButtons, $aNumbers)) ; remove the numbers from the screen ; show the dock and wait (only in the first round are also shown the sliders) _ShowControls($iRound = 1 ? $aControls : $aControls[0]) ; display the dock's control(s) While 1 Switch GUIGetMsg() Case $aControls[0] ; The circle (play a new quiz) ExitLoop Case $aControls[2] ; slider to choose how many numbers to guess $iNumbersToGuess = GUICtrlRead($aControls[2]) GUICtrlSetData($aControls[1], "Numbers : " & $iNumbersToGuess) Case $aControls[4] ; slider to choose how long (milliseconds) to show the numbers $iExpositionTime = GUICtrlRead($aControls[4]) * 250 ; 8 steps of 250 milliseconds each GUICtrlSetData($aControls[3], "ms to show : " & $iExpositionTime) Case $GUI_EVENT_CLOSE _EndOfGame() EndSwitch WEnd _HideControls($aControls) ; hide the dock Sleep(750) ; wait a bit $aQuiz = _GenerateQuiz($iNumbersToGuess) ; generate random elements to guess _SpreadControls(__get_IDs_by_indexes($aButtons, $aQuiz)) ; scatter the numbers on the GUI _ShowControls(__get_IDs_by_indexes($aButtons, $aQuiz)) ; display the numbers Sleep($iExpositionTime) ; leave numbers visible for a short time _MaskControls(__get_IDs_by_indexes($aButtons, $aQuiz)) ; mask the numbers GUICtrlSetData($idProgressbar, Round($iRound / $iMatches * 100)) ; _ShowControls(__get_IDs_by_indexes($aButtons, $aQuiz)) ; <------------- keep numbers visible FOR DEBUG PURPOSE ONLY! While 1 ; wait for a move $GUIGetMsg = GUIGetMsg() If $GUIGetMsg = $GUI_EVENT_CLOSE Then _EndOfGame() ; scan all quiz buttons to check if one was pressed For $i = 0 To UBound($aQuiz) - 1 ; $aButtons) - 1 If $GUIGetMsg = $aButtons[$aQuiz[$i] - 1] Then If $i = $iNdx Then ; -------------------------- ; actions for a right move ; -------------------------- ; hide the guessed number _HideControls($aButtons[$aQuiz[$i] - 1]) ; --------------------------------- ; check if this round is complete ; --------------------------------- If $iNdx = (UBound($aQuiz) - 1) Then _WinAPI_PlaySound("SystemExclamation", Null, BitOR($SND_ALIAS, $SND_ASYNC)) $iMatchesWon += 1 ExitLoop 2 EndIf ; play a short ok sound ; _WinAPI_PlaySound("FaxBeep", Null, BitOR($SND_ALIAS, $SND_ASYNC)) ; "SystemAsterisk" $iNdx += 1 ; set index to next correct answer Else ; -------------------------- ; actions for a wrong move ; -------------------------- ; show all the right sequence _ShowControls(__get_IDs_by_indexes($aButtons, $aQuiz)) _WinAPI_PlaySound("DeviceFail", Null, BitOR($SND_ALIAS, $SND_ASYNC)) ; give a little time to the user to control it Sleep(1500) ; go to next step ExitLoop 2 EndIf EndIf Next WEnd ; loop till end of match $score = Round($iMatchesWon / $iMatches * 100, 2) ; percentage Select Case $score < 80 $sResult = "The chimp beat you!" Case $score > 80 $sResult = "You beat the chimp!" Case $score = 80 $sResult = "You tied the chimp." EndSelect Next ; next round ; game over? Until MsgBox($MB_YESNO + $MB_ICONINFORMATION + $MB_TASKMODAL + $MB_SETFOREGROUND, _ "Game over", _ "You got " & $score & "% correct." & @CRLF & _ "Ayumu averages 80% correct." & @CRLF & $sResult & @CRLF & @CRLF & _ "do you want to try again?") <> 6 Func _SpreadControls($aTemp) ; place the required numbers scattered on the GUI SRandom(@YEAR + @MON + @MDAY + @HOUR + @MIN + @SEC) _ArrayShuffle($aX) _ArrayShuffle($aY) ; first, place all buttons out of GUI For $i = 0 To UBound($aButtons) - 1 GUICtrlSetPos($aButtons[$i], $iWinWidth + 5, $iWinHeight + $iDockHeight + $iProgrssHeight + 5) GUICtrlSetState($aButtons[$i], $GUI_DISABLE) Next ; Then place only the numbers of this quiz in visible area For $i = 0 To UBound($aTemp) - 1 GUICtrlSetPos($aTemp[$i], $aX[$i], $aY[$i]) GUICtrlSetState($aTemp[$i], $GUI_ENABLE) Next EndFunc ;==>_SpreadControls Func _GenerateQuiz($iNumElements) ; generate an array of required random numbers SRandom(@YEAR + @MON + @MDAY + @HOUR + @MIN + @SEC) Local $aTemp[$iNumElements] _ArrayShuffle($aNumbers) For $i = 0 To $iNumElements - 1 $aTemp[$i] = $aNumbers[$i] Next _ArraySort($aTemp) Return $aTemp EndFunc ;==>_GenerateQuiz Func _ShowControls($aTemp) ; render controls visible (and enabled) $aTemp = _EnforceArray($aTemp) For $i = 0 To UBound($aTemp) - 1 GUICtrlSetState($aTemp[$i], $GUI_SHOW) GUICtrlSetColor($aTemp[$i], $iForeColor) GUICtrlSetBkColor($aTemp[$i], $iBackColor) Next EndFunc ;==>_ShowControls Func _MaskControls($aTemp) ; mask the controls $aTemp = _EnforceArray($aTemp) For $i = 0 To UBound($aTemp) - 1 GUICtrlSetColor($aTemp[$i], $iForeColor) GUICtrlSetBkColor($aTemp[$i], $iForeColor) Next EndFunc ;==>_MaskControls Func _HideControls($aTemp) ; hide the controls (implies disable) $aTemp = _EnforceArray($aTemp) For $i = 0 To UBound($aTemp) - 1 GUICtrlSetState($aTemp[$i], $GUI_HIDE) ; $GUI_DISABLE) ; GUICtrlSetColor($aButtons[$aTemp[$i] - 1], $iBackColor) ; GUICtrlSetBkColor($aButtons[$aTemp[$i] - 1], $iBackColor) Next EndFunc ;==>_HideControls Func _EnforceArray($vParam) ; if only one value is passed, turn it into an array of only 1 element If Not IsArray($vParam) Then Local $aTemp[1] = [$vParam] Return $aTemp EndIf Return $vParam EndFunc ;==>_EnforceArray Func __get_IDs_by_indexes(ByRef $aCtrls, ByRef $aNdxs) ; returns the handles of the controls pointed to by the indexes Local $aTemp[UBound($aNdxs)] For $i = 0 To UBound($aNdxs) - 1 $aTemp[$i] = $aCtrls[$aNdxs[$i] - 1] Next Return $aTemp EndFunc ;==>__get_IDs_by_indexes Func _EndOfGame() ; _WinAPI_PlaySound ("SystemExit" , Null, $SND_ALIAS) GUIDelete() Exit EndFunc ;==>_EndOfGame P.S. At this link (https://web.archive.org/web/20131006161544/http://games.lumosity.com/chimp.html) there is a Flash version of this game.
  6. Guys, i need help on creating a script that restarts a program once it starts using more than 1GB of memory. No idea how to start on the script, i don't know which functions i should use for process memory reading. My mind is in total blank at the moment, so i need a kick start
  7. Hello! Im wondering if it is possible to 'empty' the variable value to save memory, for example i often use variable as a onetime use thing and would prefer to 'forget' it after is is used Maybe it is just as easy as to setting $vVar = Null, but i wanted to make sure that this is the case
  8. Is there a reliable way to ensure that data assigned to variables in a script is overwritten or deleted when the script exits? I have scripts that encrypt/decrypt data and would like to ensure, if possible, that the encryption keys and decrypted data do not stay in memory after the script exits. Thanks.
  9. Hey there! I've been developing a artificial intelligence. My first hard task was letting the A.I know when a sentence is found in memory with different words What i tried to do here is simply, get all the words in user sentence that could be used as a identifier example: Steve Jobs then identify the sentence purpose with the words we found in the past "for" loop example: Do/Know/You/Who/Steve/Jobs Compare the example in the following matching sentences in memory. 1-Steve jobs was a known person 2-Do you know who barack obama is? 3-Do you know Steve jobs? 4-Do you know who steve jobs is? 5-How much money steve jobs had Then find the sentence that has way more matches than the other ones, remember that if the identifier words were not found (Steve jobs) then the sentence is invalid. Every sentence has a different answer and is important that the right one is chosen. If there's no more than the half of words in matches, then assign a variable the result of function, such as a return but for a global var. I couldn't figure out how to do that with StringRegExp. I honestly need help with detecting identifiers on memory sentences. I would also like to let the AI know typos, meaning that moeny and money means the same thing. Any help is hugely appreciated.
  10. Here test example of a dummy program with random added controls to the main form: If #include <GuiListView.au3> is commented out, then this simple program uses around 3,5 MB of RAM. When #include <GuiListView.au3> NOT commented out - RAM usage is around 13-14 MB. How can I reduce memory usage? Even if I'm not using GuiListView.au3 - 3,5 MB quite a bit for a such dummy program! I found out that using this DLLCall in main loop: DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", -1) Significantly reduces RAM usage (even with GuiListView.au3 included, from 13-14 MB to 600 KB !!! ) but I'm not sure if it's doesn't have any impact to common workflow of a program... So, give me any advice about that, please.
  11. I'm trying to read value of a base pointer + offset. With only address I can easily the value but with base addres (pointer) I really don't know how I can do that.
  12. Hi, I have a problem, my functions do not work with each other. Separately, each works very well. Features that do not work together it's loot() and pos1(). It looks that after spreadsheet function loot() script stops working even though everything is in the While 1-Wend loop. Can someone help me please?  
  13. Since my last topic were closed because bot scripting aren't allowed to be discussed anymore on here. Could anyone possibly give me a good example to learn memory read/write? , i can't figure out anything else which would be a good level of difficulty to practice than "tetris bot" but since it aint legal, i wont be asking for that let me know ur ideas and i would highly appreciate if examples could be posted (My last project was a imgsrch/pxlsrch) so thought i woud move on to memory read/write, if this somehow came out wrong lmk. AND NO I'M NOT ASKING FOR A FULL CODE I WANNA CODE/SCRIPT IT MY SELF, Just show me some simple examples of Memory read/write if u can/will TYVM. Dequality.
  14. I honestly didn't try anything yet. But i was thinking about my next step would be to try creating a tetris bot for educational purpose only. Last time i created a automation script / bot for ClubPenguin, which was simply made with PixelSearch If NOT(@error) Then , bla bla u know the drill aight, so i thought i would give my self a little harder challenge instead of keep making Pixelbots, i would love to try making a Memory bot or w/e u call , i read something about memory read/record was used for Tetris bots, since i haven't used Memory, i would love to know if anyone could give me a good guide or smth to follow :-) Either a complete tetris bot guide or a guide that explains memory totally in depth ish. :-) Dequality. #ANY-HELP-APPRECIATET
  15. Well as stated I am trying to get memory to work. I am using the cheat engine tutorial just trying to read a memory values. I am using NomadMemory and Nomadmemory2 which I will link for you all and anyone else that is having the same problem. At this point I am thinking my OS and Autoit are too new for it. Can anyone help with getting this to work? NomadMemory.au3 NomadMemory2.au3
  16. I am looking for a way to set up either VIRTUAL_PROTECT or PAGE_GUARD for memory protection. I currently don't know how to do this, I have made the encryption for my EXE Protector, the RunPE module, and basically everything that I need. I also have made an advanced obfuscation tool, which I might release here on the forums in the future, to make sure the code is impossible to be understood. However, people can dump the original EXE from memory when I am injecting it. So how would I implement VIRTUAL_PROTECT, PAGE_GUARD or other methods of protecting memory?
  17. Here's the goal: Create a handle to a bitmap object using _WinApi_PrintWindow (this is done and working properly, I can take a screenshot of the window even when it's hidden or offscreen, does not work minimized)Be able to search for a pixel color in memory on the handle. I can get it to work if I create a Bitmap from an HBITMAP (_GDIPlus_BitmapCreateFromHBITMAP) and then go through each pixel and check it using _GDIPlus_BitmapGetPixel but it's too slow. I've tried doing the _WinApi_GetPIxel using an $hDC but it's much slower than GDI+ (GD+ takes about 20seconds to search for almost 500,000 pixels, GetPixel takes almost 60seconds)I found the FastFind library but, honestly, it's sloppy and I'm wanting to search a defined area, not set the starting position and then search the rest of the window. I also found a few examples on the forums but I could not get them to work. Here's the CaptureWindow function. I'm only wanting to capture the client area (Not the border around the client, hence the -16 for the width and the -38 for the height, gets rid of the title bar and the resize bars on the sides. Also I'm wanting to keep the coordinates relative to the window, so if you only want to capture the screen from 480, 200 to 680, 400, then the rest of the area is black on purpose) #include-once Func CaptureWindow(Const $iLeft = 0, Const $iTop = 0, Const $iWidth = -1, Const $iHeight = -1, Const $hWindow = WinGetHandle("[Active]")) Local $rect_window = WinGetPos($hWindow) Local $hDC = _WinAPI_GetWindowDC($hWindow) Local $hDestDC = _WinAPI_CreateCompatibleDC($hDC) Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $rect_window[2] - 16, $rect_window[3] - 38) Local $hDestSv = _WinAPI_SelectObject($hDestDC, $hBitmap) Local $hSrcDC = _WinAPI_CreateCompatibleDC($hDC) Local $hBmp = _WinAPI_CreateCompatibleBitmap($hDC, $rect_window[2] - 16, $rect_window[3] - 38) Local $hSrcSv = _WinAPI_SelectObject($hSrcDC, $hBmp) _WinAPI_PrintWindow($hWindow, $hSrcDC, True) If ($iWidth > 0 and $iHeight > 0) Then _WinAPI_BitBlt($hDestDC, $iLeft, $iTop, $iWidth, $iHeight, $hSrcDC, $iLeft, $iTop, $MERGECOPY) Else _WinAPI_BitBlt($hDestDC, $iLeft, $iTop, $rect_window[2] - 16 - $iLeft, $rect_window[3] - 38 - $iTop, $hSrcDC, $iLeft, $iTop, $MERGECOPY) EndIf _WinAPI_SelectObject($hDestDC, $hDestSv) _WinAPI_SelectObject($hSrcDC, $hSrcSv) _WinAPI_ReleaseDC($hWindow, $hDC) _WinAPI_DeleteDC($hDestDC) _WinAPI_DeleteDC($hSrcDC) _WinAPI_DeleteObject($hBmp) Return $hBitmap EndFunc ;==>CaptureWindowAnd the first attempt for PixelSearch, using GDI+ (Fastest) Func PixelSearchInhBitmap(Const ByRef $hHBmp, Const ByRef $color, Const $tolerance = 10, Const $iLeft = 0, Const $iTop = 0, $iWidth = -1, $iHeight = -1, Const $iStep = 1) Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBmp) Local $rbg_color = _ColorGetRGB("0x" & Hex($color, 6)) Local $found_color = False Local $abscoord_color[2] = [0, 0] Local $red_low = 0 Local $green_low = 0 Local $blue_low = 0 Local $red_high = 0 Local $green_high = 0 Local $blue_high = 0 $red_low = ($tolerance > $rbg_color[0] ? 0 : $rbg_color[0] - $tolerance) $green_low = ($tolerance > $rbg_color[1] ? 0 : $rbg_color[1] - $tolerance) $blue_low = ($tolerance > $rbg_color[2] ? 0 : $rbg_color[2] - $tolerance) $red_high = ($tolerance > 255 - $rbg_color[0] ? 255 : $rbg_color[0] + $tolerance) $green_high = ($tolerance > 255 - $rbg_color[1] ? 255 : $rbg_color[1] + $tolerance) $blue_high = ($tolerance > 255 - $rbg_color[2] ? 255 : $rbg_color[2] + $tolerance) If ($iWidth = -1) Then $iWidth = _GDIPlus_ImageGetWidth($hBitmap) If ($iHeight = -1) Then $iHeight = _GDIPlus_ImageGetHeight($hBitmap) Local $start_time = TimerInit() For $iY = $iTop To $iHeight Step $iStep For $iX = $iLeft To $iWidth Step $iStep Local $get_pixel = _GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY) If (@Error) Then ContinueLoop Local $pixel_color = _ColorGetRGB("0x" & Hex($get_pixel, 6)) If (@Error) Then ContinueLoop If (($pixel_color[0] >= $red_low and $pixel_color[0] <= $red_high) and ($pixel_color[1] >= $green_low and $pixel_color[1] <= $green_high) and ($pixel_color[2] >= $blue_low and $pixel_color[2] <= $blue_high)) Then $found_color = True $abscoord_color[0] = $iX $abscoord_color[1] = $iY ExitLoop 2 EndIf Next Next MsgBox("", "", TimerDiff($start_time) / 1000) _GDIPlus_BitmapDispose($hBitmap) If ($found_color) Then Return $abscoord_color Else Return SetError(-1, 0, 0) EndIf EndFuncSecond attempt using _WInApi_GetPixel (Note. I replaced the Autoit function with my own where I replaced the string "gdi32.dll" with a handle to the opened DLL. In the hopes it would improve time. The time difference was not noticable) Global $HWND_DLL_GDI32 = DLLopen("gdi32.dll") Func PixelSearchInhDC(Const ByRef $color, Const $tolerance = 10, Const $iLeft = 0, Const $iTop = 0, $iWidth = -1, $iHeight = -1, Const $iStep = 1, Const $hWnd_window = WinGetHandle("[Active]")) Local $hDC = _WinAPI_GetWindowDC($hWnd_window) Local $rbg_color = _ColorGetRGB("0x" & Hex($color, 6)) Local $found_color = False Local $abscoord_color[2] = [0, 0] Local $start_time, $end_time Local $red_low = 0 Local $green_low = 0 Local $blue_low = 0 Local $red_high = 0 Local $green_high = 0 Local $blue_high = 0 If (Not $hDC) Then Return SetError(1, 0, 0) EndIf If ($iWidth = -1 or $iHeight = -1) Then Local $rect_window = WinGetPos($hWnd_window) If ($iWidth = -1) Then $iWidth = $rect_window[2] - $iLeft If ($iHeight = -1) Then $iHeight = $rect_window[3] - $iTop EndIf $red_low = ($tolerance > $rbg_color[0] ? 0 : $rbg_color[0] - $tolerance) $green_low = ($tolerance > $rbg_color[1] ? 0 : $rbg_color[1] - $tolerance) $blue_low = ($tolerance > $rbg_color[2] ? 0 : $rbg_color[2] - $tolerance) $red_high = ($tolerance > 255 - $rbg_color[0] ? 255 : $rbg_color[0] + $tolerance) $green_high = ($tolerance > 255 - $rbg_color[1] ? 255 : $rbg_color[1] + $tolerance) $blue_high = ($tolerance > 255 - $rbg_color[2] ? 255 : $rbg_color[2] + $tolerance) $start_time = TimerInit() For $iY = $iTop To $iHeight Step $iStep For $iX = $iLeft To $iWidth Step $iStep Local $get_pixel = __WinAPI_GetPixel($hDC, $iX, $iY) If (@Error) Then ContinueLoop Local $pixel_color = _ColorGetRGB("0x" & Hex($get_pixel, 6)) If (@Error) Then ContinueLoop If (($pixel_color[0] >= $red_low and $pixel_color[0] <= $red_high) and ($pixel_color[1] >= $green_low and $pixel_color[1] <= $green_high) and ($pixel_color[2] >= $blue_low and $pixel_color[2] <= $blue_high)) Then $found_color = True $abscoord_color[0] = $iX $abscoord_color[1] = $iY ExitLoop 2 EndIf Next Next MsgBox("", "", TimerDiff($start_time) / 1000 & "s") If ($found_color) Then Return $abscoord_color Else Return SetError(1, 0, 0) EndIf EndFunc Func __WinAPI_GetPixel($hDC, $iX, $iY) Local $aRet = DllCall($HWND_DLL_GDI32, 'dword', 'GetPixel', 'handle', $hDC, 'int', $iX, 'int', $iY) If @error Or ($aRet[0] = 4294967295) Then Return SetError(@error, @extended, -1) ; If $aRet[0] = 4294967295 Then Return SetError(1000, 0, -1) Return __RGB($aRet[0]) EndFunc ;==>__WinAPI_GetPixel
  18. Hey dear community, i write alot of programs that i sell. i coded a sucessfull license system but sadly i have no protection against memory dumps. i already tried playing with "memory.au3" but failed at it. anyone has a idea how i can call use page guard ? Thanks
  19. hello autoit developers community i have some question , i hope to find the answers of it : - in large project or even in small ones how to make my compiled script use less memory ? - how to test my script and be sure that there is no memory leak , or whatsoever reduce my script performance ? - where can i find anything talks about autoit script architecture to avoid bad script design ? last thing i find these script can anyone describe how these scripts work and is these script actually work fine thanks Func _ReduceMemory() Local $ai_GetCurrentProcessId = DllCall('kernel32.dll', 'int', 'GetCurrentProcessId') Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $ai_GetCurrentProcessId[0]) Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0]) DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0]) Return $ai_Return[0] EndFunc Func _SelfReduceMemory() DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", -1) EndFunc
  20. Good Morning AutoIT Geniuses! Maybe this question is answered somewhere already... but I'm looking to ramp up the priority or "speed" of my exe's. So, I've been experimenting and I don't see a huge increase in completion regardless of the processor or memory I use. Sure, if I increase the memory I don't run out of memory, but if I increase memory - things relatively stay the same... why is that? In another scenario for instance, I put the exe on a Dell server w/ 24 GB of ram and several quad core Xeon cpu's and the time to execute was relatively the same... Oh, and the CPU never spiked or went above 5%... even after I stepped up it's priority. That seemed impossible - so I'm asking - is AutoIT mostly responsible for system resources used or is it on Windows? I used WIndows 7 x64 and Windows Server 2012. Clueless as to what the guts are behind AutoIT and how Windows hands the exe's resources or how AutoIT "tells" Windows how to handle it's resources. This day in age, we have quad cores +++ and then some... so this app should be screaming fast - it's not like I'm playing Crysis in 8K - haha, lol.
  21. Version 0.9.9.7 build 2014-08-27

    1,211 downloads

    is a small tool in widget style to show the clock, current cpu usage, cpu speed, memory usage and network activity (tcp, ip and udp). Additionally you can use it as an alarm clock (to stop alarm clock tone press the left LED (mail) or wait 60 seconds). The current cpu usage code is beta and might be not working for some CPU models! Autoit SysInfo Clock should work with all operating systems beginning from Windows XP. Br, UEZ This project is discontinued!
  22. Hey guys, im writing on my project and got some memory leaks. Actual im looking for the leak for a month and now i got some curios results. I wrote some testscripts, to see, if AutoIt causes memory leaks. So i wrote some testscript for Listviews, Lists, and Labels to see, if i create a Listview with lets say 1000 items and delete them, does AutoIt reset the complete memory of these items? i'd say no. I did some tests and got the result that in best case 4K memory is missing ... Testscript #1: Listview created by nature func in combination with UDF funcs to create and delete items. #include #include #include Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Local $hGUI = GUICreate("GUI", 500, 500) Local $hListview = GUICtrlCreateListView("Column 1", 10, 50, 480, 440) Local $hButton1 = GUICtrlCreateButton("Create 100 Items", 10, 10, 100, 30) Local $hButton2 = GUICtrlCreateButton("Delete All Items", 120, 10, 100, 30) GUISetState(@SW_SHOW, $hGUI) GUICtrlSetOnEvent($hButton1, "_create_items") GUICtrlSetOnEvent($hButton2, "_delall_items") GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") While 1 Sleep(100) WEnd Func _create_items() For $i = 0 To 100 _GUICtrlListView_AddItem($hListview, Random(0, 2000)) Next EndFunc Func _delall_items() _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hListview)) EndFunc Func _exit() Exit EndFuncTestscript #2: Listview created by UDFfunc in combination with UDF funcs to create and delete items. #include #include #include Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Local $hGUI = GUICreate("GUI", 500, 500) local $hListview = _GUICtrlListView_Create($hGUI, "Column 1", 10, 50, 480, 440) Local $hButton1 = GUICtrlCreateButton("Create 100 Items", 10, 10, 100, 30) Local $hButton2 = GUICtrlCreateButton("Delete All Items", 120, 10, 100, 30) GUISetState(@SW_SHOW, $hGUI) GUICtrlSetOnEvent($hButton1, "_create_items") GUICtrlSetOnEvent($hButton2, "_delall_items") GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") While 1 Sleep(100) WEnd Func _create_items() For $i = 0 To 100 _GUICtrlListView_AddItem($hListview, Random(0, 2000)) Next EndFunc Func _delall_items() _GUICtrlListView_DeleteAllItems($hListview) EndFunc Func _exit() Exit EndFuncTestscript #3: Creating a list #include <GUIConstantsEx.au3> #include <GuiListView.au3> Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Local $hGUI = GUICreate("GUI", 500, 500) Local $hList = GUICtrlCreateList("Column 1", 10, 50, 480, 440) Local $hButton1 = GUICtrlCreateButton("Create 100 Items", 10, 10, 100, 30) Local $hButton2 = GUICtrlCreateButton("Delete All Items", 120, 10, 100, 30) GUISetState(@SW_SHOW, $hGUI) GUICtrlSetOnEvent($hButton1, "_create_items") GUICtrlSetOnEvent($hButton2, "_delall_items") GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") While 1 Sleep(100) WEnd Func _create_items() For $i = 0 To 100 GUICtrlSetData($hList, Random(0, 2000)) Next EndFunc Func _delall_items() GUICtrlSetData($hList, "") EndFunc Func _exit() Exit EndFuncTestscript #4: Working with labels. #include #include #include Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Local $hGUI = GUICreate("GUI", 500, 500) Local $hlabel = GUICtrlCreateLabel("AP's: ", 10, 45, 100, 440) Local $hlabel2 = GUICtrlCreateLabel("AP's: ", 110, 45, 100, 440) Local $hlabel3 = GUICtrlCreateLabel("AP's: ", 210, 45, 100, 440) Local $hlabel4 = GUICtrlCreateLabel("AP's: ", 310, 45, 100, 440) Local $hlabel5 = GUICtrlCreateLabel("AP's: ", 410, 45, 100, 440) Local $hButton1 = GUICtrlCreateButton("Create 100 Items", 10, 10, 100, 30) Local $hButton2 = GUICtrlCreateButton("Delete All Items", 120, 10, 100, 30) GUISetState(@SW_SHOW, $hGUI) GUICtrlSetOnEvent($hButton1, "_create_items") GUICtrlSetOnEvent($hButton2, "_delall_items") GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") While 1 Sleep(100) WEnd Func _create_items() Local $sMsg = "" Local $sMsg2 = "" Local $sMsg3 = "" Local $sMsg4 = "" Local $sMsg5 = "" For $i = 0 To 30 $sMsg = $sMsg & Random(1,200) & @CR $sMsg2 = $sMsg2 & Random(1,200) & @CR $sMsg3 = $sMsg3 & Random(1,200) & @CR $sMsg4 = $sMsg4 & Random(1,200) & @CR $sMsg5 = $sMsg5 & Random(1,200) & @CR Next GUICtrlSetData($hlabel, $sMsg) GUICtrlSetData($hlabel2, $sMsg2) GUICtrlSetData($hlabel3, $sMsg3) GUICtrlSetData($hlabel4, $sMsg2) GUICtrlSetData($hlabel5, $sMsg3) EndFunc Func _delall_items() GUICtrlSetData($hlabel, "") GUICtrlSetData($hlabel2, "") GUICtrlSetData($hlabel3, "") GUICtrlSetData($hlabel4, "") GUICtrlSetData($hlabel5, "") EndFunc Func _exit() Exit EndFunc Got someone a statements for me, if its true? Regards Looked up here: http://www.google.com (Also tried to find out if ShellExecute causes problems) and some more...
  23. _GDIPlus_Startup() $hImage = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage) $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000) _GDIPlus_GraphicsFillRect($hGraphic, 0, 0, $iWidth, $iHeight, $hBrush) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("OCR A Extended") $hFont = _GDIPlus_FontCreate($hFamily, $FontSize, 0) $tLayout = _GDIPlus_RectFCreate(10, 10, 0, 0) $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $sString, $hFont, $tLayout, $hFormat) $hBrush = _GDIPlus_BrushCreateSolid(0xFF37FF00) _GDIPlus_GraphicsDrawStringEx($hGraphic, $sString, $hFont, $aInfo[0], $hFormat, $hBrush) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_DeleteObject($hBitmap) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_GraphicsDispose($hGraphic) $TempImg = _TempFile(@ScriptDir, "", ".png") _GDIPlus_ImageSaveToFile($hImage, $TempImg) $NewImage = FileRead($TempImage) I'd like to get rid of this $TempImg = _TempFile(@ScriptDir, "", ".png") _GDIPlus_ImageSaveToFile($hImage, $TempImg) $NewImage = FileRead($TempImage) For example, I'm looking to encode the image object from bmp (as I think it is) to PNG, jpg, jpeg, tiff etc without actually having to save the image to the hard drive and then re-reading it to memory. I've failed to locate anything like this on the forums...
  24. Hello Community! I'm working on a script which uses WMI to expose BIOS info. The script works, but it does not release the memory it used to execute the object creation and query. The script will continually wire more and more memory everytime the case is called. As a work around, I've stored the result of the query in a variable in case it's called again, but I would like to figure out how to manage the memory better. The code itself is for HP Bios, so it's not likely to work on a non HP machine. #include <Constants.au3> Opt("TrayMenuMode", 1) TraySetState() $ItemSerial = TrayCreateItem("Serial Number") While 1 $msg = TrayGetMsg() Select Case $msg = $ItemSerial TrayItemSetState($ItemSerial, $TRAY_UNCHECKED) If $Serial = "" Then $objWMI = ObjGet("winmgmts:" & @ComputerName & "rootHPInstrumentedBIOS") If $objWMI = ("") Then BasicSet() $colItems = $objWMI.ExecQuery("SELECT * FROM HPBIOS_BIOSString", "WQL", "wbemFlagReturnImmediately" + "wbemFlagForwardOnly") If IsObj($colItems) Then For $objItems In $colItems If $objItems.Name = "Serial Number" Then $Serial = $objItems.Value EndIf Next EndIf EndIf MsgBox(0, "Serial Number", "Serial Number is " & $Serial, 30) $objWMI = 0 ; This deletes the object For simplicity I pulled out one example from the script, my apologies if something is missing.
×
×
  • Create New...