Leaderboard
Popular Content
Showing content with the highest reputation on 03/16/2023 in all areas
-
To be honest the 2 lines of code you gave us does not convince me that you are doing the right thing or that you have an issue. Personally, I am using very often PixelGetColor on both Win7 and Win10 without any problem. So my guess is that you are not using correctly. Unless, you can provide a runable example that is not working we will suppose that the problem is on your side.2 points
-
GUI FontIcon
argumentum reacted to Skysnake for a topic
; #include <FontConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Local $hGUI = GUICreate("Example", 200, 200) ; 2023.03.12 FontIcon! Local $sFont, $s ; define reusable vars $sFont = "Segoe UI Symbol" ; <-- a default Windows font GUISetFont(24, $FW_NORMAL, $GUI_FONTNORMAL, $sFont) ; <-- set font, Font Size does not affect Menus $s = ChrW(0xE160) ; hand $idFilemenu = GUICtrlCreateMenu($s & " &File Index ") $sFont = "Segoe UI Symbol" ; <-- a default Windows font GUISetFont(24, $FW_NORMAL, $GUI_FONTNORMAL, $sFont) ; <-- set font, Font Size does not affect Menus $s = ChrW(0xE203) ; OK Local $idFileItem = GUICtrlCreateMenuItem($s & " File Option", $idFilemenu) GUICtrlCreateMenuItem("", $idFilemenu) ; create a separator line $sFont = "Segoe UI Symbol" ; <-- a default Windows font GUISetFont(24, $FW_NORMAL, $GUI_FONTNORMAL, $sFont) ; <-- set font, Font Size does not affect Menus $s = ChrW(0x26DD) ; box with cross Local $idExit = GUICtrlCreateMenuItem($s & " Exit ", $idFilemenu) $sFont = "Segoe MDL2 Assets" ; <-- a default Windows font GUISetFont(24, $FW_NORMAL, $GUI_FONTNORMAL, $sFont) ; <-- make font size half of button dimensions $s = ChrW(0xE2F6) Local $iconPrint = GUICtrlCreateButton($s, 8, 28, 48, 48) ; <-- button containing fonticon $sFont = "Segoe UI Emoji" ; <-- a default Windows font GUISetFont(24, $FW_NORMAL, $GUI_FONTNORMAL, $sFont) ; <-- make font size half of button dimensions $s = ChrW(0x2668) Local $iconMedal = GUICtrlCreateButton($s, 60, 28, 48, 48) ; <-- button containing fonticon $sFont = "Segoe UI Symbol" ; <-- a default Windows font GUISetFont(24, $FW_NORMAL, $GUI_FONTNORMAL, $sFont) ; <-- make font size half of button dimensions $s = ChrW(0xE129) Local $iconPennon = GUICtrlCreateButton($s, 112, 28, 48, 48) ; <-- button containing fonticon ; take care to reset to an easy read font $sFont = "Segoe" GUISetFont(12, 400, 0, $sFont) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idExit ExitLoop Case $iconPrint MsgBox(0, "FontIcon", "You have clicked a FontIcon!") Case $iconMedal MsgBox(0, "FontIcon Emoji", "Hotstuff!") Case $iconPennon MsgBox(0, "FontIcon Symbol", "Keep the Flag flying") Case $idFileItem MsgBox(0, "Menu Item!", "Do Something!") EndSwitch WEnd GUIDelete($hGUI) A picture paints a thousand words, and having access to icons often contributes to the aesthetics of a GUI. It's not always easy or convenient to make icon files, or compile these into a DLL for later use. Fortunately the onboard Windows Segoe font family provides access to a whole set of font icons. A font icon is a font character that does not paint a letter, but a picture, like an emoji. Using a FontIcon also allows placing images directly into menu items, which would otherwise require a lot of work1 point -
Custom ClassnameNN
argumentum reacted to PapaOz for a topic
Thanks for the replies. I was hoping to make the button names the same in both environments but I guess it's to much of a hassle, if even possible. I'll use the accepted soution. Thanks again.1 point -
Function to Read through and Delete Lines in an Output File
SOLVE-SMART reacted to pixelsearch for a topic
If I'm not mistaken, it is enough... for the subject you provided in the 1st place in this post 7:32:13 7.36 0 0.011% 162.7 7:32:13 7.36 d 0 0.011% 0 0 7.36 d 0 0.011% 0 0 7.36 d 0 0.011% 55 0 51:0 7.36 d 0 0.011% 55 0 7:30:20 0 7.36 d 0 0.011% 55 0 14 0's are now correctly retrieved when using the positive lookahead / positive lookbehind pattern : (?m)^0\t|(?<=\t)0(?=\t)|\t0$ Now, to solve OP's issue certainly requires other patterns (e.g empty lines, multiple followed Tabs for example) and you provided the solution, bravo I'm very happy you started this conversation because it allowed us to discover the power of positive lookahead / positive lookbehind. Please just let me add a few notes from the author, which are interesting too : 18. Testing The Same Part of a String for More Than One Requirement Lookaround, which I [Jan Goyvaerts, the author] introduced in detail in the previous topic, is a very powerful concept. Unfortunately, it is often underused by people new to regular expressions, because lookaround is a bit confusing. The confusing part is that the lookaround is zero-width. So if you have a regex in which a lookahead is followed by another piece of regex, or a lookbehind is preceded by another piece of regex, then the regex will traverse part of the string twice. If I'm not mistaken, it's exactly what we did, "traversing part of the string twice." For example, with the line that we worked on, which ends with these 4 characters Tab 0 Tab 0 * The lookaround part checks for Tab 0 Tab, without consuming (eating) any Tab, and grabs the penultimate 0 * Then the \t0$ checks again the last Tab ("traversing part of the string twice") and grabs the last 0 preceded by a Tab . So the last Tab has been checked twice, consumed only once, and now we know why To our expert gurus: please be kind enough to correct anything wrong or badly expressed in our last RegEx posts Thanks !1 point -
aArray headers Always transferred to existing Excel spreadsheet.
Danp2 reacted to JohnnyTries for a topic
You're 100% right. The $aArray wasn't being destroyed between runs. Not sure how I didn't see it in the spreadsheet before, but every subsequent run was adding 'duplicates' of the header row as well as the previous runs PLUS the new (current) run. Don't I feel dumb. 🥴 Thank you! I've read through forums so many times that my brain turned to mush, but you've explained it in extremely relatable terms. Wow... Yeah, now it's making total sense and I'm catching on. Correct. Something I read on another thread had me thinking the $aArray needed to be declared at the beginning of the script, at or before the GUI loaded--So that's where I put it, plus Nothing was emptying the array so it kept growing with each run. Oof. The fix: Move the declaration of the $aArray down to the function for recording the inputboxes to the $aArray, and set it as Global. Change $aArray dimensions to [0] [9] with no headers because that's unnecessary with an existing sheet. Once $aArray is passed to the function for writing the $aArray to the spreadsheet, I then simply make the $aArray variable = 0, thus destroying 'old' data. Section of corrected code: Func RecordNotesToArray() Global $aArray[0][9] ;= [["TestID","DateTimeStamp","Tamb_C","BGTemp_C", "GasType", "TrueFlow_slm", "Lens-BGDist_in", "Lens-LeakDist_In", "AddNotes"]] _ArrayAdd($aArray, GUICtrlRead($TestIDInput) & "|" & $timestamp & "|" & GUICtrlRead($Tamb_CInput) & "|" & GUICtrlRead($BGTemp_CInput) & "|" & GUICtrlRead($GasTypeInput) & "|" & GUICtrlRead($TrueFlow_slmInput) & "|" & GUICtrlRead($Dist_BG_inInput) & "|" & GUICtrlRead($Dist_Leak_inInput) & "|" & GUICtrlRead($AddNotesInput)) EndFunc ;==>RecordNotesToArray() Func RecordArraytoExcel() Local $oExcel = _Excel_Open() Local $oWorkBook If Not FileExists($sDataFilePath) Then $oWorkBook = _Excel_BookNew($oExcel) Else $oWorkBook = _Excel_BookOpen($oExcel, $sDataFilePath) EndIf $oWorkBook.Worksheets("DataTable").Columns("A:I").AutoFit $LastRow = $oWorkbook.ActiveSheet.Range("A1").SpecialCells($xlCellTypeLastCell).Row $Rowrange = "A"&$LastRow+1 Consolewrite($Rowrange & @crlf) _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $aArray, $Rowrange) If FileExists($sDataFilePath) Then _Excel_BookSave($oWorkBook) Else _Excel_BookSaveAs($oWorkBook, $sDataFilePath) EndIf _Excel_BookClose($oWorkBook) _Excel_Close($oExcel) $aArray = 0 EndFunc ;==>RecordArrayToExcel() Everything works like a champ! I appreciate your time, help, and patience with me, @Danp2! Now I'm going back to digging through the forum again. I'm going to go add some more functionality: Add an option to auto-increment the "Test ID" input box after recording. Have the form save the text from all input boxes so when you close and reopen the app, it will be pre-filled with the info from the previous data collection. Thanks again and see you around!1 point -
Function to Read through and Delete Lines in an Output File
pixelsearch reacted to SOLVE-SMART for a topic
Thank you very much @pixelsearch for your engagement 🤝 . Unfortunately I believe, it's still not enough. But this depends absolutly on the requirements of @SoftWearInGinEar. Please see the following test data and their matches of your RegEx patterns and one adjusted RegEx pattern by me. 💡 Please notice, I had to replace (?m) with (?:) in VSCode to get the RegEx pattern work. But in the AutoIt code it doesn't matter => both variants lead to the same result. I marked the missing cases by red rectangles. But this is only relevant when this assumption is true: when a line contains a zero as column value, then match and delete this line when not all column values of a line containing values (empty), then match and delete this too I guess this is only just for fun, because we try to do it in a robust way with several combinations and so one. Out of the specific file from the OP, the pattern (\t\t|\t$) is simply enough 😂 . Best regards Sven test-data.csv1 point -
Function to Read through and Delete Lines in an Output File
SOLVE-SMART reacted to pixelsearch for a topic
This should do it : (?m)^0\t|(?<=\t)0(?=\t)|\t0$ I tried it first without the positive lookahead / positive lookbehind, with this pattern : (?m)^0\t|\t0\t|\t0$ But it failed on last line, where 2 0's are separated by a Tab character, as found in the the last line (and its 2 last columns) of the subject I indicated in my preceding post. With this "wrong" pattern \t0\t it seems difficult to grab the last 0 (though it's preceded by a Tab) because the preceding grabbed 0 "ate" the Tab following him, so the offset is placed now just before the last 0 and not before the last Tab, that's why the last 0 isn't grabbed. The advantage of positive lookahead / positive lookbehind is this : "They do not consume characters in the string, but only assert whether a match is possible or not." Jan Goyvaerts (Regular-Expressions) Edit: @SOLVE-SMART did it solve your example too ? Fingers crossed1 point -
Function to Read through and Delete Lines in an Output File
SOLVE-SMART reacted to pixelsearch for a topic
You're welcome @SOLVE-SMART imho checking for 0 in any column seems a bit radical to eliminate a row, but sure OP knows better than us For example, If you look at column 4, its values start from 25 to 20.78 in the last row, a slow decreasing process that could reach 0 in a few hours. If we look at column 1 (which seems to indicate time) it increases from 7:14:34 to 9:59:21 in the last row . If this is a continuous process running 24 hours, then Column 4 could indicate a value of 0 in a few hours ... and the concerned line will be deleted, when it shouldn't. End of "script" For the record, this post was just for fun, as I got no idea of the meaning of any column or the time spent before the output is reset etc... today I'm in a funny mood, for a change !1 point -
Application Is blocked
MichaelCrawley reacted to argumentum for a topic
for what I read there, signing your executable could be used to make a filter to let it run. Maybe. If it's a solution, is within reach. Ask your admins.1 point -
Function to Read through and Delete Lines in an Output File
pixelsearch reacted to SOLVE-SMART for a topic
Good catch @pixelsearch, thanks, I missed this. I saw the second line which seems to be the CSV header and I thought directly what about the first one 😅 . My understanding is/was: when a line contains a zero as column value, then delete this line when not all column values of a line containing values, delete this too Anyway, you're absolutly right about your last question 👍 . Best regards Sven1 point -
Function to Read through and Delete Lines in an Output File
SOLVE-SMART reacted to pixelsearch for a topic
Why is that ? If not mistaken, there are 5 Tabs per line in any lines of OP's output, no matter the 1st line got only its 1st column filled. The problem would be if some lines had not 5 Tabs in them, but I didn't find any. I don't see any blank line in OP's output (e.g totally empty) but maybe there could be (?) The question is : what should be done with the 2nd line below ? Will you delete it because the last column is empty ? I guess you will because you don't want any column to be empty (or 0) but it's always good to have OP's confirmation Edit: and we should ask too, will you delete it if the value in last column was... 0, as in this altered line ?1 point -
PixelGetColor question
SOLVE-SMART reacted to Nine for a topic
It is a SysListView, so many ListView functions should work. (see ControlListView and GuiListView UDF)1 point -
Application Is blocked
MichaelCrawley reacted to rsn for a topic
If your organization is using Palo Alto Networks Anti Malware stuff, you (or whoever manages it) will likely have to open a support ticket to get an exception put in place for the false positive. See here.1 point -
In my environment, I had to talk to the Sec team to get my apps excluded from the AV product scans. Also, I've found that compiling as x64 with no UPX throws the least amount of false positives from them and VirusTotal.1 point
-
aArray headers Always transferred to existing Excel spreadsheet.
JohnnyTries reacted to Danp2 for a topic
That's true. However, your declaration as shown wasn't within a function. Therefore, these variables are treated as if they were declared as Global. No, you could just declare an empty array like this -- Local $aArray[0][9] From the help file -- So the above creates an empty, two dimensional array where the first dimension is 0 and the second dimension is 9. If you think of it like a spreadsheet, you start with zero rows and nine columns. After the _ArrayAdd, the row count would go up by 1. There something off between the code you posted and the behavior you described. Hopefully this information will assist you in diagnosing the situation. P.S. WDE! 😉1 point -
PixelGetColor question
Musashi reacted to SOLVE-SMART for a topic
If you're not fine with my answers, fine, but please do more research on your own. I was trying to help you and give you possible necessary hints and links, but my patience is at an end. Bye 😒 . Best regards Sven1 point