-
Recently Browsing 0 members
No registered users viewing this page.
-
Similar Content
-
By argumentum
#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Global $edit, $GuiChild = 0 GuiExample() Func GuiExample() ; https://www.autoitscript.com/forum/topic/202986-parent-child-guis-and-input-control-fails/ Local $GuiMain = GUICreate("GuiExample w/child (parent)", 350, 300) GUISetOnEvent($GUI_EVENT_CLOSE, "GuiOnEvent_CLOSE", $GuiMain) GUISetState(@SW_SHOW, $GuiMain) $edit = GUICtrlCreateEdit("", 10, 70, 300, 200) ; It does not matter what GUI is on, GUICtrlSetData($edit, "play around with the inputs" & _ ; the parent's controls will @CRLF & "and press enter." & _ ; bleed through a $WS_CHILD gui. @CRLF & @CRLF & "It should trigger the" & _ @CRLF & " GUICtrlSetOnEvent()") GUICtrlCreateButton("reload alt.", 225, 40, 120, 25) ; run alternate versions, GUICtrlSetOnEvent(-1, "OnBttnRunAlt") ; with and without child GUI. GUICtrlSetTip(-1, "run alternate versions," & @LF & "with and without child GUI.") ;I need this child(s), but with it, it does not behave as expected. ;..for this test you can comment it out, to see that it should work. ;..but with the child, instead it executes after clicking another control. If Not StringInStr($CmdLineRaw, "/ExampleOnlyParent") Then $GuiChild = GUICreate("GuiExample w/child (child)", 320, 280, 5, 5, $WS_CHILD, $WS_TABSTOP, $GuiMain) EndIf If $GuiChild Then GUISetBkColor(0x888888, $GuiChild) ; for the dramatic effect :) If $GuiChild Then GUISwitch($GuiChild) ; ..just in case.. tho should not matter. GUICtrlCreateInput("This text 1", 5, 10, 200, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_WANTRETURN)) GUICtrlSetOnEvent(-1, "OnInputEnterKeyOne") GUICtrlCreateInput("This text 2", 5, 35, 200, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_WANTRETURN)) GUICtrlSetOnEvent(-1, "OnInputEnterKeyTwo") If $GuiChild Then GUICtrlCreateButton("flash child", 220, 8, 120, 25) GUICtrlSetOnEvent(-1, "OnFlashBttn") GUISetState(@SW_SHOW, $GuiChild) OnFlashBttn() EndIf MainLoopExample() EndFunc Func MainLoopExample() While 1 Sleep(100) WEnd EndFunc Func OnInputEnterKeyOne() GUICtrlSetData($edit, @SEC &'.' & @MSEC& ' - Func OnInputEnterKey One ()' & @CRLF) EndFunc Func OnInputEnterKeyTwo() GUICtrlSetData($edit, @SEC &'.' & @MSEC& ' - Func OnInputEnterKey Two ()' & @CRLF) EndFunc Func OnFlashBttn() WinSetTrans($GuiChild, "", 50) Sleep(300) WinSetTrans($GuiChild, "", 255) EndFunc Func OnBttnRunAlt() If StringInStr($CmdLineRaw, "/ExampleOnlyParent") Then ShellExecute(@ScriptFullPath, "") Else ShellExecute(@ScriptFullPath, "/ExampleOnlyParent") EndIf GuiOnEvent_CLOSE() EndFunc Func GuiOnEvent_CLOSE() GUIDelete() Exit EndFunc I need this child(s), but with it, it does not behave as expected.
..for this test you can comment the child GUI out, to see that it should work.
With the child, instead it executes after clicking another control.
Thanks
Edit: Modified the example for dramatic effect
Edit 2: Solved my problems at a post somewhere down this thread.
-
By Musashi
Question :
The StringStripWS function contains the statement, Flag : $STR_STRIPALL (8) = strip all spaces (over-rides all other flags)
In the German forum @Professor_Bernd wrote me, that this is an incorrect description. A test we made revealed, that it seems to be exactly the other way around. $STR_STRIPALL gets overwritten by all other flags.
Example :
#include <StringConstants.au3> Local $sOriginal = " A sentence with whitespace. " , $sOutput ConsoleWrite(" -------------------------------------------------------------------------------------" & @CRLF) ConsoleWrite("+ Original : <" & $sOriginal & ">" & @CRLF) ConsoleWrite(" -------------------------------------------------------------------------------------" & @CRLF) $sOutput = StringFormat("%-40s", StringStripWS($sOriginal, $STR_STRIPLEADING) & ">") ConsoleWrite("> >>>>>>> 1. <" & $sOutput & "==> STRIPLEADING" & @CRLF) $sOutput = StringFormat("%-40s", StringStripWS($sOriginal, $STR_STRIPTRAILING) & ">") ConsoleWrite("> >>>>>>> 2. <" & $sOutput & "==> STRIPTRAILING" & @CRLF) $sOutput = StringFormat("%-40s", StringStripWS($sOriginal, $STR_STRIPSPACES) & ">") ConsoleWrite("> >>>>>>> 3. <" & $sOutput & "==> STRIPSPACES" & @CRLF) $sOutput = StringFormat("%-40s", StringStripWS($sOriginal, $STR_STRIPLEADING + $STR_STRIPTRAILING + $STR_STRIPSPACES) & ">") ConsoleWrite("> >>>>>>> 4. <" & $sOutput & "==> STRIPLEADING + STRIPTRAILING + STRIPSPACES" & @CRLF) $sOutput = StringFormat("%-40s", StringStripWS($sOriginal, $STR_STRIPALL) & ">") ConsoleWrite("> >>>>>>> 5. <" & $sOutput & "==> STRIPALL" & @CRLF) ConsoleWrite(" -------------------------------------------------------------------------------------" & @CRLF) $sOutput = StringFormat("%-40s", StringStripWS($sOriginal, $STR_STRIPALL + $STR_STRIPLEADING) & ">") ConsoleWrite("! >>>>>>> 6. <" & $sOutput & "==> STRIPALL + STRIPLEADING" & @CRLF) $sOutput = StringFormat("%-40s", StringStripWS($sOriginal, $STR_STRIPALL + $STR_STRIPTRAILING) & ">") ConsoleWrite("! >>>>>>> 7. <" & $sOutput & "==> STRIPALL + STRIPTRAILING" & @CRLF) $sOutput = StringFormat("%-40s", StringStripWS($sOriginal, $STR_STRIPALL + $STR_STRIPSPACES) & ">") ConsoleWrite("! >>>>>>> 8. <" & $sOutput & "==> STRIPALL + $STR_STRIPSPACES" & @CRLF) $sOutput = StringFormat("%-40s", StringStripWS($sOriginal, $STR_STRIPALL + $STR_STRIPLEADING + $STR_STRIPTRAILING + $STR_STRIPSPACES) & ">") ConsoleWrite("! >>>>>>> 9. <" & $sOutput & "==> STRIPALL + STRIPLEADING + STRIPTRAILING + STRIPSPACES" & @CRLF) ConsoleWrite(" -------------------------------------------------------------------------------------" & @CRLF) Is this behavior already known, or have we possibly misunderstood something. Any clarification is welcome.
TIA @Musashi and @Professor_Bernd
-
By EmilyLove
What is Rollbar?
Rollbar provides real-time error alerting & debugging tools for developers. Learn more about it at https://rollbar.com/product/
Demo: https://rollbar.com/demo/demo/
Screenshot:
Instructions: (RollbarTest.au3)
; Include RollbarSDK #include "RollbarSDK.au3" ;Turns on ConsoleWrite debugging override. ;Global $Rollbar_Debug=False ; Initialize RollbarSDK with the project's API key. ; Parameters ....: $__Rollbar_sToken - [Required] Go to https://rollbar.com/<User>/<ProjectName>/settings/access_tokens/ for your project. Use the token for post_server_item. _Rollbar_Init("eaa8464a4082eeabd9454465b8f0c0af") ; Write code that causes an error you want to catch, then call ; _Rollbar_Send ; Parameters ....: $__Rollbar_sErrorLevel - [Required] Must be one of the following values: Debug, Info, Warning, Error, Critical. ; $__Rollbar_sMessage - [Required] The message to be sent. This should contain any useful debugging info that will help you debug. ; $__Rollbar_sMessageSummary - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend. _Rollbar_Send("Debug", "This is an debug message. If you received this, you were successful!", "Debug Message") _Rollbar_Send("Info", "This is a test message. If you received this, you were successful!", "Info Message") _Rollbar_Send("Warning", "This is an warning message. If you received this, you were successful!", "Warning Message") _Rollbar_Send("Error", "This is an error message. If you received this, you were successful!", "Error Message") _Rollbar_Send("Critical", "This is an critical message. If you received this, you were successful!", "Critical Message") _Rollbar_Send("Info", "This is a test message. If you received this, you were successful!") ;No Message ; Rollbar_Send's helper functions ; Parameters ....: $__Rollbar_sMessage - [Required] The message to be sent. This should contain any useful debugging info that will help you debug. ; $__Rollbar_sMessageSummary - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend. _Rollbar_SendDebug("This is an debug message. If you received this, you were successful!", "Debug Message") _Rollbar_SendInfo("This is a test message. If you received this, you were successful!", "Info Message") _Rollbar_SendWarning("This is an warning message. If you received this, you were successful!", "Warning Message") _Rollbar_SendError("This is an error message. If you received this, you were successful!", "Error Message") _Rollbar_SendCritical("This is an critical message. If you received this, you were successful!", "Critical Message") ; Usable Example Local $sImportantFile = "C:\NOTAREALFILE_1234554321.txt" Switch FileExists($sImportantFile) Case True MsgBox(0, "Example Script", "An important file was found. Continuing...") Case Else _Rollbar_SendCritical('An important file was missing. Halting... File: "' & $sImportantFile & '"', 'Important file "' & $sImportantFile & '" is missing.') EndSwitch Notes: Please comment your feedback, advice, & suggestions below. While this is only a proof of concept, I will expand its feature set for everyone to use.
Right now, it is fully functional but not tested in production.
Changelog:
RollbarSDK.au3
RollbarTest.au3
v0.2
v0.1.1
-
By Jeep
Hello,
I'm comming from the french site "Autoitsript.fr" with the following question or problem.
I try to use StringStripWS to clean spaces and control characters in a string. Here is my code.
#include <String.au3> #include <StringConstants.au3> #include <Array.au3> ;---- Part 1 Local $sText = @TAB & "This is a new story." & @CR & @LF & "Once upon a time ... " Local $sCheck = "" $sCheck = StringStripWS($sText, BitOR($STR_STRIPLEADING, $STR_STRIPTRAILING, $STR_STRIPSPACES)) ;$sCheck = StringStripWS($sText, $STR_STRIPLEADING + $STR_STRIPTRAILING + $STR_STRIPSPACES) ConsoleWrite($sCheck & @CRLF) For $i = 1 to stringlen($sCheck) ConsoleWrite(stringmid($sCheck,$i,1) & "-" & Asc(stringmid($sCheck,$i,1)) & @CRLF) next ; Part 2 --- Workarround submited by "jchd" on he french site Local $sText = @TAB & " This is a new story." & @CR & @LF & "Once upon a time ... " Local $sCheck = StringStripWS(StringRegExpReplace($sText, "[[:space:]]+", " "), $STR_STRIPLEADING + $STR_STRIPTRAILING + $STR_STRIPSPACES) ConsoleWrite(">" & $sCheck & "<" & @LF) _ArrayDisplay(StringToASCIIArray($sCheck))
The help file tells :
But if we check the console after program execution , the CarriageReturn (Chr(13) is still there. This is a mistake of the program, a bug or a feature of StringStripWS or a mistake in the help file.
I use AutoIt v3.3.14.5.
We have already a workaround (Part 2).
Thanks in advance for your replies.
-
By qsek
Im not sure if this is intended but normally Autoit variables are always passed as copies (except objects i think).
But below i observed an unconsistency when copying maps with nested maps inside.
Issue:
If you create a nested map1 and copy it to a new map2, changing a nested value in map2 will also change the nested value in map1
Dim $player[] Dim $sub[] $player.test1 = 1 $player.test2 = $sub $player.test2.child1 = "org" $player.test2.childext = $sub $player.test2.childext.child1 = "org2" $playerold = $player ; make a copy of the whole map ConsoleWrite("player.test2.child1 : "& $player.test2.child1 & @CRLF); original nested value in $player $playerold.test2.child1 = "changed" ; edit a nested value in $playerold ConsoleWrite("player.test2.child1 : "& $player.test2.child1 & @CRLF) ; original nested value in $player changed ConsoleWrite("---------------------" & @CRLF) ConsoleWrite("player.test2.childext.child1 : "& $player.test2.childext.child1 & @CRLF); original level2 nested value in $player $playerold.test2.childext.child1 = "changed2" ; edit a level2 nested value in $playerold ConsoleWrite("player.test2.child1 : "& $player.test2.child1 & @CRLF); original level1 nested value in $player stayed the same ConsoleWrite("player.test2.childext.child1 : "& $player.test2.childext.child1 & @CRLF); original level2 nested value in $player changed
-