darthwhatever
Active Members-
Posts
25 -
Joined
-
Last visited
Profile Information
-
Location
Sunny Southern California
-
Interests
Autoit, playing sports, rts games
darthwhatever's Achievements
Seeker (1/7)
2
Reputation
-
I believe I have found a bug in the latest version of Tidy, which I have downloaded from the Scite4Autoit website. Tidying the following code If $a[1 - function('')] Then ElseIf $a[fucntion()] Then ElseIf $a[(0)] Then ElseIf $a[function() - 0] Then ElseIf $a[function(0)] = 1 Then EndIfwill erase the whitespace between the closing brackets and the then keyword whenever the last expression is a function. This also occurs on ElseIf lines, and results in this code: If $a[1 - function('')]Then ElseIf $a[function()]Then ElseIf $a[(0)]Then ElseIf $a[function() - 0] Then ElseIf $a[function(0)] = 1 Then EndIfWhich does not run. Should I submit a bug report on the autoit bugtracker? For now I can either use the #Tidy_on and #Tidy_off directives to skip these lines so that the source actually runs.
-
DreamVB reacted to a post in a topic: RPN Calculator
-
Whoops. I was going to add the option for the user to add functions, but decided that was too much of a pain. Attached file is updated.
- 4 replies
-
- RPN
- Reverse Polish Notation
-
(and 1 more)
Tagged with:
-
Reverse Polish Notation (RPN) is a math notation in which each operator follows its two operands. I own an HP 48G calculator which uses RPN, and when I tried to use the windows calculator I had so much trouble that I wrote my own calculator. Basically, it has a stack of numbers; any time an operator is pressed, that operation is carried out immediately on the two items on the bottom of the stack, or the stack and the input if there is anything in the input. This method reduces the requirements for parenthesis and makes calculating equations/functions relatively easy: instead of (sqrt(5+8))/(8*9) you would enter 5 ENTER 8 + SQRT 8 ENTER 9 * / Practical implications Suggestions/advice/criticisms are greatly appreciated! calc2.au3
- 4 replies
-
- RPN
- Reverse Polish Notation
-
(and 1 more)
Tagged with:
-
_RESH_SyntaxHighlight fails when it tries to highlight RESH.au3 AutoIt crashes with a return value of C0000005. I inserted a ton of ConsoleWrite() commands and I think it stops on line 286 Until StringRegExp($aCode[$iLine], "(?i)\A[^;]*(#ce|#comments-end)") reproducer: #include "RESH.au3" Global $hGUI = GUICreate("RESH Example", 724, 600) global $hRichEdit = _GUICtrlRichEdit_Create($hGUI, '', 10, 10, 704, 580) GUISetState() ConsoleWrite('!> This will fail on line 286 of RESH.au3' & @CRLF & '> Until StringRegExp($aCode[$iLine], "(?i)\A[^;]*(#ce|#comments-end)")' & @CRLF) sleep(3000) _GUICtrlRichEdit_SetText($hRichEdit, FileRead('RESH.au3')) sleep(3000) ConsoleWrite('!> beginning _RESH_SyntaxHighlight($hRichEdit)' & @CRLF) _RESH_SyntaxHighlight($hRichEdit) ConsoleWrite('!> This ConsoleWrite command will never be executed' & @CRLF) It highlights all the other files I have tested without any problems. I am running Windows XP Pro and AutoIt 3.3.8.1
-
Marquee UDF - New release 13 Jan 2019
darthwhatever replied to Melba23's topic in AutoIt Example Scripts
I think what JScript is trying to say is that since there are no longer any references to the Shell.Explorer.2 object, it gets swapped to the disc. And since there are no more references anymore, it won't need to be swapped back from the hard drive. However, other parts of the memory will need to be swapped back in from the hard drive, resulting in (or caused by, I'm not sure) page faults. Bottom line, Melba23, I would recommend against using the __GUIMarquee_MemReduce or _ReduceMemory function, because it's not worth worrying about that 0.4% of your memory being used. Actually that's 0.4% on my computer, which has only 2gb of ram. If programmers want to use EmptyWorkingSet, let them do it themselves. -
JScript reacted to a post in a topic: _AdlibEnhance.au3 (UDF) - Call functions with parameters, pause and resume!
-
Nice! Is there any way to call the function with different parameters every time? the way it it right now, the parameters are stored when _Adlib_Register() is called. ; #FUNCTION# ==================================================================================================================== ; Name...........: _Adlib_SetParams ; Description ...: Pauses the Enhanced Adlib functionality for defined function. ; Syntax.........: _Adlib_Pause( "Function", "Params" ) ; Parameters ....: Function - The name of the adlib function to pause. ; Params - The new parameter(s). ; Return values .: Success - Return 1 ; Failure - Return 0 ; Author ........: darthWhatever ; Modified.......: ; Remarks .......: ; Related .......: _Adlib_Resume, _Adlib_Register, _Adlib_UnRegister, _Adlib_SetTimer ; Link ..........; ; Example .......; _Adlib_SetParams( "MyFunction", "NewParam1|NewParam2" ) ; =============================================================================================================================== Func _Adlib_SetParams($sFuncName, $sParams) Local $iIndex = __ADB_GetIndex($sFuncName) If Not $iIndex Then Return 0 $avADB_CALLS[$iIndex][1] = $sParams Return 1 EndFunc ;==>_Adlib_SetParams
- 22 replies
-
- adlib
- adlibregister
-
(and 3 more)
Tagged with:
-
#include <iostream> int main () { std::cout << "sizeof(int) = " << sizeof(int) << std::endl; std::cout << "sizeof(__int32) = " << sizeof(__int32) << std::endl; std::cout << "sizeof(__int64) = " << sizeof(__int64) << std::endl; std::cin.get(); }correctly shows _int64 being twice as large as a 32 bit int Shouldn't be any problem Link to explanation Edit: Are you sure you want to use __int64? What kind of program could you possibly be writing that needs a range of –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 (link)?
-
When I ran this snippet, this displays -1. As for stepping through the code, you can set breakpoints by Right Clicking > Breakpoint > Insert Breakpoint, or clicking on the gray area to the left of the line numbers. You can then view all your variables and their values while the code is running in the Locals window which should appear at the bottom of the VS window. If it does not, click Debug > Windows > Locals. Hope this helps!
-
Feature requests: Translate Help file to English. If the cursor is on a line with #include then have intellisense list the files in the include directories.This would only be doable if the Studio keeps track of the valid include directories. Intellisense for functions defined in the main file. SciTE uses a file named "au3.userUDFs.properties" for user defined functions. This file has the same syntax as the other properties files but uses "au3.keywords.user.udfs=userUDFs " etc. It doesn't look like the Studio uses the au3.keywords.user.udfs identifier, but it would be nice if these keywords could be added. EDIT: I now see that the keywords have been added after I added to the au3.user.calltips.api file Automatically insert tabs when pressing enter after entering a beginning keyword (if, while, switch, do, for, etc.) and delete a tab after entering an ending keyword (endif, WEnd, next, until, etc.) Is there any way to update intellisense for variables in real time? it currently seems to be updating when the file is saved. Have local variables in the Script Tree be subitems of the function that they belong to, so you would go to Functions > _StartService > $arRet.I'm going to have to look at making plugins for mercurial, git etc.So far, great job! I will definitely be using this in the future!
- 995 replies
-
- isn autoit studio
- isn
-
(and 3 more)
Tagged with:
-
Newbie Looking for Language
darthwhatever replied to ZiggyStardust's topic in AutoIt General Help and Support
The Asc() command gives the ASCII code of a character, but when I run Asc('{pgdn}') or Asc('{pgup}') it returns the code for the bracket, so I guess that pgdn doesn't have a code you can still use the string values for _BlockInputEx, so it would be _BlockInputEx(1, '{pgdn}|{pgup}|{esc}|{F5}|{F12}') If you are new to AutoIt, then I would highly recommend simply reading through the help file that comes with AutoIt. AutoIt was my first scripting language, and I completely taught myself to code using only the help file and SciTE. -
recursive function not returning
darthwhatever replied to darthwhatever's topic in AutoIt General Help and Support
actually for all three do--until loops, I have the func _continue() set $bContinue to true. and _continue() is called by the hotkeyset Thanks for looking, though -
I recently got a second monitor for my computer and wrote this program to move windows to one side or the other if they are split across two screens. It uses a recursive function to move the window either to the right or the left. The problem is when a window exists that apparently has no title, text, class, process, or state, but still manages to get past line 27 AND past lines 201 and 122, where the function should return if there is any error. When I run this script, I get this output: This error pops up when you drag a file between windows; GameRanger also randomly causes it to crash. My question is this: why is the function not returning on line 201 or line 122? Source: Global $iDiff, $iCenter = @DesktopWidth / 2, $bSwitchView = False, $bIconSwitch = False Global $bContinue = False Opt("GUIOnEventMode", 1) Opt("WinDetectHiddenText", 1) TraySetPauseIcon(@WindowsDir & '\explorer.exe', -10) If Not @Compiled Then HotKeySet('{esc}', '_exit') AutoItSetOption('TrayIconDebug', 1) EndIf AdlibRegister('_SwitchIcon', 1000) TraySetIcon(@WindowsDir & '\explorer.exe', -12) While True $aList = WinList() If @error Or Not IsArray($aList) Then ConsoleWrite('Error: could not complete WinList()' & @crlf) ConsoleWrite('Press {esc} to continue...' & @crlf) HotKeySet('{esc}', '_continue') Do Sleep(1000) Until $bContinue $bContinue = False ContinueLoop EndIf For $i = 1 To $aList[0][0] If $aList[$i][0] = "Program Manager" Then ContinueLoop If $aList[$i][0] <> "" And _IsVisible($aList[$i][1]) And Not _IsMaximized($aList[$i][1]) Then $iCoords = WinGetPos($aList[$i][1]) If $iCoords[0] + $iCoords[2] > $iCenter And $iCoords[0] < $iCenter Then $iDiff = @DesktopWidth - ($iCoords[0] + $iCoords[2]) If $iDiff < $iCoords[0] Then _MoveWindowLeft($aList[$i][1]) Else _MoveWindowRight($aList[$i][1]) EndIf EndIf ElseIf $aList[$i][0] <> "" And _IsMaximized($aList[$i][1]) And _IsVisible($aList[$i][1]) Then $bSwitchView = Not $bSwitchView If $bSwitchView Then WinSetState($aList[$i][1], '', @SW_RESTORE) WinMove($aList[$i][1], '', 0, 10, $iCenter, @DesktopHeight - 50) Else WinSetState($aList[$i][1], '', @SW_RESTORE) WinMove($aList[$i][1], '', $iCenter + 5, 10, $iCenter, @DesktopHeight - 50) EndIf EndIf Next Sleep(5) WEnd Func _continue() HotKeySet('{esc}') $bContinue = True Return $bContinue EndFunc ;==>_continue Func _exit() Exit 1 EndFunc ;==>_exit Func _MoveWindowLeft($hWnd) Local $iCoords, $sClassList, $sWindowTitle, $iPID, $iState, $sText, $sMsg, $sRet $iCoords = WinGetPos($hWnd) If @error Or Not IsArray($iCoords) Then ConsoleWrite('Error: could not complete WinGetPos(' & $hWnd & ')' & @crlf) ConsoleWrite('Extended information: $hWnd = ' & $hWnd & @crlf) $sWindowTitle = WinGetTitle($hWnd) If $sWindowTitle <> 0 Then ConsoleWrite('WinGetTitle(' & $hWnd & ') = ' & $sWindowTitle & @crlf) Else ConsoleWrite('Could not complete WinGetTitle' & @crlf) EndIf $sClassList = WinGetClassList($hWnd) If Not @error Then ConsoleWrite('WinGetClassList(' & $hWnd & ') = ' & $sClassList & @crlf) Else ConsoleWrite('Could not complete WinGetClassList' & @crlf) EndIf $iPID = WinGetProcess($hWnd) If $iPID <> -1 Then ConsoleWrite('WinGetProcess(' & $hWnd & ') = ' & $iPID & @crlf) Else ConsoleWrite('Could not complete WinGetProcess' & @crlf) EndIf $iState = WinGetState($hWnd) If Not @error Then $sMsg = 'States of window ' & $hWnd & ':' Switch True Case BitAND($iState, 1) $sMsg &= 'window exists, ' ContinueCase Case BitAND($iState, 2) $sMsg &= 'window is visible, ' ContinueCase Case BitAND($iState, 4) $sMsg &= 'window is enabled, ' ContinueCase Case BitAND($iState, 8) $sMsg &= 'window is active, ' ContinueCase Case BitAND($iState, 16) $sMsg &= 'window is minimized, ' Case BitAND($iState, 32) $sMsg &= 'window is maximized, ' EndSwitch If not ($sMsg = 'States of window ' & $hWnd & ':') Then $sMsg = StringTrimRight($sMsg, 2) EndIf ConsoleWrite($sMsg & @crlf) Else ConsoleWrite('Could not complete WinGetState' & @crlf) EndIf $sText = WinGetText($hWnd) If $sText <> 0 Then ConsoleWrite('WinGetText(' & $hWnd & ') = ' & $sText & @crlf) Else ConsoleWrite('Could not complete WinGetText' & @crlf) EndIf ConsoleWrite('Press {esc} to continue...' & @crlf) HotKeySet('{esc}', '_continue') Do Sleep(1000) Until $bContinue $bContinue = False Run(@ScriptFullPath) Return False ;<<<<<<<<<<<<<<<<<<<<<<<<<SHOULD RETURN HERE>>>>>>>>>>>>>>>>>>>>>>>>> Else WinMove($hWnd, '', $iCoords[0] - 25, $iCoords[1]) If $iCoords[0] + $iCoords[2] > $iCenter And $iCoords[0] < $iCenter Then Sleep(5) _MoveWindowLeft($hWnd) EndIf $iCoords = WinGetPos($hWnd) If $iCoords[0] < 0 Then WinMove($hWnd, '', 5, $iCoords[1], $iCenter - 10) EndIf EndIf Return True EndFunc ;==>_MoveWindowLeft Func _MoveWindowRight($hWnd) Local $sClassList, $sWindowTitle, $iPID, $iState, $sText, $sMsg, $sRet $iCoords = WinGetPos($hWnd) If @error Or Not IsArray($iCoords) Then ConsoleWrite('Error: could not complete WinGetPos(' & $hWnd & ')' & @crlf) ConsoleWrite('Extended information: $hWnd = ' & $hWnd & @crlf) $sWindowTitle = WinGetTitle($hWnd) If $sWindowTitle <> 0 Then ConsoleWrite('WinGetTitle(' & $hWnd & ') = ' & $sWindowTitle & @crlf) Else ConsoleWrite('Could not complete WinGetTitle' & @crlf) EndIf $sClassList = WinGetClassList($hWnd) If Not @error Then ConsoleWrite('WinGetClassList(' & $hWnd & ') = ' & $sClassList & @crlf) Else ConsoleWrite('Could not complete WinGetClassList' & @crlf) EndIf $iPID = WinGetProcess($hWnd) If $iPID <> -1 Then ConsoleWrite('WinGetProcess(' & $hWnd & ') = ' & $iPID & @crlf) Else ConsoleWrite('Could not complete WinGetProcess' & @crlf) EndIf $iState = WinGetState($hWnd) If Not @error Then $sMsg = 'States of window ' & $hWnd & ':' Switch True Case BitAND($iState, 1) $sMsg &= 'window exists, ' ContinueCase Case BitAND($iState, 2) $sMsg &= 'window is visible, ' ContinueCase Case BitAND($iState, 4) $sMsg &= 'window is enabled, ' ContinueCase Case BitAND($iState, 8) $sMsg &= 'window is active, ' ContinueCase Case BitAND($iState, 16) $sMsg &= 'window is minimized, ' Case BitAND($iState, 32) $sMsg &= 'window is maximized, ' EndSwitch If not ($sMsg = 'States of window ' & $hWnd & ':') Then $sMsg = StringTrimRight($sMsg, 2) EndIf ConsoleWrite($sMsg & @crlf) Else ConsoleWrite('Could not complete WinGetState' & @crlf) EndIf $sText = WinGetText($hWnd) If $sText <> 0 Then ConsoleWrite('WinGetText(' & $hWnd & ') = ' & $sText & @crlf) Else ConsoleWrite('Could not complete WinGetText' & @crlf) EndIf ConsoleWrite('Press {esc} to continue...' & @crlf) HotKeySet('{esc}', '_continue') Do Sleep(1000) Until $bContinue $bContinue = False Run(@ScriptFullPath) Return False ;<<<<<<<<<<<<<<<<<<<<<<<<<SHOULD RETURN HERE>>>>>>>>>>>>>>>>>>>>>>>>> Else WinMove($hWnd, '', $iCoords[0] + 25, $iCoords[1]) If $iCoords[0] + $iCoords[2] > $iCenter And $iCoords[0] < $iCenter Then Sleep(5) _MoveWindowRight($hWnd) EndIf $iCoords = WinGetPos($hWnd) If ($iCoords[0] + $iCoords[2]) > @DesktopWidth Then WinMove($hWnd, '', $iCenter + 5, $iCoords[1], $iCenter - 10) EndIf EndIf Return True EndFunc ;==>_MoveWindowRight Func _IsMaximized($handle) If BitAND(WinGetState($handle), 32) Then Return 1 Else Return 0 EndIf EndFunc ;==>_IsMaximized Func _IsVisible($handle) If BitAND(WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>_IsVisible Func _SwitchIcon() $bIconSwitch = Not $bIconSwitch If $bIconSwitch Then TraySetIcon(@WindowsDir & '\explorer.exe', -12) Else TraySetIcon(@WindowsDir & '\explorer.exe', -13) EndIf EndFunc ;==>_SwitchIcon
-
AutoIt Windows Screenshooter v1.84 Build 2019-08-18
darthwhatever replied to UEZ's topic in AutoIt Example Scripts
why is it that it crashes when I press the exit button from the bar on top ($GUI_EVENT_CLOSE), but not when I press the button on the bottom ($Button_Exit)? I have windows XP, and this works perfectly for the screenshots that my C++ teacher wants (other than the crashing on exit)- 129 replies
-
- screencapture
- gdi+
-
(and 3 more)
Tagged with:
-
sorry about the slow reply - I have only intermittent access to the internet this is supposed to be compiled with the script - start in debug mode if there is some command line, or if there is some error I wrote it this way because the scripts that I write invariably don't work on other computers, so I wanted something to try and find out what was going wrong
-
-Create a console to send debug data to, much like ConsoleWrite, only with much more options and works whether or not it is compiled -Query whether a variable exists, what type it is, and what its value is -output the value of macros as well functions: _DebugGUI_Create, _DebugGUI_Write, _DebugGUI_ChangeSettings, _DebugGUI_QueryVar, _DebugGUI_Destroy This is my first upload, so any input is appreciated! #include-once #include "ButtonConstants.au3" #include "EditConstants.au3" #include 'GUIConstantsEx.au3' #include 'GUIListBox.au3' #include 'WindowsConstants.au3' #include 'GuiRichEdit.au3' ; Title: Debugging UDF ; Filename: DebugGUI.au3 ; Description: Create a debugging console to write data to ; Author: darth_whatever ; Version: 1.0 ; Requirements: AutoIt v3.3 +, Developed/Tested on WindowsXP Pro Service Pack 2 ; Uses: Standard Autoit3 UDF library GuiRichEdit.au3 ; Remarks: You MUST use OnEventMode (not GUIMsgMode) in order to use the buttons on this script. I'm sorry, but thats the way this script is written. ; If this script used GuiMsgMode, then using this script would freeze the execution. ; ; ; Functions: ; _DebugGUI_Begin ( $sFilePath = 0, $iBkColor = 0x000000, $iAutoShowOnCritical = 1, $iShowFlag = @SW_SHOW, $sWinTitle = @ScriptName, $iAlwaysOnTop = False, _ ; $iWidth = 406, $iHeight = 432, $iLeft = 438, $iTop = 282 ) ; Begins debugging session. Returns 0 and sets @error to 1 if the debugging session has already been started. ; Success: returns handle to the GUI ; $sFilePath: path of the file to stream text to. If this is 0, no file is used ; $iBkColor: the background color to use for the Rich edit control. Default is black ; $iAutoShowOnCritical: Automatically set the state of the GUI to @SW_SHOW on a critical message ; $iShowFlag: the beginning state of the GUI ; $sWinTitle: the title of the debugging window ; $iWidth, $iHeight, $iLeft, $iTop: size/position of window ; ; _DebugGUI_Write ( $sData , $iColor = $iDebugGUI_standard, $iBkColor = 0x000000 ) ; Writes debugging data. Returns 0 and sets @error to 1 if the debugging session has not been started. ; $sData: the data to write ; $iColor: the color of the text to use ; $iBkColor: the background color to use ; ; _DebugGUI_QueryVar( $sVarName = False, $iColor = $iDebugGUI_standard ) ; Check to see if a macro variable is declared, and show its value on the console. ; $sVarName: name of the variable or macro. THIS MUST BE THE NAME OF THE VARIABLE, NOT THE VARIABLE ITSELF! ; $iColor: Color in which to show the text ; ; _DebugGUI_ChangeSettings ( $sFilePath = 0, $iBkColor = 0x000000, $iAutoShowOnCritical = 1, $iShowFlag = @SW_SHOW, $sWinTitle = @ScriptName , $iAlwaysOnTop) ; Change one or more of the settings for the main GUI. Parameters should be pretty obvious ; If you call this function with no ; ; _DebugGUI_Destroy ( ) ; Ends debugging session. If you did not specify an output file, this deletes all debugging data that you already have! Global $iDebugGUI_standard = 0xFFFFFF, _ $iDebugGUI_warning = 0x00FFFF, _ $iDebugGUI_error = 0xFFFF00, _ $iDebugGUI_critical = 0x0000FF, _ $iDebugGUI_ResumeSet, _ $iDebugGUI, _ $hDebugGUI_MainWindow, _ $hDebugGUI_RichEdit, _ $hDebugGUI_Button4, _ $hDebugGUI_Button5, _ $hDebugGUI_Input1, _ $iDebugGUI_AutoShowOnCritical, _ $sDebugGUI_FilePath OnAutoItExitRegister('_DebugGUI_ExitFunc') Func _DebugGUI_Begin($sFilePath = False, $iBkColor = 0x000000, $iAutoShowOnCritical = 1, $iShowFlag = @SW_SHOW, $sWinTitle = @ScriptName, $iAlwaysOnTop = False, _ $iWidth = 406, $iHeight = 432, $iLeft = 438, $iTop = 282, $iEventMode = 1) If $iDebugGUI Then Return SetError(1, 0, 0) $iOnEventMode = Opt("GUIOnEventMode", 1) $iDebugGUI = True $hDebugGUI_MainWindow = GUICreate($sWinTitle, $iWidth, $iHeight, $iLeft, $iTop) Opt("GUIOnEventMode", 1) GUISetOnEvent($GUI_EVENT_CLOSE, "_DebugGUI_SpecialEvents") GUISetOnEvent($GUI_EVENT_MINIMIZE, "_DebugGUI_SpecialEvents") GUISetOnEvent($GUI_EVENT_RESTORE, "_DebugGUI_SpecialEvents") $hDebugGUI_RichEdit = _GUICtrlRichEdit_Create($hDebugGUI_MainWindow, "", 10, 10, $iWidth - 20, $iHeight - 212, BitOR($ES_NOHIDESEL, $ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) _GUICtrlRichEdit_SetBkColor($hDebugGUI_RichEdit, $iBkColor) _GUICtrlRichEdit_SetCharColor($hDebugGUI_RichEdit, $iDebugGUI_standard) ;~ _GUICtrlRichEdit_SetCharAttributes($hDebugGUI_RichEdit, '+bo') ;consider skipping this to fit more text on the screen _GUICtrlRichEdit_SetReadOnly($hDebugGUI_RichEdit, True) $hDebugGUI_Button1 = GUICtrlCreateButton("Select All", 16, $iHeight - 160, 89, 25, $WS_GROUP) GUICtrlSetOnEvent(-1, "_DebugGUI_SelectAll") $hDebugGUI_Button2 = GUICtrlCreateButton("Copy Selected", 120, $iHeight - 160, 97, 25, $WS_GROUP) GUICtrlSetOnEvent(-1, "_DebugGUI_copySelected") $hDebugGUI_Input1 = GUICtrlCreateInput("", 16, $iHeight - 104, 265, 21) $hDebugGUI_Button3 = GUICtrlCreateButton("Query Variable", 296, $iHeight - 104, 97, 25, $WS_GROUP) GUICtrlSetOnEvent(-1, "_DebugGUI_QueryVar") $hDebugGUI_Button4 = GUICtrlCreateButton("Pause Script", 16, $iHeight - 62, 89, 25, $WS_GROUP) GUICtrlSetOnEvent(-1, "_DebugGUI_pause") $hDebugGUI_Button5 = GUICtrlCreateButton("Resume Script", 120, $iHeight - 62, 89, 25, $WS_GROUP) GUICtrlSetOnEvent(-1, "_DebugGUI_resume") GUICtrlSetState($hDebugGUI_Button5, $GUI_DISABLE) GUISetState($iShowFlag) WinSetOnTop($hDebugGUI_MainWindow, '', $iAlwaysOnTop) $iDebugGUI_AlwaysOnTop =- $iAlwaysOnTop $sDebugGUI_FilePath = $sFilePath If $iAutoShowOnCritical Then $iDebugGUI_AutoShowOnCritical = True Opt("GUIOnEventMode", $iOnEventMode) If Not $iOnEventMode Then _DebugGUI_Write('Error: OnEventMode is not enabled. None of the buttons will work.', $iDebugGUI_warning) GUICtrlSetState($hDebugGUI_Button1, $GUI_DISABLE) GUICtrlSetState($hDebugGUI_Button2, $GUI_DISABLE) GUICtrlSetState($hDebugGUI_Button3, $GUI_DISABLE) GUICtrlSetState($hDebugGUI_Button4, $GUI_DISABLE) GUICtrlSetState($hDebugGUI_Button5, $GUI_DISABLE) GUICtrlSetState($hDebugGUI_Input1, $GUI_DISABLE) Return SetError(2, 0, $hDebugGUI_MainWindow) EndIf Return $hDebugGUI_MainWindow EndFunc ;==>_DebugGUI_Begin Func _DebugGUI_ChangeSettings($sFilePath = 0, $iBkColor = 0x000000, $iAutoShowOnCritical = 1, $iShowFlag = @SW_SHOW, $sWinTitle = @ScriptName, $iAlwaysOnTop = False ) If Not $iDebugGUI Then Return SetError(101, 0, 0) If @NumParams >= 1 Then $sDebugGUI_FilePath = $sFilePath If @NumParams >= 2 Then _GUICtrlRichEdit_SetSel($hDebugGUI_RichEdit, -1, -1) _GUICtrlRichEdit_SetBkColor($hDebugGUI_RichEdit, $iBkColor) EndIf If @NumParams >= 3 Then $iDebugGUI_AutoShowOnCritical = $iAutoShowOnCritical If @NumParams >= 4 Then GUISetState($iShowFlag, $hDebugGUI_MainWindow) If @NumParams >= 5 Then WinSetTitle($hDebugGUI_MainWindow, '', $sWinTitle) if @NumParams >= 6 then WinSetOnTop($hDebugGUI_MainWindow, '', $iAlwaysOnTop) If @NumParams = 0 Then ;return everything to default $sDebugGUI_FilePath = $sFilePath _GUICtrlRichEdit_SetSel($hDebugGUI_RichEdit, -1, -1) _GUICtrlRichEdit_SetBkColor($hDebugGUI_RichEdit, $iBkColor) $iDebugGUI_AutoShowOnCritical = $iAutoShowOnCritical GUISetState($iShowFlag, $hDebugGUI_MainWindow) WinSetTitle($hDebugGUI_MainWindow, '', $sWinTitle) WinSetOnTop($hDebugGUI_MainWindow, '', $iAlwaysOnTop) EndIf EndFunc ;==>_DebugGUI_ChangeSettings #Region GUI Controls Func _DebugGUI_pause() GUICtrlSetState($hDebugGUI_Button4, $GUI_DISABLE) GUICtrlSetState($hDebugGUI_Button5, $GUI_ENABLE) Do Sleep(120) Until $iDebugGUI_ResumeSet GUICtrlSetState($hDebugGUI_Button4, $GUI_ENABLE) GUICtrlSetState($hDebugGUI_Button5, $GUI_DISABLE) $iDebugGUI_ResumeSet = False Return EndFunc ;==>_DebugGUI_pause Func _DebugGUI_resume() Global $iDebugGUI_ResumeSet = True EndFunc ;==>_DebugGUI_resume Func _DebugGUI_QueryVar($sVarName = False, $iColor = 0xFFFFFF) if not $iDebugGUI Then Return Local $vVar If @NumParams = 0 Then $sVarName = GUICtrlRead($hDebugGUI_Input1) If $sVarName = '' Then Return SetError(1, 0, 0) GUICtrlSetData($hDebugGUI_Input1, '') ;~ If Not IsDeclared($sVarName) Then ;~ _DebugGUI_Write($sVarName & ' is not declared!', $iDebugGUI_error) ;~ Return ;~ EndIf If StringLeft($sVarName, 1) = '@' Then Switch $sVarName Case '@AppDataCommonDir' $vVar = @AppDataCommonDir Case '@AppDataDir' $vVar = @AppDataDir Case '@AutoItExe' $vVar = @AutoItExe Case '@AutoItPID' $vVar = @AutoItPID Case '@AutoItVersion' $vVar = @AutoItVersion Case '@AutoItX64' $vVar = @AutoItX64 Case '@CommonFilesDir' $vVar = @CommonFilesDir Case '@Compiled' $vVar = @Compiled Case '@ComputerName' $vVar = @ComputerName Case '@ComSpec' $vVar = @ComSpec Case '@CPUArch' $vVar = @CPUArch Case '@CR' $vVar = @CR Case '@CRLF' $vVar = @CRLF Case '@LF' $vVar = @LF Case '@DesktopCommonDir' $vVar = @DesktopCommonDir Case '@DesktopDir' $vVar = @DesktopDir Case '@DesktopHeight' $vVar = @DesktopHeight Case '@DesktopWidth' $vVar = @DesktopWidth Case '@DesktopDepth' $vVar = @DesktopDepth Case '@DesktopRefresh' $vVar = @DesktopRefresh Case '@DocumentsCommonDir' $vVar = @DocumentsCommonDir Case '@error' $vVar = @error Case '@exitCode' $vVar = @exitCode Case '@exitMethod' $vVar = @exitMethod Case '@extended' $vVar = @extended Case '@FavoritesDir' $vVar = @FavoritesDir Case '@FavoritesCommonDir' $vVar = @FavoritesCommonDir Case '@HomeDrive' $vVar = @HomeDrive Case '@HomePath' $vVar = @HomePath Case '@HomeShare' $vVar = @HomeShare Case '@HOUR' $vVar = @HOUR Case '@IPAddress1' $vVar = @IPAddress1 Case '@IPAddress2' $vVar = @IPAddress2 Case '@IPAddress3' $vVar = @IPAddress3 Case '@IPAddress4' $vVar = @IPAddress4 Case '@KBLayout' $vVar = @KBLayout Case '@LogonDNSDomain' $vVar = @LogonDNSDomain Case '@LogonDomain' $vVar = @LogonDomain Case '@LogonServer' $vVar = @LogonServer Case '@MDAY' $vVar = @MDAY Case '@MIN' $vVar = @MIN Case '@MON' $vVar = @MON Case '@MSEC' $vVar = @MSEC Case '@MUILang' $vVar = @MUILang Case '@MyDocumentsDir' $vVar = @MyDocumentsDir Case '@OSArch' $vVar = @OSArch Case '@OSBuild' $vVar = @OSBuild Case '@OSLang' $vVar = @OSLang Case '@OSServicePack' $vVar = @OSServicePack Case '@OSType' $vVar = @OSType Case '@OSVersion' $vVar = @OSVersion Case '@ProgramFilesDir' $vVar = @ProgramFilesDir Case '@ProgramsCommonDir' $vVar = @ProgramsCommonDir Case '@ProgramsDir' $vVar = @ProgramsDir Case '@ScriptDir' $vVar = @ScriptDir Case '@ScriptFullPath' $vVar = @ScriptFullPath Case '@ScriptLineNumber' $vVar = @ScriptLineNumber Case '@ScriptName' $vVar = @ScriptName Case '@SEC' $vVar = @SEC Case '@StartMenuCommonDir' $vVar = @StartMenuCommonDir Case '@StartMenuDir' $vVar = @StartMenuDir Case '@StartupCommonDir' $vVar = @StartupCommonDir Case '@StartupDir' $vVar = @StartupDir Case '@SW_DISABLE' $vVar = @SW_DISABLE Case '@SW_ENABLE' $vVar = @SW_ENABLE Case '@SW_HIDE' $vVar = @SW_HIDE Case '@SW_LOCK' $vVar = @SW_LOCK Case '@SW_MAXIMIZE' $vVar = @SW_MAXIMIZE Case '@SW_MINIMIZE' $vVar = @SW_MINIMIZE Case '@SW_RESTORE' $vVar = @SW_RESTORE Case '@SW_SHOW' $vVar = @SW_SHOW Case '@SW_SHOWDEFAULT' $vVar = @SW_SHOWDEFAULT Case '@SW_SHOWMAXIMIZED' $vVar = @SW_SHOWMAXIMIZED Case '@SW_SHOWMINIMIZED' $vVar = @SW_SHOWMINIMIZED Case '@SW_SHOWMINNOACTIVE' $vVar = @SW_SHOWMINNOACTIVE Case '@SW_SHOWNA' $vVar = @SW_SHOWNA Case '@SW_SHOWNOACTIVATE' $vVar = @SW_SHOWNOACTIVATE Case '@SW_SHOWNORMAL' $vVar = @SW_SHOWNORMAL Case '@SW_UNLOCK' $vVar = @SW_UNLOCK Case '@SystemDir' $vVar = @SystemDir Case '@TAB' $vVar = @TAB Case '@TempDir' $vVar = @TempDir Case '@TRAY_ID' $vVar = @TRAY_ID Case '@TrayIconFlashing' $vVar = @TrayIconFlashing Case '@TrayIconVisible' $vVar = @TrayIconVisible Case '@UserProfileDir' $vVar = @UserProfileDir Case '@UserName' $vVar = @UserName Case '@WDAY' $vVar = @WDAY Case '@WindowsDir' $vVar = @WindowsDir Case '@WorkingDir' $vVar = @WorkingDir Case '@YDAY' $vVar = @YDAY Case '@YEAR' $vVar = @YEAR Case Else _DebugGUI_Write('Error: unrecognized macro', $iDebugGUI_error) Return SetError(4, 0, 0) EndSwitch _DebugGUI_Write('Value of macro ' & $sVarName & ': ' & $vVar) Return EndIf If StringLeft($sVarName, 1) = '$' Then $sVarName = StringTrimLeft($sVarName, 1) EndIf $vVar = Eval($sVarName) If @error Then _DebugGUI_Write('Error: ' & $sVarName & ' is not declared!', $iDebugGUI_error) Return SetError(2, 0, 0) EndIf $sVarName = '$' & $sVarName If IsArray($vVar) Then For $i = 0 To UBound($vVar) - 1 If $vVar[$i] = '' Then _DebugGUI_Write('Warning: ' & $sVarName & '[' & $i & '] is declared, but has no value', $iDebugGUI_warning) ContinueLoop EndIf _DebugGUI_Write('Value of ' & $sVarName & '[' & $i & ']: ' & $vVar[$i]) If IsPtr($vVar[$i]) Then _DebugGUI_Write($sVarName & '[' & $i & '] is pointer type') If IsBinary($vVar[$i]) Then _DebugGUI_Write($sVarName & '[' & $i & '] is binary type') If IsBool($vVar[$i]) Then _DebugGUI_Write($sVarName & '[' & $i & '] is boolean type') If IsDllStruct($vVar[$i]) Then _DebugGUI_Write($sVarName & '[' & $i & '] is DllStruct type') If IsFloat($vVar[$i]) Then _DebugGUI_Write($sVarName & '[' & $i & '] is floating type') If IsHWnd($vVar[$i]) Then _DebugGUI_Write($sVarName & '[' & $i & '] is HWnd type') If IsInt($vVar[$i]) Then _DebugGUI_Write($sVarName & '[' & $i & '] is integer type') If IsObj($vVar[$i]) Then _DebugGUI_Write($sVarName & '[' & $i & '] is object type') If IsString($vVar[$i]) Then _DebugGUI_Write($sVarName & '[' & $i & '] is string type') Next Return Else If $vVar = '' Then _DebugGUI_Write('Warning: ' & $sVarName & ' is declared, but has no value', $iDebugGUI_warning) Return SetError(3, 0, 0) EndIf If IsPtr($vVar) Then _DebugGUI_Write($sVarName & ' is pointer type') If IsBinary($vVar) Then _DebugGUI_Write($sVarName & ' is binary type') If IsBool($vVar) Then _DebugGUI_Write($sVarName & ' is boolean type') If IsDllStruct($vVar) Then _DebugGUI_Write($sVarName & ' is DllStruct type') If IsFloat($vVar) Then _DebugGUI_Write($sVarName & ' is floating type') If IsHWnd($vVar) Then _DebugGUI_Write($sVarName & ' is HWnd type') If IsInt($vVar) Then _DebugGUI_Write($sVarName & ' is integer type') If IsObj($vVar) Then _DebugGUI_Write($sVarName & ' is object type') If IsString($vVar) Then _DebugGUI_Write($sVarName & ' is string type') _DebugGUI_Write('Value of ' & $sVarName & ': ' & $vVar) EndIf EndFunc ;==>_DebugGUI_QueryVar Func _DebugGUI_CopySelected() Local $iSel, $sData $iSel = _GUICtrlRichEdit_GetSel($hDebugGUI_RichEdit) If @error Then Return SetError(1, 0, 0) If $iSel[0] = $iSel[1] Then Return $sData = _GUICtrlRichEdit_GetSelText($hDebugGUI_RichEdit) If @error Then Return SetError(2, 0, 0) ClipPut($sData) Return $sData EndFunc ;==>_DebugGUI_CopySelected Func _DebugGUI_SelectAll() _GUICtrlRichEdit_SetSel($hDebugGUI_RichEdit, 0, -1) EndFunc ;==>_DebugGUI_SelectAll Func _DebugGUI_SpecialEvents() Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE _DebugGUI_Destroy() Case $GUI_EVENT_MINIMIZE WinSetState($hDebugGUI_MainWindow, '', @SW_MINIMIZE) Case $GUI_EVENT_RESTORE WinSetState($hDebugGUI_MainWindow, '', @SW_RESTORE) EndSwitch EndFunc ;==>_DebugGUI_SpecialEvents #EndRegion GUI Controls Func _DebugGUI_Write($sData, $iColor = $iDebugGUI_standard, $iBkColor = 0x000000) If Not $iDebugGUI Then Return SetError(1, 0, 0) Local $iLines = _GUICtrlRichEdit_GetSel($hDebugGUI_RichEdit) ;~ _GUICtrlRichEdit_SetCharAttributes($hDebugGUI_RichEdit, '+bo') _GUICtrlRichEdit_AppendText($hDebugGUI_RichEdit, $sData & @CRLF) _GUICtrlRichEdit_SetSel($hDebugGUI_RichEdit, $iLines[0], -1) _GUICtrlRichEdit_SetCharColor($hDebugGUI_RichEdit, $iColor) _GUICtrlRichEdit_SetCharBkColor($hDebugGUI_RichEdit, $iBkColor) _GUICtrlRichEdit_SetSel($hDebugGUI_RichEdit, -1, -1) If $iColor = $iDebugGUI_critical And $iDebugGUI_AutoShowOnCritical Then GUISetState(@SW_SHOW, $hDebugGUI_MainWindow) WinFlash($hDebugGUI_MainWindow, '', 1) EndIf EndFunc ;==>_DebugGUI_Write Func _DebugGUI_ExitFunc() If $sDebugGUI_FilePath Then _GUICtrlRichEdit_SetSel($hDebugGUI_RichEdit, 0, -1) _GUICtrlRichEdit_SetBkColor($hDebugGUI_RichEdit, 0xFFFFFF) _GUICtrlRichEdit_StreamToFile($hDebugGUI_RichEdit, $sDebugGUI_FilePath) EndIf _GUICtrlRichEdit_Destroy($hDebugGUI_RichEdit) GUIDelete($hDebugGUI_MainWindow) EndFunc ;==>_DebugGUI_ExitFunc Func _DebugGUI_Destroy() If $iDebugGUI Then _GUICtrlRichEdit_Destroy($hDebugGUI_RichEdit) GUIDelete($hDebugGUI_MainWindow) EndIf If $sDebugGUI_FilePath Then _GUICtrlRichEdit_SetSel($hDebugGUI_RichEdit, 0, -1) _GUICtrlRichEdit_SetBkColor($hDebugGUI_RichEdit, 0xFFFFFF) _GUICtrlRichEdit_StreamToFile($hDebugGUI_RichEdit, $sDebugGUI_FilePath) EndIf $iDebugGUI = False EndFunc ;==>_DebugGUI_Destroy Func _DebugGUI_GUICtrlRichEdit_StreamToFile($hWnd, $sFileSpec, $fIncludeCOM = True, $iOpts = 0, $iCodePage = 0) ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GUICtrlRichEdit_StreamToFile ; Description....: Writes contens of a control to a file ; Syntax ........: _GUICtrlRichEdit_StreamToFile($hWnd, $sFilespec[, $fIncludeCOM=True[, $iOpts=0[, $iCodePage = 0]]]) ; Parameters.....: $hWnd - Handle to the control ; $sFileSpec - file specification ; $fIncludeCOM - (Optional) ; |True (default): ; | If writing to a .rtf file, includes any COM objects (space consuming) ; | If writing to any other file, writes a text represntation of COM objects ; |False: Writes spaces instead of COM objects ; $iOpts - additional options: (Optional) (default: 0) ; |$SFF_PLAINTRTF - write only rich text keywords common to all languages ; |$SF_UNICODE - write Unicode ; $iCodePage - Generate UTF-8 and text using this code page (Optional) ; |Default: do not ; Return values..: Success - True ; Failure - False and sets @error: ; |101 - $hWnd is not a handle ; |102 - Can't create $sFilespec ; |1041 - $SFF_PLAINRTF is invalid for a text file ; |1042 - $opts: invalid option ; |1043 - $SF_UNICODE is only valid for a text file ; |700 - internal error ; Authors........: Chris Haslam (c.haslam) ; Modified ......: ; Remarks .......: If text is selected, writes only the selection, else writes all text in the control ;+ ; If the extension in $sFileSpec is .rtf, RTF is written, else text ; Related .......: _GUICtrlRichEdit_SetLimitOnText, _GUICtrlRichEdit_StreamFromVar, _GUICtrlRichEdit_StreamToFile ; Link ..........: @@MsdnLink@@ EM_STREAMIN ; Example .......: Yes ; =============================================================================================================================== If Not IsHWnd($hWnd) Then Return SetError(101, 0, False) Local $iWparam If StringRight($sFileSpec, 4) = ".rtf" Then $iWparam = _Iif($fIncludeCOM, $SF_RTF, $SF_RTFNOOBJS) Else $iWparam = _Iif($fIncludeCOM, $SF_TEXTIZED, $SF_TEXT) If BitAND($iOpts, $SFF_PLAINRTF) Then Return SetError(1041, 0, False) EndIf ; only opts are $SFF_PLAINRTF and $SF_UNICODE If BitAND($iOpts, BitNOT(BitOR($SFF_PLAINRTF, $SF_UNICODE))) Then Return SetError(1042, 0, False) If BitAND($iOpts, $SF_UNICODE) Then If Not BitAND($iWparam, $SF_TEXT) Then Return SetError(1043, 0, False) EndIf If _GUICtrlRichEdit_IsTextSelected($hWnd) Then $iWparam = BitOR($iWparam, $SFF_SELECTION) $iWparam = BitOR($iWparam, $iOpts) If $iCodePage <> 0 Then $iWparam = BitOR($iWparam, $SF_USECODEPAGE, BitShift($iCodePage, -16)) EndIf Local $tEditStream = DllStructCreate($tagEDITSTREAM) DllStructSetData($tEditStream, "pfnCallback", DllCallbackGetPtr($_GRC_StreamToFileCallback)) Local $hFile = FileOpen($sFileSpec, 2) ; overwrite If $hFile - 1 Then Return SetError(102, 0, False) DllStructSetData($tEditStream, "dwCookie", $hFile) ; -> Send handle to CallbackFunc _SendMessage($hWnd, $EM_STREAMOUT, $iWparam, DllStructGetPtr($tEditStream)) FileClose($hFile) Local $iError = DllStructGetData($tEditStream, "dwError") If $iError <> 0 Then SetError(700, $iError, False) Return True EndFunc ;==>_DebugGUI_GUICtrlRichEdit_StreamToFile example: #include <DebugGUI.au3> Global $i, $hDebugWindow, $temp, $aArray[4] = [1, DllStructCreate("int var1;ubyte var2;uint var3;char var4[128]"), 4, 'five'] Opt('GUIOnEventMode', 1) $hDebugWindow = _DebugGUI_Begin(@DesktopDir & '\example.rtf', 0x000000, False, @SW_HIDE, StringTrimRight(@ScriptName, 4), 500, 600) ;stream to file on the desktop, background is black, GUI is not set to @SW_SHOW on a critical error, GUI starts as hidden, title of window is @scriptname, size of window is 500x600 GUISetState(@SW_SHOW, $hDebugWindow) While 1 Sleep(1000) $i += 1 If $i < 5 Then _DebugGUI_Write($i & ' seconds.', $iDebugGUI_standard) If $i = 3 Then GUISetState(@SW_SHOW, $hDebugWindow) ElseIf $i >= 5 And $i < 10 Then _DebugGUI_Write($i & ' seconds.', $iDebugGUI_warning) ElseIf $i >= 10 And $i < 15 Then _DebugGUI_Write($i & ' seconds.', $iDebugGUI_error) ElseIf $i >= 15 And $i < 20 Then _DebugGUI_Write($i & ' seconds!', $iDebugGUI_critical) Else ExitLoop EndIf WEnd _DebugGUI_QueryVar($hDebugWindow, $iDebugGUI_standard) ;!! will not work because func searches for var with the value of $hDebugWindow _DebugGUI_QueryVar('$temp', $iDebugGUI_warning) _DebugGUI_QueryVar('hDebugWindow', $iDebugGUI_error) ;will work, string does not need $ at beginning _DebugGUI_QueryVar('@ScriptName', $iDebugGUI_critical) ;works with macros, but only if they begin with @ _DebugGUI_QueryVar('$aArray', $iDebugGUI_error) ;works on arrays While 1 Sleep(100) WEnd _debugGUI_Destroy()