Leaderboard
Popular Content
Showing content with the highest reputation on 05/10/2018 in all areas
-
Need help separating duplicate values
mikell and one other reacted to Earthshine for a topic
see? I told you they would be here.2 points -
Need help separating duplicate values
Earthshine and one other reacted to Malkey for a topic
Here are some regular expression methods for manipulating strings. #include <Array.au3> Local $Check = 'Check.txt' ; Post#1 of https://www.autoitscript.com/forum/topic/193926-need-help-separating-duplicate-values/ $aG1 = _ArrayReadFoundLine($Check, "\bName\d") ; Find a line with "Name" between word boundary, "\b",and a digit, "\d". _ArrayDisplay($aG1, "$aG1") ;Or $aG2 = _ArrayReadFoundLine($Check, "\|\w{1,4}\d") ; Find a line with 1 to 4 word characters, "\w", between a literal, (an escaped) "|" character, and a digit,"\d". _ArrayDisplay($aG2, "$aG2") $aG3 = _ArrayReadFoundLine($Check, "\bFirstName\d") ; Find a line with "FirstName" between word boundary, "\b", and a digit, "\d". _ArrayDisplay($aG3, "$aG3") ; Or $aG4 = _ArrayReadFoundLine($Check, "\|\w{5,}\d") ; Find a line with 5 or more word characters, "\w", between a literal, (an escaped) "|" character, and a digit,"\d". _ArrayDisplay($aG4, "$aG4") ; This part is added only for interest. ConsoleWrite(_ArrayToString($aG4, @CRLF) & @CRLF) $aG4_2D = _StringTo2DArray(_ArrayToString($aG4, @CRLF), "|") _ArrayDisplay($aG4_2D, "$aG4_2D") ; Note: for info on "\w", "{x,y}", "\d", "\b", or "(?i)", see StringRegExp() function in AutoIt help. Func _ArrayReadFoundLine($sFlleName, $sREPattern) Return StringRegExp(FileRead($sFlleName), "(?i).*" & $sREPattern & ".*", 3) ; ".*" - Capture all characters (if any exist) before and after any captured character with $sREPattern on the same line. EndFunc ;==>_ArrayReadFoundLine ; Or, see _FileReadToArray() function in AutoIt help. Func _StringTo2DArray($sString, $sDelim_Columns = ",", $sDelim_Row = @CRLF) ; ---- Find number of columns ($iCols) to correctly dimension array ---- Local $iCols = 0, $sRE = "([^" & StringRegExpReplace($sDelim_Columns & $sDelim_Row, "([\[\]\-\^\\])", "\\$1") & "]+)" Local $lineArr = StringSplit(StringRegExpReplace($sString, $sRE, ""), $sDelim_Row, 1) ; 1 = entire delimiter string is needed to mark the split. ;_ArrayDisplay($lineArr) For $i = 1 To $lineArr[0] If (StringLen($lineArr[$i]) + 1) > $iCols Then $iCols = StringLen($lineArr[$i]) + 1 Next ; ---- End of Find number of columns ---- Local $aArray[0][$iCols] _ArrayAdd($aArray, $sString, 0, $sDelim_Columns, $sDelim_Row) Return $aArray EndFunc ;==>_StringTo2DArray2 points -
Version 1.6.3.0
17,293 downloads
Extensive library to control and manipulate Microsoft Active Directory. Threads: Development - General Help & Support - Example Scripts - Wiki Previous downloads: 30467 Known Bugs: (last changed: 2020-10-05) None Things to come: (last changed: 2020-07-21) None BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort1 point -
Need help separating duplicate values
Earthshine reacted to mikell for a topic
@jchd JC, please forgive me. My AutoIt install is probably corrupted because your code returns this for me : Row|Col 0 [0]|Size:1|Name1 Size:2|Name2 Size:4|Name3 [1]|Size:1 [2]|Size:1|FirstName1 Size:2|FirstName2 Size:3|FirstName3 so, to avoid this parasitic $aGrouped[1] I used a SRER , the only way (IM.extremely.HO) to not get this group ([^|]+) as a result1 point -
And will stay as long as somebody close them. As your openning AU3 snippet, is only watching if IE is already closed. https://www.autoitscript.com/autoit3/docs/functions/ProcessWaitClose.htm1 point
-
Mbee, You still have an idle loop even in OnEvent mode - or else the script would just end! ; OnEvent idle loop While True Sleep(10) WEnd So you need to make sure that you return to this loop - i.e. terminate a function before you recall the same function. And I still fail to see why you need to send any Windows messages - AutoIt is quite happy dealing with the standard Windows message stream and will happily queue events for you, as the example script I posted above shows. I get the impression that you are serious overthinking this problem when a perfectly simple solution is out there waiting for you to stumble over it. Logically I see it as something like this: Global _ImageToShowNext variable Global _ImageShowingNow variable Advance button fires _Advance function Previous button fires _Previous function Start of idle loop keeping script alive Sleep(10) Look to see if _ImageToShowNext is different to _ImageShowingNow If it is - show the required picture via the _ShowImage function Match the 2 variables End of idle loop _Advance function Increase the _ImageToShowNext variable - what else do you need to do? _Previous function Decrease the _ImageToShowNext variable - what else do you need to do? _ShowImage function Show whatever image has been passed as a parameter That would seem to do the trick. Multiple rapid presses of the buttons should be queued and then processed in turn as the previous _ShowImage function ends. M231 point
-
Need help separating duplicate values
Earthshine reacted to jchd for a topic
@mikell, omg, using two calls again ... and $aGroup1 has a parasitic trailing @CRLF1 point -
Mbee, That code is severely recursive - you are calling functions from within themselves - and I would hazard a guess that is where you are "losing" events as AutoIt really does queue them for you. Try recasting the code so that you return to your idle loop before calling any function - and certainly the same one. This simple example allows to see that AutoIt does indeed queue button events - it counts up and down quite nicely for me: #include <GUIConstantsEx.au3> Opt( "GUIOnEventMode", 1 ) Global $iClickCounter = 1 $G_GuiHandle = GUICreate( "ClickTestGUI", 120, 100 ) GUISetOnEvent( $GUI_EVENT_CLOSE, "_GUIWinClose", $G_GuiHandle ) $G_NextBtnID = GUICtrlCreateButton( "Next", 10, 50 ) GUICtrlSetOnEvent(-1,"_NextClick") $G_PreviousBtnID = GUICtrlCreateButton( "Previous", 50, 50 ) GUICtrlSetOnEvent(-1,"_PreviousClick") GUISetState( @SW_SHOW ) While True Sleep(10) WEnd Func _NextClick() $iClickCounter += 1 If $iClickCounter > 10 Then $iClickCounter = 10 ConsoleWrite("Counter: " & $iClickCounter & @CRLF) Sleep(2000) ; Simulate the delay while the new picture is displayed EndFunc Func _PreviousClick() $iClickCounter -= 1 If $iClickCounter < 1 Then $iClickCounter = 1 ConsoleWrite("Counter: " & $iClickCounter & @CRLF) Sleep(2000) ; Simulate the delay while the new picture is displayed EndFunc Func _GUIWinClose() Exit EndFunc M231 point
-
Can you post real data examples? For example is it Size1|Duhovni and Size1|David or Size1|FirstDuhovni1 point
-
Need help separating duplicate values
Earthshine reacted to mikell for a topic
Local $sText = _ "Size:1|Name1" & @CRLF & _ "Size:2|Name2" & @CRLF & _ "Size:4|Name3" & @CRLF & _ "Size:1|FirstName1" & @CRLF & _ "Size:2|FirstName2" & @CRLF & _ "Size:3|FirstName3" Local $aGroup1 = StringRegExpReplace($sText, "(?s)([^|]+).*?\K\R\1.*", "") Msgbox(0,"", $aGroup1) Local $aGroup2 = StringReplace($sText, $aGroup1 & @crlf , "") Msgbox(0,"", $aGroup2)1 point -
1 point
-
Need help separating duplicate values
Earthshine reacted to JonnyQuy for a topic
very very very very thank you Malkey handsome1 point -
1 point
-
[SOLVED] WinMenuSelectItem method cannot find in C#
IgImAx reacted to Fernando_Marinho for a topic
Hi IgImAx, You need : add AutoItX.Dotnet in Manage NuGet Packages ; add to your code : using AutoItX3Lib; set instance, like : AutoItX3 au3 = new AutoItX3(); than, call the method: au3.WinMenuSelectItem("", ...) Works for me !1 point -
New MVPs
FrancescoDiMuro reacted to Melba23 for a topic
Hi, Some good news today: Danp2, RTFC and junkew have accepted the invitation to become MVPs. I am sure you will all join me in congratulating them on their new status. M231 point -
Mbee, I could not have put it better myself! How about you writing some basic GUI code (without any of the frills or any working functions) or draw a picture to show what you want your user to see. If you provide one with all sections retracted and another with all sections extended, that will allow me to see just what we need to do. Then we can get the various sections working as you wish before you head off onto the complex bits. As to your questions on the UDF: $bComplex is explained in this post from the previous thread - unless you use UpDowns you need not concern yourself with it. _GUIExtender_Section_Activate makes a section actionable - either by creating a button within the UDF or allowing the user to use one of their own. If you do not use the function, the section is static an cannot be actioned. As to creating the GUI, you create the whole GUI in one initial block of code, with all of the controls in a section being created between the relevant starting and ending _GUIExtender_Section_Create calls. Deye has already explained _GUIExtender_Section_BaseCoord - basically it allows you to create controls easily with a section without knowing exactly where that section is situated within the overall GUI. The third of those points makes me a little concerned as you speak of having buttons to increase decrease the number of controls. The UDF requires you to create all the controls initially so that it knows where they are situated within the overall GUI. You cannot adjust the size of the actionable sections dynamically. If you want to do this, one way would be to have to have child GUIs in those sections and have scrollable areas within them to access all of these "slots" of which you speak (my Scrollbars UDF should be able to cope with this). Another would be to have entirely separate child windows which you can resize at will and simply display attached to your base GUI. You need to be aware of these limitations before we get too deep into the code. Anyway, let me see what you want the user to see and I am sure we can come up with something suitable. M231 point
-
Mbee, Here is some basic example on how the _GUIExtender_Section_BaseCoord function can be used, .. compare it with the original GUIExtender_Example_3_Handle_Loop.au3 Regardless to the UDF, a $YCoord var (as in this example) is Setting\Getting the top coordinates while progressing through a gui creation You get to change or use the Top value without needing to fully specify it with each and every creation of a control or a group of them one example could be wanting to move a group of controls all at once while keeping their relative spacing in check, you change their above $YCoord var value instance by an Increase or decrease and they remain subject to it (moved all at once ..) in this example using the UDF, I combined setting a new Top value with each _Section() creation function call look through the example to see if you get idea .. Deye #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIComboBox.au3> #include "GUIExtender.au3" Global $hGUI = GUICreate("Test", 300, 390) Global $aSections[6] = [0, 60, 60, 60, 110, ""] ;Array to set section split sizes from $hGUI hight Global $YCoord = 0 _GUIExtender_Init($hGUI) _Section(1) GUICtrlCreateGroup(" 1 - Static ", 10, ($YCoord + 10), 280, 50) ; $aSections[0] = 0 + 10 = 10 _GUIExtender_Section_Activate($hGUI, 2, "", "", 270, ($YCoord + 40), 15, 15, 0, 1) ; Normal button _Section(2) ; Auto resets $YCoord = $aSections[1] = 60 GUICtrlCreateGroup(" 2 - Extendable ", 10, ($YCoord + 10), 280, 50) ; ($YCoord + 10), top = 70 _Section(3) ; Auto resets $YCoord = $aSections[1]+[2] = 120 GUICtrlCreateGroup(" 3 - Static", 10, ($YCoord + 10), 280, 50) ; top = 130 _GUIExtender_Section_Activate($hGUI, 4, "Close 4", "Open 4", 225, ($YCoord + 25), 60, 20, 1, 1) ; Push button _Section(4) ; Auto resets $YCoord = 180 GUICtrlCreateGroup(" 4 - Extendable ", 10, ($YCoord + 10), 280, 100) ;top = 190 $YCoord -= 20 ; $YCoord override = 160 GUICtrlCreateGroup(" 4 - Extendable ", 10, $YCoord, 280, 100) ; top = 160 _Section(5) ; Auto resets $YCoord $YCoord += 10 ; $YCoord override to 350 GUICtrlCreateGroup(" 5 - Static", 10, $YCoord , 280, 80) _GUIExtender_Section_Activate($hGUI, 0, "Close All", "Open All", 20, ($YCoord + 60), 60, 20, 1, 1) ; Normal button _GUIExtender_Section_Create($hGUI, -99) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_HIDE, $hGUI) ; Create non-native controls and child GUIs AFTER main GUI ; Create a UDF combo $hCombo = _GUICtrlComboBox_Create($hGUI, "", 120, 90, 60, 20, $CBS_DROPDOWN) ; BitOR($CBS_DROPDOWN, $WS_VSCROLL, $WS_TABSTOP, $CBS_UPPERCASE)) _GUICtrlComboBox_BeginUpdate($hCombo) _GUICtrlComboBox_AddString($hCombo, "ONE") _GUICtrlComboBox_AddString($hCombo, "TWO") _GUICtrlComboBox_AddString($hCombo, "THREE") _GUICtrlComboBox_EndUpdate($hCombo) ; Store handle data in UDF _GUIExtender_Handle_Data($hGUI, $hCombo, 2, 120, 90) ; Note coords are relative to main GUI ; Create child GUI $hGUI_Child = GUICreate("", 270, 80, 15, 205, $WS_POPUP) GUISetBkColor(0xCCFFCC, $hGUI_Child) GUISetState(@SW_SHOWNOACTIVATE, $hGUI_Child) _WinAPI_SetParent($hGUI_Child, $hGUI) _GUIExtender_Handle_Data($hGUI, $hGUI_Child, 4, 15, 205) ; Retract section with combo _GUIExtender_Section_Action($hGUI, 4, False) GUISetState(@SW_SHOW, $hGUI) While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[0] Case $GUI_EVENT_CLOSE Exit EndSwitch _GUIExtender_EventMonitor($aMsg[1], $aMsg[0]) WEnd Func _Section($iSection_Coord = 0, $iSection_Size = Default) _GUIExtender_Section_Create($hGUI, $iSection_Size, $aSections[$iSection_Coord]) $YCoord = _GUIExtender_Section_BaseCoord($hGUI, $iSection_Coord) EndFunc ;==>_Section1 point
-
Disabling mouse, using scroll lock
PINTO1927 reacted to somdcomputerguy for a topic
This works for me, it will probably prove to be useful as well.. (I have a laptop w/ a trackpad also) #Include <Misc.au3> Local $MouseTrapped HotKeySet("{SCROLLLOCK}", "TogMouse") HotKeySet("!{ESC}", "Quit") While 1 Sleep(10) WEnd Func TogMouse() $MouseTrapped = Not $MouseTrapped While $MouseTrapped ToolTip('MouseTrapped', 1, 1) _MouseTrap(0, 0, 0, 0) Sleep(10) WEnd ToolTip('') _MouseTrap() EndFunc Func Quit() ToolTip('') _MouseTrap() Exit EndFunc I know that _MouseTrap allows clicks thru, but the mouse position is locked at 0,0 so it doesn't really matter, to me anyway..1 point -
Active windows?
DynamicRookie reacted to Powerz for a topic
WOOPS, i posted this in the AutoIt v2 section, i use v3 so wrong section:$1 point