Leaderboard
Popular Content
Showing content with the highest reputation on 10/14/2017 in all areas
-
Using C# and VB Code in AutoIt through .NET Framework
Earthshine and one other reacted to LarsJ for a topic
A few updates to the examples in post 2 "2) Real C# and VB examples\1) Index based sorting\Includes\Sort2DArrayOpt.au3" System.Collections.dll is not needed in DotNet_LoadVBcode(). "2) Real C# and VB examples\2) Convert array\Includes\Conv2DArrayOpt.vb" CType( aObjects(j,i), String ) replaced with CStr( aObjects(j,i) ). "2) Real C# and VB examples\3) Save array\Includes\Save1DArrayOpt.au3" System.IO.dll and System.Text.Encoding.dll are not needed in DotNet_LoadVBcode(). "2) Real C# and VB examples\3) Save array\Examples\ExampleOpt.au3" In the previous version (ExampleOpt-a.au3), I had forgotten to initialize the VB code with Save1DArrayOptInit() in top of the script. This meant that the initialization instead was performed at the top of Save1DArrayOpt() function, and that the runtime for the initialization (about 100 milliseconds) was included in the runtime for Save1DArrayOpt(). That made the total runtime for Save1DArrayOpt() about 100 milliseconds too high. I've updated ExampleOpt.au3 and included Save1DArrayOptInit() in top of the script. This makes Save1DArrayOpt() about 100 milliseconds faster. And now, the optimized AutoIt/VB code is a bit faster than the pure AutoIt code. In the old version, the pure AutoIt code was fastest. I've updated the conclusion about the runtimes in "Save array" section in bottom of post 2. Post 3 UDF version of examples in post 2 Post 4 Threading2 points -
Scrollbars Made Easy - New version 27 Jan 22
pixelsearch reacted to Melba23 for a topic
[New Version] - 27 Jan 22 New: The GUIScrollbar_Ex UDF now recognises Win-D and taskbar desktop clearance commands and runs the correct minimize/restore code automatically. The previous UDF _Minimize and _Restore commands have been superceded by a single _EventMonitor function which runs in the script idle loop. This is a script-breaking change, but I hope that the additional functionality is worth the small effort it will take to alter your scripts. New UDFs, examples in zip file below. Previous changes: Changelog.txt Are you bemused by scrollbars? > Do you find them too difficult to use? > Then you need the GUIScrollbars_Ex UDF! Just download the zip at the end of the post and run this short script with the UDF in the same folder. No tricky calculations, no complicated functions to master - just easy to use, accurate scrollbars with one command! [size=5]#include <guiconstantsex.au3> #include "GUIScrollbars_Ex.au3" ; Create GUI with red background $hGUI = GUICreate("Test", 500, 500) GUISetBkColor(0xFF0000, $hGUI) ; Create a 1000x1000 green label GUICtrlCreateLabel("", 0, 0, 1000, 1000) GUICtrlSetBkColor(-1, 0x00FF00) GUISetState() ; Generate scrollbars - Yes, this is all you need to do!!!!!!!!!!!!!!!!!!!! _GUIScrollbars_Generate($hGUI, 1000, 1000) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd[/size] Try it today and see how easy it is! I have been trying for some time to understand how scrollbars work and how to get them closely to match the area I want to display. After much research and headscratching I have come up with 2 UDFs which I hope will be of use to others. Apologies for the length of this post, but scrollbars are complex beasts and as I did this mainly for the less experienced user I want to make sure that they understand what is going on. The 2 UDFs are: GUIScrollbars_Ex.au3 - This gives you scrollbars sized to your GUI in one simple command - with no other includes or commands needed. The UDF is designed for those who would not normally use scrollbars because the whole process looks too complicated. It also includes a command to enable you to scroll page by page, thus making it easy to scroll to anywhere on the GUI with only simple calulations based on the values you used to create the GUIs. [New] Ability to have recalculated scrollbars on resizeable GUIs. GUIScrollbars_Size.au3 - This calculates the Page and Max numbers for the user to feed into the _GUIScrollbar_SetScrollInfoPage/Max commands. The UDF is aimed at the more experienced user and is particularly useful when you have a GUI with a dynamic scroll size (i.e. adding or subtracting controls to the scrollable area as the script runs). First, a short tutorial for those who are interested in how the scrollbars affect your GUI and what it is that the UDFs calculate: All the files mentioned here are in a downloadable zip file at the end of the post. GUIScrollbars_Size.au3 As mentioned previously, the GUIScrollbars_Size.au3 UDF is aimed at the more experienced user who wants to use the full range of _GUIScrollbar comands, but would like a quick way of getting the required Page and Max values. It uses no other include files so you will need to include GUIScrollbars.au3 yourself, as well as the necessary GUIRegisterMsg and procedures for WM_VSCROLL and WM_HSCROLL. The syntax is simple - the size of the scrollable GUI and either the handle of the GUI you have created to hold the scrollbars or the size of the one you are going to create. It returns a 6-element array including the Page and Max values for the scrollbars and factors to compensate for the "shrinkage" of the GUI if you had already drawn some controls and wished to add others. Of interest, the returned Max value is biased not to clip the edges of the GUI - reducing it by 1 makes a tighter fit but can lead to some clipping. (If that does not make sense, please see the tutorial above for more details) The Size_Example_1 script to show the UDF in action - the "Pass Size" button shows the effect of creating the scrollbars BEFORE the controls, the "Pass Handle" button shows what happens if the scrollbars are created AFTER the controls. If you do not understand why there is a difference - go and read the tutorial above ! You will need to have the GUIScrollbar_Size.au3 UDF in the same folder. Where this UDF really helps is if you have a scrollable GUI of variable size - if the number of controls varies with user selections for example. All you need to do is to rerun the UDF with the new size of the scrollable GUI and it produces a new Max value for you to use. The Size_Example_2 script shows how the function enables you to dynamically size your scrollbars depending on the number of controls required. As before it requires the GUIScrollbar_Size.au3 UDF in the same folder. -------- Now the "simple" GUIScrollbars_Ex.au3 (which is actually the more complex internally as you would expect). This UDF is intended to be the single point of call for creating scrollbars on a GUI - it will automatically add the GUIScrollbars UDF and the WM_VSCROLL and WM_HSCROLL GUIRegisterMsg commands and procedures to your script - so you need no commands other than those within the UDF itself. These commands are _GUIScrollbars_Generate and _GUIScrollbars_Scroll_Page. As you might expect, _GUIScrollbars_Generate generates scrollbars for your GUI. It is usually called AFTER you have added all the controls and all you need to use it is the GUI handle and the size of the underlying GUI you want to scroll. If you so wish, you can also decide to generate the scrollbars BEFORE the controls on the scrollable GUI, and you can choose if you want to risk not quite reaching the edge of the GUI when the scrollbars are at the maximum position. So a basic call could be as simple as: _GUIScrollbars_Generate ($hGUI, 1000, 1000) which would put scrollbars on the $hGUI window allowing a 1000x1000 underlying GUI to be displayed. _GUIScrollbars_Scroll_Page lets you scroll a page at a time. If your GUI was 200 pixels wide, you would have 1000/200 = 5 pages to scroll before reaching the edge - no need to know what the actual Page and Max values are, just use this simple division based on the number you use to draw the GUIs. So: _GUIScrollbars_Scroll_Page ($hGUI, 3) would scroll to the third page - it would display the area between 400 and 600 pixels of the full 1000 pixel width. If you ask for a page over the maximum available, you just scroll to the maximum position - asking for page 1 resets you to the origin. Ex_Example_1 shows the UDF working. You can decide whether to have both or just one scrollbar, whether to create the scrollbars before or after the controls, and whether you want the maximum scroll to be tight to the edge or leave a border. Just select the options you want - the script selects a random width and height for both the scrollbar GUI and the underlying GUI - and press the "Scroll" button to show a single page scroll down and/or right followed by a scroll to the bottom right corner of the GUI. There are labels to let you see the size of the GUI and the accuracy of the page scrolls (please read the tutorial above to understand why these are almost certainly inaccurate). The script requires the GUIScrollbars_Ex.au3 UDF in the same folder. Ex_Example_2 is a really simple example to show how easy generating scrollbars can now become! As you can see - no other includes, no GUIRegisterMsg commands, no WM_H/VSCROLL procedure functions. Just accurate scrolling and proportional thumb sizes. Ex_Example_3 shows the automatic calculation of control positions. Ex_Example_4 shows how to initiate the cursor keys to scroll the GUI as well. [New] Ex_Example_5 shows how to use the new _GUIScrollbarsEx_Resizer function. I hope these 2 UDFs are useful to AutoIt users - I certainly find them so. Here is a zip file with the UDFs and examples: Scrollbars.zip My grateful thanks to the authors of the GUIScrollbars and WinAPI UDFs for their code, some of which I have plundered. And as always I welcome constructive criticism and/or effusive congratulations. M231 point -
youtuber, You can capture both of these links using a pattern like this... #include <array.au3> Global $sListbox = "<a href='https://www.autoitscript.com/forum/forum/2-autoit-general-help-and-support/'>" & @CRLF & _ '<meta itemprop="url" content="https://www.autoitscript.com/forum/">' $aResult = StringRegExp($sListbox, '(?i)(?:href=(?:\x22|\x27)|content=(?:\x22|\x27))([^\x22\x27]+)(?:\x22|\x27)', 3) ConsoleWrite(@error & ' - ' & @extended & @CRLF) _ArrayDisplay($aResult) If you really want to test for ' or " just use hex notation, as above, or, stringinstr. kylomas1 point
-
Today MS Update: KB401681 brokes Provider=Microsoft.Jet.OLEDB.4.0; You can use: Provider=Microsoft.ACE.OLEDB.12.0; But for this you need to download and install: https://www.microsoft.com/en-us/download/details.aspx?id=132551 point
-
Thanks for this function I'm thinking about to extend the UDF with a function to delete objects plus leaf nodes and OUs including all contained objects/leafs/subOUs. This function will be based upon your function plus the ideas I found here: http://www.selfadsi.org/delete.htm What do you (and others) think? Is such a function needed? If yes, is anyone willing to test on a test system? I'm an ordinary user so only have read access to our AD Please click the "Like this" button in the lower right corner of this post. So I know how many of you would like to see this function implemented.1 point
-
huh... Now I see what you are doing. I just added DSN here is what I get Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\SOFTWARE\ODBC\ODBC.INI] [HKEY_CURRENT_USER\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources] "SQL TEST"="SQL Server Native Client 11.0" [HKEY_CURRENT_USER\SOFTWARE\ODBC\ODBC.INI\SQL TEST] "Driver"="C:\\Windows\\system32\\sqlncli11.dll" "Description"="testing" "Server"="NOTEBOOK\\SQLEXPRESS" "Database"="BAZA" "Trusted_Connection"="Yes" Now I ask you again how you are using connection string ? You should to know that using DSN is a different thing then using Driver or Provider.1 point
-
Does pro Google mail use the same SMTP server as personal google? I would try using this handy little command line tool to see if you are able to send mail that way. Try (from command line): CMail -from:<Enterpriseemail>:"<Your name>" -to:<Email address of recipient> -subject:"<Subject>" -body:"<Some test text>" -host:<username for enterprise login>:<Password for enterprise login>@<FQDN for smtp server used>:<port number> -starttls -requiretls -d The text between the <> is what you fill in. The "-d" switch will output debugging information. You also might find this useful: https://support.google.com/a/answer/176600?hl=en1 point
-
Function is easier to understand, though I would pass as params.1 point
-
#include <GUIConstantsEx.au3> $hGUI = GUICreate("Toggle Not Working", 200, 200) $c_Button_Ontop = GUICtrlCreateButton("Not OnTop", 10, 10, 140, 21) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $c_Button_Ontop Then _ToogleOnTop() WEnd Func _ToogleOnTop() Switch GUICtrlRead($c_Button_Ontop) Case "Not OnTop" WinSetOnTop($hGUI,"",1) GUICtrlSetData($c_Button_Ontop,"OnTop") Case Else WinSetOnTop($hGUI,"",0) GUICtrlSetData($c_Button_Ontop,"Not OnTop") EndSwitch EndFunc1 point
-
Clickable button ontop of label?
argumentum reacted to Melba23 for a topic
Lope, Or you can remove the forced $SS_NOTIFY style from the label so that it no longer is a clickable control - it the overlapping active controls that confuse AutoIt. #include <GUIConstantsEx.au3> #include <StaticConstants.au3> $Form1 = GUICreate("Form1", 633, 454, 192, 114) $Label1 = GUICtrlCreateLabel("The dog (Canis lupus familiaris[3] and Canis lupus dingo[1][2]) is a domesticated form of the gray wolf, a member of the Canidae family of the order Carnivora. The term is used for both feral and pet varieties. The dog was the first animal to be domesticated, and has been the most widely kept working, hunting, and companion animal in human history. The word 'dog' may also mean the male of a canine species,[4] as opposed to the word 'bitch' for the female of the species.", 104, 216, 464, 153) GUICtrlSetStyle(-1, $SS_LEFT) $Button1 = GUICtrlCreateButton("Button1", 288, 224, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $Button1 msgbox(0,"","clicked") EndSwitch WEndBy explicitly setting the $SS_LEFT style we overwrite the default setting of $SS_LEFT and $SS_NOTIFY styles - read the Setting Styles tutorial in the Wiki for about this. M23 Edit: Added explanation.1 point -
Topmost property is defined by the ExStyle $WS_EX_TOPMOST and can be determined with _WinAPI_GetWindowLong(). #include <Constants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> GUICreate("My TOPMOST GUI #1", Default, Default, Default, Default, Default, $WS_EX_TOPMOST) GUISetState(@SW_SHOW) $hwnd = GUICreate("My TOPMOST GUI #2") GUISetState(@SW_SHOW) WinSetOnTop($hwnd,"",1) $var = WinList() For $i = 1 To $var[0][0] ; Only display visble windows that have a title If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then ConsoleWrite("Title=" & $var[$i][0] & @TAB & "Handle=" & $var[$i][1] & @TAB & "IsTopmost=" & BitAND(_WinAPI_GetWindowLong($var[$i][1], $GWL_EXSTYLE), $WS_EX_TOPMOST) & @CRLF) EndIf Next While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() Func IsVisible($handle) If BitAND(WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsVisible Edit: Added WinSetOnTop() example.1 point