Leaderboard
Popular Content
Showing content with the highest reputation on 02/11/2024 in all areas
-
DarkMode UDF for AutoIt's Win32GUIs
NoNameCode and one other reacted to argumentum for a topic
@Werty's footnote, "Some guy's script + some other guy's script = my script!". Well, that's me too I only wish I could remember where I left the car keys. Or code I wrote. Or read C and go through Notepad++, but, I'm a hobbyist scripter with some memories of Borland pascal been better than MS C++. Why am I saying this., Yes, I can not do what you just did with the UDF. Is not in me, am old and naturally disorganized. The idea is to open the different standard ( build in the AutoIt distro ) UDFs and complete them / expand them, with the new enumerators in each file destined to hold them. Add/modify the existing ones so that users can have a proper wrapper for each function call. _WinAPI_DwmSetWindowAttribute_unr() is a good example of what I did but would not be proper for release as part of the product ( I call the AutoIt3 distribution "the product" ). So is not changing your UDF but find a proper way to incorporate these new ... stuff, into the pre-existing ones and naming everything in accordance to MSDN documentation, as everything should have a reference of where the coder pull this out of. And, keep everything backward compatible ( as much as possible ) . Very important.2 points -
DarkMode UDF for AutoIt's Win32GUIs
taurus905 and one other reacted to argumentum for a topic
Since I'm working on updating the UDFs, I made a demo: that is quite ugly code wise. Hence my participation on this thread. I like your UDF and would love to see it merged to the extent that is currently functional to the standard distribution for a next release. Would you like to make the changes to make it so ? am recruiting you 🤪 ( am not affiliated with MVPs or developers but am nonetheless bringing up ideas , and try my best to have more capable product for us all ) By the way: this demo is to showcase _WinAPI_DwmSetWindowAttribute() and since it has no examples in the help file, I made two of which this is one. Also the enumeration is based in WinXP or 7. It all needs to be updated to Win 11. Having examples help the users use the function and also, out of the attention it gets, it get's debugged and expanded2 points -
DarkMode UDF for AutoIt's Win32GUIs
UEZ reacted to NoNameCode for a topic
Hello everyone, today I would like to show you how far I have come with the implementation of DarkMode for AutoIT GUIs. Source: https://github.com/ysc3839/win32-darkmode About Win32 Darkmode: Since about 2020 there is a "hidden" / "undocumented" API for Win32 DarkMode. There is also already a program that has implemented this quite well. (Notepad++) Difficulties Unfortunately, the Windows devs are either too lazy or have been stupid with the implementation. So we have to apply all kinds of fixes (as we are already used to) to get the GUIs to actually run completely. Also there are some difficulties as all existing code that could be used is written in c++. I understand that, but only rudimentarily. So if there is someone here who can / would like to help me translate / implement some existing solutions. There are for example: The 'FixDarkScrollBar()' function which I would like to implement, but where I just can't get any further. Also with ChatGPT the code is difficult to 'override' and it doesn't work at all. GPT tells me that the implementation in AutoIT is quite impossible. And the full IatHook.h (https://github.com/ysc3839/win32-darkmode/blob/master/win32-darkmode/IatHook.h) Edit: Sloved witth v0.0.3 Todos / Challenges: * Redrawing of the Menu to Black * Getting the other controls into the right Theme for DarkMode * Setting Text Theme Colder of e.g. Checkboxes, ListViewHeader or Group Text * Getting Darkmode for Date Let me know what you think and where you might have suggestions for improvement or ideas. (Especially if you can help translate c++ into autoit :3) Kind Regards NoNameCode GUIDarkMode_V0.03 - OpenNcThemeData Hook.zip Changelog V.03 * Added HookOpenNcThemeData.dll => Coded by NoNameCode in C++ if someone want the Source pls DM * Added HookOpenNcThemeData_Debug.dll => Same as HookOpenNcThemeData.dll but Creates a OpenNcThemeData.txt with the opened Classes and if the Class got Replaced by Hook * Changed Darkmode_GUISample.au3 > More Data for GUICtrlCreateList and GUICtrlCreateEdit + #include <String.au3> > Added Routine to get AutoIt Install Path by Reg; or if not by @AutoItExe for PIC (logo4.gif) or AVI (SampleAVI.avi) * Changed GUIDarkMode.au3 > Added DllOpen for HookOpenNcThemeData.dll and Added OnAutoItExitRegister for DllClose function > Changed _GUICtrlSetDarkTheme -> Cleand Up Switch by CTRL Class bec. moste of them are not needed anymore through ScrollbarFix via HookOpenNcThemeData.dll Old Stuff:1 point -
Extended Message Box - New Version: 16 Feb 24
hudsonhock reacted to Melba23 for a topic
Are you annoyed by the limitations of the standard Windows message dialog created by MsgBox? Would you like to have coloured backgrounds and text? To choose the justification and font? Do you want to be able to place the message box other than in the centre of the screen? Centred on your GUI, for example, or at a particular location on screen? What about having user-defined text on as many buttons as you need? And user-defined icons? Or a visible countdown of the timeout? Finally, would you like to choose whether the message box has a button on your already too-crowded taskbar? If the answer to any of these questions is "YES" then the ExtMsgBox UDF is for you! [NEW VERSION] 16 Feb 24 Changed: Some additional functionality added to the "TimeOut" parameter of _ExtMsgBox: - A positive integer sets the EMB timeout as before. - A negative integer will double the size of the countdown timer if it is used. - A colon-delimited string (eg: "10:5") will set the normal EMB timeout (first integer) and will also initially disable the EMB buttons for the required period (second integer). New UDF and examples in the zip. Older version changes: ChangeLog.txt As always, I realise nearly all of the DLL calls in these UDFs could be made by using commands in other UDFs like WinAPI.au3 - but as with all my UDFs (which you can find in my sig below) I am trying to prevent the need for any other include files. The UDF and examples (plus StringSize) in zip format: ExtMsgBox.zip Courteous comments and constructive criticisms welcome - guess which I prefer! M231 point -
Hi folks, I'm having problems with a screenshot capture script. Let me explain. Everyday I (and my colleagues at work) need to take some screenshots from a web-page. These screenshots are used to compile a report. Normally, I (and others) used to log in into the website and took screenshots of desired graphics and tables. This is tediuos and time consuming. To easy this task I made a script using autoit that basically logs into the website (user and password) and using some clicks, stroke send, coordinates, it is able to generate the graphics and save them to some folders into our network (this script saves arouund 50 pics. It works like a sharm. In order to make things easier, I tried to schedule this script (compiled to a Screnpics.exe file) using task scheduler from windows. We already use this (task scheduler) to run some vbs scripts, some vba excel scripts and so on. The computer used for this tasks is a windows 7 desktop computer. Due to security policies, the computer locks after some time. All this tasks run in the locked computer. My script screenpics.exe runs also from this locked computer. When the computer is unlocked, it does everything as expected. But, when it is locked, all the "pics" are BLACK. As I understand, it runs ok, but, as the "windows" are innactive, it prints what it "sees": a black rectangular. Some details: The web-page with hold the information I need, it only works in Firefox and, because of this it couldn`t be managed by vba or some "getobject" like commands. In fact, it has some flash things that make it impossible to control programatically. So my script is based on mouse move to coordinates, mouse click, screen capture and so one. So, I read many posts trying to figure out a way to overcome this, but... nothing came to mind. My first idea was try to unlock windows. Theses lead me to some posts with no solution. This is worse because I'm not a computer admin, so procedures that need to replace/change the register are not an option. If someone has any idea, I'll be gratefull.1 point
-
Not sure if it is possible. PrintWindow requires to accept the message WM_PRINT. Pretty confident that Desktop will not respond to it. So at the end of the day, you need to ask yourself what you really need to know. And choose how you can securely get this information without a human looking at it.... Another option (beside locking the PC) is to lock total input (keyboard and mouse : look at my signature for it). Then you can do pretty much all you want ! ps. there is ways to shutdown the screen but PrintWindow will still work if the PC is not locked (it will not work will all monitors since some always research if there is a possible input from HDMI, VGA, etc). But with a black screen without any possible input, it is quite secure...On the other hand you will need to kill the process to gain access to your PC again.1 point
-
DarkMode UDF for AutoIt's Win32GUIs
argumentum reacted to SmOke_N for a topic
This is absolutely not tested (not even once), but if I were to code it, I'd probably approach it this way. Func _WinAPI_SetWindowThemeEx($hWnd, $vName = "Explorer", $vList = Null) Local $tSubAppName = (IsDllStruct($vName) ? $vName : Null) Local $pSubAppName = (IsPtr($vName) ? $vName : Null) Local $tSubIdList = (IsDllStruct($vList) ? $vList : Null) Local $pSubIdList = (IsPtr($vList) ? $vList : Null) ; create struct if it doesn't exist If $tSubAppName = Null Then $tSubAppName = DllStructCreate("wchar[" & BinaryLen($vName) + 1 & "]") DllStructSetData($tSubAppName, 1, $vName) EndIf ; create struct if it doesn't exist If $tSubIdList = Null Then $tSubIdList = DllStructCreate("wchar[" & BinaryLen($vList) + 1 & "]") DllStructSetData($tSubIdList, 1, $vList) EndIf ; set pointer if not passed in params If Not IsPtr($pSubAppName) Then $pSubAppName = DllStructGetPtr($tSubAppName, 1) If Not IsPtr($pSubIdList) Then $pSubIdList = DllStructGetPtr($tSubIdList, 1) Local $aRet = DllCall("uxtheme.dll", "long", "SetWindowTheme", _ "hwnd", $hWnd, _ "ptr", $pSubAppName, _ "ptr", $pSubIdList) If @error Then Return SetError(@error, @extended, 0) ; no idea why we're setting an error of 10 to a success but meh ; it should return zero on success and a positive number with $aRet[0]/hResult as the error IMO If $aRet[0] Then Return SetError(10, $aRet[0], 0) Return 1 EndFunc This is the first func I've written in AutoIt in quite some time, so please forgive if it's confusing lol...1 point -
AutoIT Editor Dark Theme
ioa747 reacted to argumentum for a topic
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # START: DO NOT CHANGE ANYTHING AFTER THIS LINE #-#-#-#-# # Buuf SciTE4AutoIt3 Color scheme #------------------------------------------------------------ # Not very fancy of me to just copy'n'paste "SciTEUser.properties" colors here but, if it works =) font.base=font:Verdana,size:10,$(font.override) font.monospace=font:Courier New,size:10 style.*.32=$(font.base),back:#CCC4BD style.au3.32=$(font.base),back:#CCC4BD caret.line.back=#CCC4BD caret.line.back.alpha=256 caret.fore=#000000 selection.fore=#006000 selection.alpha=50 selection.back=#F0A0A8 style.error.0=fore:#FF0000,back:#F0F0F0 style.error.1=fore:#FF0000,back:#FFFF00 style.error.2=fore:#FFFFFF,back:#FF0000 highlight.current.word.colour=#00D040 highlight.current.word.by.style=0 highlight.current.word.minlength=2 style.au3.38=fore:#050505,back:#E2D7D0 calltips.color.highlight=#FF0000 style.*.33=fore:#000000,back:#CCC4BD,$(font.base) fold.margin.colour=#CCC4BD fold.margin.highlight.colour=#F7F7F7 fold.back=#FFFFFF style.au3.37=fore:#C0C0C0 style.au3.34=fore:#0000FF,back:#CCC4BD style.au3.35=fore:#007700,italics,back:#CCC4BD style.au3.0=fore:#000000,bold,back:#CCC4BD style.au3.1=fore:#007700,italics,bold,back:#CCC4BD style.au3.2=fore:#006F00,italics,bold,back:#CCC4BD style.au3.3=fore:#0000BF,bold,back:#CCC4BD style.au3.4=fore:#000090,bold,back:#CCC4BD style.au3.5=fore:#0000FF,bold,back:#CCC4BD style.au3.6=fore:#646400,bold,back:#CCC4BD style.au3.7=fore:#A40000,bold,back:#CCC4BD style.au3.8=fore:#8C4600,bold,back:#CCC4BD style.au3.9=fore:#5A5A5A,bold,back:#CCC4BD style.au3.10=fore:#626262,bold,back:#CCC4BD style.au3.11=fore:#808000,bold,back:#CCC4BD style.au3.12=fore:#B11030,bold,back:#CCC4BD style.au3.13=fore:#AE0000,bold,back:#CCC4BD style.au3.14=fore:#993399,bold,back:#CCC4BD style.au3.15=fore:#005CB9,bold,back:#CCC4BD style.au3.16=fore:#0057AE,back:#CCC4BD style.errorlist.32=$(font.base),back:#CCC4BD style.errorlist.0=fore:#000000 style.errorlist.3=fore:#808000 style.errorlist.4=fore:#0000AA style.errorlist.10=fore:#AA0000,bold style.errorlist.11=fore:#008000,bold style.errorlist.12=fore:#AA8800,bold style.errorlist.13=fore:#804000 style.au3.17=fore:#000000,back:#CCC4BD # END => DO NOT CHANGE ANYTHING BEFORE THIS LINE #-#-#-#-#-# #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# I've been meaning to share this "__SciTE4AutoIt3_Buuf.SciTEConfig" for some time now. The windows theme is in github. This is the SciTEConfig theme to match the windows theme. Edit: to complete the view, the default.css for the help file: /* JPM: modified to use inheritage widely * em sizing to better zooming * coloring similar to MSDN Web * * mod. by argumentum */ html { font-family:'Segoe UI','Lucida Grande',Verdana,Arial,Helvetica,sans-serif; font-size:.8125em /* 13px; */ } body { background-color:#CCC4BD; /* #fff; */ color:#000; font-weight:400; max-width: 1080px; margin: 10px; scrollbar-base-color: #CCC4BD; scrollbar-face-color: #E1DDD0; scrollbar-3dlight-color: #CCC4BD; scrollbar-highlight-color: #0xCCC4BD; scrollbar-track-color: #CCC4BD; scrollbar-arrow-color: #E1DDD0; scrollbar-shadow-color: #CCC4BD; scrollbar-dark-shadow-color: #202020; } table { border-collapse:collapse; border-color:silver; border-style:solid; border-width:1px; margin-top:5px; width:100% } table.noborder { border-width:0 } th { /* font-size:.875em; /* 14px; DOCTYPE without .dld */ background-color:#ededed; border-color:silver; border-style:solid; border-width:1px; color:#707070; padding:4px; text-align:left } th.new { width:224px } th.old { width:226px } th.width25 { width:25% } th.width75 { width:75% } tr { padding:4px } tr.yellow,tr.yellowbold { background-color:#F0F0F0 /* #ffff9C */ } tr.Moccasin{ background-color:#FFE4B5 } tr.yellowbold { font-weight:700 } table td { /* font-size:.875em; /* 14px; DOCTYPE without .dld */ border-color:silver; border-style:solid; border-width:1px; padding:4px } table.noborder td { border-width:0 } td.center { text-align:center } td.right { text-align:right } td.sep { border-color:#CCC4BD silver /* #fff silver */ } b { font-weight:700 } u { text-decoration:underline /* for HTML5 compatibility if needed */ } p { margin:0; padding-bottom:5px; padding-top:5px } p.center { text-align:center } span.underline { text-decoration:underline } .funcdesc { font-size:1.25em /* 20px; */ } ul.cell { margin:0 0 0 25px } div.indent { margin-left:32px } a,a:link { color:#00709f } a:visited { color:#03697a } a:active { color:#2a2a2a } a:hover { color:#3390b1 } a,a:link,a:visited,a:active { text-decoration:none } a:hover { text-decoration:underline } a.ext:link,a.ext:visited,a.ext:active { text-decoration:underline } a.codeSnippetLink:hover { text-decoration:underline } h1 { color:#707070; font-size:2.75em; /* 36-44px; */ font-weight:400; margin:0; padding-bottom:15px; padding-top:15px } .small { font-size:.875em; /* 12-14px; */ margin:-12px 0 -4px; padding-bottom:0; padding-top:9px } h2 { color:#621c82; /* #db7100; */ font-size:1.5em; /* 24px; */ font-weight:400; line-height:normal; margin:0; padding-bottom:5px; padding-top:25px } h3 { color:navy; font-size:1.0625em; /* 17px; */ font-weight:700; line-height:normal; margin-bottom:0; margin-left:5px } pre,.code,.codeheader,.codebox { font-family:"Courier New",Courier,monospace } .code { white-space:nowrap } .codeheader { font-weight:600; background-color:#d5cec8;/* #ffa; */ border-bottom:1px solid #aaa; border-left:1px solid #aaa; border-right:1px solid #aaa; border-top:1px solid #aaa; padding:16px; white-space:normal } .codebox { border-bottom:1px solid #aaa; border-left:1px solid #aaa; border-right:1px solid #aaa; border-top:1px solid #aaa; color:#465584; overflow-x:auto; padding:8px 8px 16px; margin-top:5px; white-space:nowrap; width:99% } .S0 { color:#2a2a2a } .S1 { color:green; font-style:italic } .S2 { color:green; font-style:italic } .S3 { color:blue } .S4 { font-weight:700; color:#000090 } .S5 { font-weight:700; color:blue } .S6 { font-weight:700; color:#7f4615 /* olive */ } .S7 { color:#CC0000 } .S8 { font-weight:700; color:#b85c00 /* #FF8000 */ } .S9 { color:#2a2a2a } .S10 { color:gray } .S11 { font-weight:700; color:#7f4615 /* olive */ } .S12 { color:#dc143c } .S13 { background-color:#DDE8F0; color:red } .S14 { color:#939 } .S15 { font-weight:700; color:#00478f } .c1 { background-color:#CCC4BD; } .c2 { background-color:#CCC4BD; } .c3 { background-color:#CCC4BD; } .c4 { background-color:#CCC4BD; } .bottom { padding-bottom:0; margin-bottom:0 } .experimental { background-color:#ffffe0; border:solid; border-color:red; font-size:1.5em; /* 24px; */ font-weight:700; margin:12px; padding:4px } .specialnote { background-color:#fffffa; border:solid; border-color:blue; font-size:1.5em; /* 24px; */ font-weight:500; padding:4px } img.logo_v3 { /* box-shadow:5px 5px 20px #aaa */ } .noPageBreak { page-break-inside:avoid } /* adapted from MSDN Web for example code open/copy actions */ .codeSnippetContainer { background-color:#CCC4BD; min-width:260px; margin:0; padding:0 } .codeSnippetContainerTabs { font-size:.8333em; /* 13.33px 10pt!important; */ height:20px; /* 22px; */ position:relative; vertical-align:middle; z-index:1 } .codeSnippetContainerTab { background-color:#CCC4BD; /* background:none repeat scroll 0 0 #eff5ff; */ border-bottom:2px solid #d0d2d2; border-top:1px solid #bbb; border-left:1px solid #929292; float:left; height:20px; /* 19px; */ padding:0 4px; /* 0 8px; */ width:auto; overflow:hidden; position:relative; font-weight:400 } /* MSDN not used * .codeSnippetContainerTabActive * { * height:21px; * background:none repeat scroll 0 0 #fff; * border-left:1px solid #bbb; * border-bottom:none; * } * * .codeSnippetContainerTabFirst * { * border-radius:4px 0 0 0; * padding:0 8px 0 6px; * } * * .codeSnippetContainerTabLast * { * border-right:1px solid #bbb; * border-radius:0 4px 0 0; * padding:0 6px 0 8px; * } */ .codeSnippetContainerTabSingle { background-color:#CCC4BD; border:none; color:#00709f; /* #e66a38; */ vertical-align:baseline; top:10px; /* 8px; */ left:12px; /* 7px; */ position:relative; background-color:#CCC4BD /* #fff */ } .codeSnippetContainerTabSingle a { background-color:#CCC4BD; color:#e66a38 /* !important; */ } .codeSnippetContainerTab a,.codeSnippetContainerTab a:link,.codeSnippetContainerTab a:visited,.codeSnippetContainerTab a:active { background-color:#CCC4BD; color:#1364c4; text-decoration:none } /* MSDN not used * .codeSnippetContainerTabActive a,.codeSnippetContainerTabActive a:link,.codeSnippetContainerTabActive a:visited,.codeSnippetContainerTabActive a:active * { * color:#e66a38; * text-decoration:none; * position:relative; * } * * .codeSnippetContainerTabPhantom a,.codeSnippetContainerTabPhantom a:link,.codeSnippetContainerTabPhantom a:visited,.codeSnippetContainerTabPhantom a:active * { * color:#c2c2c2; * text-decoration:none; * position:relative; * } * * .codeSnippetContainerTabPhantom a:link,.codeSnippetContainerTabPhantom a:visited,.codeSnippetContainerTabPhantom a:active * { * color:#707070; * text-decoration:none; * position:relative; * } */ .codeSnippetContainerTab a:hover { color:#e66a38; position:relative } /* MSDN not used * .codeSnippetContainerTabPhantom a:hover * { * color:#c2c2c2; * position:relative; * } */ .codeSnippetContainerCodeContainer { border-bottom:3px solid #e5e5e5; border-left:3px solid #e5e5e5; /* 1px */ border-right:3px solid #e5e5e5; /* 1px */ clear:both; margin-bottom:0; /* 12px; */ position:relative; top:-3px } .codeSnippetToolBar { border-left:0 solid #e5e5e5; /* 1px */ border-right:0 solid #e5e5e5; /* 3px */ border-top:3px solid #e5e5e5; height:auto; width:auto } div.codeSnippetToolBarText { float:right; top:-12px; /* -8px; */ position:relative; background-color:#CCC4BD; /* #fff; */ width:auto; padding-left:4px; padding-right:4px; height:0; vertical-align:top } div.codeSnippetToolBarText>a:link,div.codeSnippetToolBarText>a:visited,div.codeSnippetToolBarText>a:active { /* display:none; */ margin-left:5px; margin-right:5px; /* font-size:100%; /* 83.33%; /* 10pt */ /* font-style:400!important; */ /* color:#1364c4; */ text-decoration:none; background-color:#CCC4BD; /* #fff; */ padding-left:4px; padding-right:4px } div.codeSnippetToolBarText>a:hover { text-decoration:underline } .codeSnippetContainerCode { margin-top:14px; /* 0; */ padding:5px 10px; /* 9px 21px; */ width:auto } .codeSnippetContainerCode div { padding:0; margin:0 } .codeSnippetContainerCode pre { padding-left:5px; /* 5px; */ margin:0; /*word-break:break-all;*/ font-style:normal; font-weight:400; overflow:auto; word-wrap:normal } #hhctrl { vertical-align:middle } #hhctrl-bottom { vertical-align:bottom } .codeSnippetContainerTab object { cursor:pointer; text-decoration:underline } .valign-top { vertical-align:text-top } The CSS injector code is this one: and you would rename the help file by adding an O ( for original ) to the original, and name this as the original. It'd be simpler to just edit the SciTE configuration file but this way it can be used by other editors too.1 point -
DarkMode UDF for AutoIt's Win32GUIs
argumentum reacted to NoNameCode for a topic
@argumentum Looks promising, ill look at it tomorow. I have to get some Sleep x) See u soon1 point -
DarkMode UDF for AutoIt's Win32GUIs
NoNameCode reacted to argumentum for a topic
v02, cool. https://www.autoitscript.com/forum/topic/191035-combobox-set-dropdownlist-colorssize-udf/ https://www.autoitscript.com/forum/topic/191058-datetime-pick-coloring/ maybe this can help ?1 point -
DarkMode UDF for AutoIt's Win32GUIs
argumentum reacted to NoNameCode for a topic
@argumentum No thats not what i mean with the ScrollbarFix. Let me expand for a moment: This FixScrollBar() does the following: It sets its own function before each call of "OpenNcThemeData" within "comctl32.dll". With OpenNcThemeData each control queries its theme data. Why? Because every control asks for the class "ScrollBar" and not for "Explorer::ScrollBar". The problem is that switching on DarkMode for "ScrollBar" has no effect. To set this custom callback function, the "DelayLoadThunk" adress must be found in "comctl32.dll". However, this turns out to be extremely complex. In theory, we simply edit the ClassList that is called by OpenNcThemeData with our own function and pass the edited version to OpenNcThemeData, which then returns the result. To the GUI Scrollbars: They are "Fixed" no worries. I call GUICtrlSetDarkThem for $hGUI in GUISetDarkTheme again.1 point -
DarkMode UDF for AutoIt's Win32GUIs
argumentum reacted to NoNameCode for a topic
Hi argumentum, thank allot for your input If you set costum Colors here then it looks alredy pretty cool 😎 About your code: a) I also think that removing the theme from the checkboxes is an interesting approach. b) I looked at your demo and tested it with List(Box) and TreeView. However, I think that this does not yet work comprehensively for all GUI Ctrls that we can create in this way. c) I'll add your "Ugly" :') method to the "UDF" if that's okay with you? Furthermore: I will have a look at the source code of Notepadd++ and see how they did it and if we can adopt it. Maybe I'll also open another thread to see if we can translate the "FindDelayLoadThunkInModule" from IatHook.h, needed in "FixDarkScrollBar()". To your request: Sure, I would be happy if something of mine is included in the Autoit standard distribution. However, I would like to know which part of the code you mean and which changes you would like me to make.1 point -
Something like this? #include <Excel.au3> Test() Func Test() Local $oExcel = _Excel_Open(False) Local $oBook = _Excel_BookOpen($oExcel, @ScriptDir & '\Test.xlsx', True, False) Local $aData = _Excel_RangeRead($oBook, Default, 'A1:B164', 1, True) _Excel_Close($oExcel) Local $aSplit For $Index = 0 To UBound($aData) - 1 If Not $aData[$Index][0] Then ContinueLoop ; Focus here your desired window Send('{ENTER}' & $aData[$Index][0] & $aData[$Index][1] & '{ENTER}') ; As an alternative you migth want to use ControlSend() Next EndFunc1 point
-
AutoIT Editor Dark Theme
argumentum reacted to ioa747 for a topic
Seeing all of this I would like to suggest https://github.com/microsoft/cascadia-code new monospaced font that includes programming ligatures and is designed to enhance the modern look Hope to be relevant to the topic1 point -
Capturing screenshots while computer is locked
IgImAx reacted to Moonscarlet for a topic
Hey, Try this function (not mine, found it sometime ago and changed a bit of it), it should take a screenshot of any window even when the computer is locked: #include <GDIPlus.au3> #include <WinAPISysWin.au3> Capture_Window("test window",@DesktopDir&"\Test.png") Func Capture_Window($Title, $SaveImagePath) WinSetState($Title, "", @SW_MAXIMIZE) Local $hWnd = WinGetHandle($Title) Local $w = _WinAPI_GetWindowWidth($hWnd) Local $h = _WinAPI_GetWindowHeight($hWnd) _GDIPlus_Startup() If Not IsHWnd($hWnd) Then Return SetError(1, 0, 0) If Int($w) < 1 Then Return SetError(2, 0, 0) If Int($h) < 1 Then Return SetError(3, 0, 0) Local Const $hDC_Capture = _WinAPI_GetDC(HWnd($hWnd)) Local Const $hMemDC = _WinAPI_CreateCompatibleDC($hDC_Capture) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC_Capture, $w, $h) Local Const $hObjectOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) DllCall("gdi32.dll", "int", "SetStretchBltMode", "hwnd", $hDC_Capture, "uint", 4) DllCall("user32.dll", "int", "PrintWindow", "hwnd", $hWnd, "handle", $hMemDC, "int", 0) _WinAPI_DeleteDC($hMemDC) _WinAPI_SelectObject($hMemDC, $hObjectOld) _WinAPI_ReleaseDC($hWnd, $hDC_Capture) Local Const $hFullScreen = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]") Local Const $aFullScreen = WinGetPos($hFullScreen) Local Const $c1 = $aFullScreen[2] - @DesktopWidth, $c2 = $aFullScreen[3] - @DesktopHeight Local Const $wc1 = $w - $c1, $hc2 = $h - $c2 If (($wc1 > 1 And $wc1 < $w) Or ($w - @DesktopWidth > 1) Or ($hc2 > 7 And $hc2 < $h) Or ($h - @DesktopHeight > 1)) And (BitAND(WinGetState(HWnd($hWnd)), 32) = 32) Then Local $hBmp_t = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap) $hBmp = _GDIPlus_BitmapCloneArea($hBmp_t, 8, 8, $w - 16, $h - 16) _GDIPlus_BitmapDispose($hBmp_t) Else $hBmp = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap) EndIf _WinAPI_DeleteObject($hHBitmap) $hBmp = _GDIPlus_BitmapCloneArea($hBmp, 0, 0, $w - 16, $h - 16) _GDIPlus_ImageSaveToFile($hBmp, $SaveImagePath) _GDIPlus_Shutdown() Return $hBmp EndFunc ;==>Capture_Window1 point -
copy the following script (3 functions) and paste it to the bottom of your already working script (ensure that #include <ScreenCapture.au3> is present at the top of your script) to capture the screenshot of the FireFox window replace the line in your script where you call _ScreenCapture_Capture ( $networkSharePath & "\peo_craq_rpbc_top10_alarmop.png", 282, 175, 1062, 640) with the following line instead: _CaptureFireFox_Screen($sFilename) wher $sFilename contains the path and filename of the picture you wish to save. This should save a picture of the FireFox window on the path and with the name specified in the $sFilename parameter even if the screen is locked (it works on my system). ; #include <ScreenCapture.au3> Func _CaptureFireFox_Screen($sFilename) $hFFox = HWnd(_Firefox_Get_Handle()) If @error Then Return SetError(1, 0, False) ; save the screenshot of the FireFox window to $sFilename ; even while the screen is locked _ScreenCapture_CaptureWnd_mod($sFilename, $hFFox) EndFunc ;==>_CaptureFireFox_Screen ; retrieve the handle of FireFox (and maximize it) Func _Firefox_Get_Handle() ; MozillaWindowClass Local $aList = WinList("[CLASS:MozillaWindowClass]"), $hHandle ; get FirFox handle For $i = 1 To $aList[0][0] If $aList[$i][0] <> "" And BitAND(WinGetState($aList[$i][1]), 2) Then $hHandle = $aList[$i][1] ExitLoop EndIf Next If Not $hHandle Then ; MsgBox(0, "Debug", "Problem on getting FireFox handle") Return SetError(1, 0, False) EndIf ; Activate the firefox window and maximize it WinActivate($hHandle) WinSetState($hHandle, '', @SW_MAXIMIZE) Return $hHandle EndFunc ;==>_Firefox_Get_Handle ; #FUNCTION# ==================================================================================================================== ; Author ........: Paul Campbell (PaulIA) ; Modified.......: chimp ; ; modified version of the _ScreenCapture_CaptureWnd() function ; It uses the _WinAPI_PrintWindow() to capture the window ; it should work also with screen locked ; ------------- ; =============================================================================================================================== Func _ScreenCapture_CaptureWnd_mod($sFilename, $hWin, $bCursor = True) Local $bRet = False Local $iSize = WinGetPos($hWin) Local $iW = $iSize[2] Local $iH = $iSize[3] Local $hWnd = _WinAPI_GetDesktopWindow() Local $hDDC = _WinAPI_GetDC($hWnd) Local $hCDC = _WinAPI_CreateCompatibleDC($hDDC) Local $hBMP = _WinAPI_CreateCompatibleBitmap($hDDC, $iW, $iH) ; $hCDC Identifies the device context ; $hBMP Identifies the object to be selected _WinAPI_SelectObject($hCDC, $hBMP) _WinAPI_PrintWindow($hWin, $hCDC) If $bCursor Then Local $aCursor = _WinAPI_GetCursorInfo() If Not @error And $aCursor[1] Then $bCursor = True ; Cursor info was found. Local $hIcon = _WinAPI_CopyIcon($aCursor[2]) Local $aIcon = _WinAPI_GetIconInfo($hIcon) If Not @error Then _WinAPI_DeleteObject($aIcon[4]) ; delete bitmap mask return by _WinAPI_GetIconInfo() If $aIcon[5] <> 0 Then _WinAPI_DeleteObject($aIcon[5]) ; delete bitmap hbmColor return by _WinAPI_GetIconInfo() _WinAPI_DrawIcon($hCDC, $aCursor[3] - $aIcon[2] - $iSize[0], $aCursor[4] - $aIcon[3] - $iSize[1], $hIcon) EndIf _WinAPI_DestroyIcon($hIcon) EndIf EndIf _WinAPI_ReleaseDC($hWnd, $hDDC) _WinAPI_DeleteDC($hCDC) If $sFilename = "" Then Return $hBMP $bRet = _ScreenCapture_SaveImage($sFilename, $hBMP, True) Return SetError(@error, @extended, $bRet) EndFunc ;==>_ScreenCapture_CaptureWnd_mod1 point
-
... to grab data from web tables there are more appropriate ways than capturing screens, but that's another story. however, keeping the topic on the capture of the FireFox screenshots, you could try the following way: #include <ScreenCapture.au3> #include <WinAPISys.au3> ; used only for _WinAPI_LockWorkStation() _Example() Func _Example() ; MozillaWindowClass Local $aList = WinList("[CLASS:MozillaWindowClass]"), $hHandle ; get FirFox handle For $i = 1 To $aList[0][0] If $aList[$i][0] <> "" And BitAND(WinGetState($aList[$i][1]), 2) Then $hHandle = $aList[$i][1] ExitLoop EndIf Next If Not $hHandle Then MsgBox(0, "Not handle", "Problem with mozilla") Exit EndIf ; Activate the firefox window and maximize it WinActivate($hHandle) WinSetState($hHandle, '', @SW_MAXIMIZE) ; Lock screen (just to test) _WinAPI_LockWorkStation() Sleep(3000) ; wait a bit ; save the cscreenshot to file Moz.jpg ; even while the screen is locked _ScreenCapture_CaptureWnd_mod(".\Moz.jpg", $hHandle) ; view the sceenshot ShellExecute(".\Moz.jpg") EndFunc ;==>_Example ; #FUNCTION# ==================================================================================================================== ; Author ........: Paul Campbell (PaulIA) ; Modified.......: chimp ; ; modified version of the _ScreenCapture_CaptureWnd() function ; It uses the _WinAPI_PrintWindow() to capture the window ; =============================================================================================================================== Func _ScreenCapture_CaptureWnd_mod($sFileName, $hWin, $bCursor = True) Local $bRet = False Local $iSize = WinGetPos($hWin) Local $iW = $iSize[2] Local $iH = $iSize[3] Local $hWnd = _WinAPI_GetDesktopWindow() Local $hDDC = _WinAPI_GetDC($hWnd) Local $hCDC = _WinAPI_CreateCompatibleDC($hDDC) Local $hBMP = _WinAPI_CreateCompatibleBitmap($hDDC, $iW, $iH) ; $hCDC Identifies the device context ; $hBMP Identifies the object to be selected _WinAPI_SelectObject($hCDC, $hBMP) _WinAPI_PrintWindow($hWin, $hCDC) If $bCursor Then Local $aCursor = _WinAPI_GetCursorInfo() If Not @error And $aCursor[1] Then $bCursor = True ; Cursor info was found. Local $hIcon = _WinAPI_CopyIcon($aCursor[2]) Local $aIcon = _WinAPI_GetIconInfo($hIcon) If Not @error Then _WinAPI_DeleteObject($aIcon[4]) ; delete bitmap mask return by _WinAPI_GetIconInfo() If $aIcon[5] <> 0 Then _WinAPI_DeleteObject($aIcon[5]); delete bitmap hbmColor return by _WinAPI_GetIconInfo() _WinAPI_DrawIcon($hCDC, $aCursor[3] - $aIcon[2] - $iSize[0], $aCursor[4] - $aIcon[3] - $iSize[1], $hIcon) EndIf _WinAPI_DestroyIcon($hIcon) EndIf EndIf _WinAPI_ReleaseDC($hWnd, $hDDC) _WinAPI_DeleteDC($hCDC) If $sFileName = "" Then Return $hBMP $bRet = _ScreenCapture_SaveImage($sFileName, $hBMP, True) Return SetError(@error, @extended, $bRet) EndFunc ;==>_ScreenCapture_CaptureWnd_mod1 point
-
... or you can try with this modified version of the _ScreenCapture_CaptureWnd() function ... #include <ScreenCapture.au3> #include <WinAPISys.au3> ; used only for _WinAPI_LockWorkStation() _Example() Func _Example() ; run Calc Local $hPid = Run(@SystemDir & '\calc.exe') ; get calc's handle Local $hWnd = WinWaitActive("[CLASS:CalcFrame]", '', 3) If Not $hWnd Then MsgBox(0, "Not handle", "Problem with calc.exe") Exit EndIf ; Lock screen _WinAPI_LockWorkStation() Sleep(3000) ; wait a bit ; save the calc.exe screenshot to file calc.jpg ; even while the screen is locked _ScreenCapture_CaptureWnd_mod(".\Calc.jpg", $hWnd) ; close calc.exe ProcessClose($hPid) ; view the sceenshot ShellExecute(".\Calc.jpg") EndFunc ;==>_Example ; #FUNCTION# ==================================================================================================================== ; Author ........: Paul Campbell (PaulIA) ; Modified.......: chimp ; ; modified version of the _ScreenCapture_CaptureWnd() function ; It uses the _WinAPI_PrintWindow() to capture the window ; =============================================================================================================================== Func _ScreenCapture_CaptureWnd_mod($sFileName, $hWin, $bCursor = True) Local $bRet = False Local $iSize = WinGetPos($hWin) Local $iW = $iSize[2] Local $iH = $iSize[3] Local $hWnd = _WinAPI_GetDesktopWindow() Local $hDDC = _WinAPI_GetDC($hWnd) Local $hCDC = _WinAPI_CreateCompatibleDC($hDDC) Local $hBMP = _WinAPI_CreateCompatibleBitmap($hDDC, $iW, $iH) ; $hCDC Identifies the device context ; $hBMP Identifies the object to be selected _WinAPI_SelectObject($hCDC, $hBMP) _WinAPI_PrintWindow($hWin, $hCDC) If $bCursor Then Local $aCursor = _WinAPI_GetCursorInfo() If Not @error And $aCursor[1] Then $bCursor = True ; Cursor info was found. Local $hIcon = _WinAPI_CopyIcon($aCursor[2]) Local $aIcon = _WinAPI_GetIconInfo($hIcon) If Not @error Then _WinAPI_DeleteObject($aIcon[4]) ; delete bitmap mask return by _WinAPI_GetIconInfo() If $aIcon[5] <> 0 Then _WinAPI_DeleteObject($aIcon[5]); delete bitmap hbmColor return by _WinAPI_GetIconInfo() _WinAPI_DrawIcon($hCDC, $aCursor[3] - $aIcon[2] - $iSize[0], $aCursor[4] - $aIcon[3] - $iSize[1], $hIcon) EndIf _WinAPI_DestroyIcon($hIcon) EndIf EndIf _WinAPI_ReleaseDC($hWnd, $hDDC) _WinAPI_DeleteDC($hCDC) If $sFileName = "" Then Return $hBMP $bRet = _ScreenCapture_SaveImage($sFileName, $hBMP, True) Return SetError(@error, @extended, $bRet) EndFunc ;==>_ScreenCapture_CaptureWnd_mod1 point