Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/01/2020 in all areas

  1. Gawd, that is only the tip of the iceberg for all the names I have suggested ... you are hard to please. My favorite, is still ImagineIt ..... ha ha ha ha. Something we will be doing for a good while, especially if you get stuck on naming it. TheDcoder and AutoIt had a baby, and it was called CoderIt ..... or Zit for short .... he got all the way through the alphabet, and then realized he had to pick something, so Z it is .... pronounced Zed It you pimple heads. I bet some of you thought it was named after a volcano ... well, maybe it was for a while, but then it got squeezed out of the running. So bud, any idea when Z++It will go into production? P.S. I believe AutoColdKey is still available ... though I guess AutoGoldKey would sound better and further from controversy. P.S.S. Maybe AutoIt and AutoHotkey had a baby and it was simply called AutoKey .... stranger things have happened. Here's a growing shortlist for you.
    3 points
  2. Okay, you doubting Thomases (male, female, etc). If the following doesn't convince you that TheDcoder is the man for the job (this topic's idea), then nothing will. Today, he came to me on HexChat with an issue. It is not an issue I had ever come across before, and even afterward I still did not see the issue ... clearly I'm not nerdy enough. He was upset or bothered (plagued was his word) by the fact he was using the text "Start" twice in a script. Here is the example code he gave me to illustrate the issue I was just not getting. #include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 300, 200) ; Create a button control. Local $idButton = GUICtrlCreateButton("Start", 120, 170, 85, 25) Local $idButton_Close = GUICtrlCreateButton("Close", 210, 170, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) Local $bStarted = False ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop Case $idButton $bStarted = Not $bStarted GUICtrlSetData($idButton, $bStarted ? "Stop" : "Start") EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example He sent that to me in a PM to try and make things clearer. He also said the following in the PM. Now I like to keep things simple, even if it takes more code and text. So I don't code like he does, and so rarely rely on False and True etc. I've certainly never been guilty of using a line like the following. In fact I had to run it after he assured me it worked, to indeed see it does. GUICtrlSetData($idButton, $bStarted ? "Stop" : "Start") While I was checking that out, he thought I may have needed a simpler version, so he provided the following variant, but I had already sussed it out by then. #include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 300, 200) ; Create a button control. Local $idButton = GUICtrlCreateButton("Start", 120, 170, 85, 25) Local $idButton_Close = GUICtrlCreateButton("Close", 210, 170, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) Local $bStarted = False ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop Case $idButton $bStarted = Not $bStarted If $bStarted Then GUICtrlSetData($idButton, "Stop") Else GUICtrlSetData($idButton, "Start") EndIf EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example Anyway, I was perplexed that he really found this an issue, so offered up the following solution, which worked, but did not satisfy him, and I am not surprised why ... I was just swapping one thing for another. #include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 300, 200) Local $starttxt = "Start" Local $stoptxt = "Stop" ; Create a button control. Local $idButton = GUICtrlCreateButton($starttxt, 120, 170, 85, 25) Local $idButton_Close = GUICtrlCreateButton("Close", 210, 170, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) Local $bStarted = False ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop Case $idButton $bStarted = Not $bStarted GUICtrlSetData($idButton, $bStarted ? $stoptxt : $starttxt) EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example He then had a moment of genius, and came up with this. #include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 300, 200) ; Create a button control. Local $idButton = GUICtrlCreateButton("Start", 120, 170, 85, 25) Local $idButton_Close = GUICtrlCreateButton("Close", 210, 170, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Stop Text Local $sText = "Stop" ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop Case $idButton GUICtrlSwapData($idButton, $sText) EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example Func GUICtrlSwapData($idCtrl, ByRef $vSwapData) Local $vOldData = GUICtrlRead($idCtrl) GUICtrlSetData($idCtrl, $vSwapData) $vSwapData = $vOldData EndFunc To which I said the following. To which he said. To which I said. To which he said. To which I said. To which he said. To which I said. To which he said. To which I said. To which he laughed ... as I was doing. I then said. And he is.
    2 points
  3. zeenmakr, Are you saying you want a new functionality for StringFormat which returns only the decimal part of a number? If so then it will never happen as StringFormat (as the name suggests) is about formatting an existing number, not extracting parts of it. And before you bring up the "%**i" method, that is designed to pad out integers with leading zeroes, not to extract the integer value (Int does that quite nicely), as explained in the Help file: The precision specifies the minimum number of digits to be printed. If the number of digits in the argument is less than precision, the output value is padded on the left with zeros. The value is not truncated when the number of digits exceeds precision. So just accept that you will need to use another function to achieve your aim - you have been shown many possibilities above. M23
    2 points
  4. [BUGFIX VERSION] - 6 Apr 24 Fixed: UDF failed if header colours were initialised but not specifically set. New UDF in the zip below. -------------------------------------------------------------------------------------- Note: This is a new recoded and expanded version of my earlier UDF of the same name. If you move to this new version there might well be several script-breaking changes, particularly when setting which columns are to be editable. Please read the "Beginner's Guide" and look at the included example scripts to see where things have changed. -------------------------------------------------------------------------------------- This UDF allows you to do much more with ListView controls (either native or UDF created): Edit the content with plain text, combos or date-time pickers - and edit the headers too Move rows within the ListView Drag rows both within the ListView and to other ListViews in the same GUI (or not as required) Insert and delete columns and rows Sort columns by simply clicking the header Colour individual ListView items and headers Only select a single cell rather then the entire row Save and load entire ListViews For the advanced user: If you use certain Windows message handlers (In particular WM_NOTIFY) in your script, please read the function headers for the equivalent handlers within the UDF. Here is the UDF, with 6 examples and the guide, in zip format: GUIListViewEx.zip Credit to: martin (basic drag code), Array.au3 authors (array functions), KaFu and ProgAndy (font function), LarsJ (colouring code) Happy to take compliments or criticism - preferably the former! M23
    1 point
  5. The current default wait is 10 secs, so all you need to do is provide the first few parameters -- _WD_WaitElement($sSession, $_WD_LOCATOR_ByXpath, "//input[@name='example']") This will internally loop and continually check for the designated element. If it isn't found within those 10 secs, then it will return with @error set to _WD_ERROR_Timeout. If you use the $iDelay parameter, this delay only occurs once, before the initial search occurs.
    1 point
  6. @auitden Check out the first few lines of code for the function and that should reveal how the parameter defaults are handled when they are omitted or equal to the Default keyword. Why do you need to make two attempts for 5 secs each instead of a single attempt for 10 secs?
    1 point
  7. Jos

    How to make Loops - (Locked)

    Great and I am sure you can do that too or do you first need some more criticism ? By the way: What are you trying to automate here ?
    1 point
  8. Given all of the examples of looping in the help file, throughout this forum, and on the Internet in general, if you cannot find information on looping maybe you should work on your searching skills before you attempt to work on your scripting skills. I see no attempt at a loop in the image that you have provided. Is what you have provided the total extent of your efforts? There is a whole topic in the Help file called "Loop Statements" under "Language Reference". Each has one or more examples.
    1 point
  9. @zeenmakr As stated in the Help file about StringFormat function: So, you may use one of the various alternatives with all the others String* functions: #include <StringConstants.au3> Global $strNumber = "3.1415" ConsoleWrite("Method 1: " & StringRight($strNumber, StringLen($strNumber) - StringInStr($strNumber, ".")) & @CRLF) ConsoleWrite("Method 2: " & StringMid($strNumber, StringInStr($strNumber, ".") + 1) & @CRLF) ConsoleWrite("Method 3: " & StringSplit($strNumber, ".", $STR_NOCOUNT)[1] & @CRLF) ConsoleWrite("Method 4: " & StringRegExp($strNumber, '^\d+\.(\d*)$', $STR_REGEXPARRAYMATCH)[0] & @CRLF) ConsoleWrite("Method 5: " & StringRegExpReplace($strNumber, '^\d+\.(\d*)$', '$1') & @CRLF)
    1 point
  10. @argumentum As promised, here are the steps to enable the example script to listen and respond to HTTPS requests using a simple NETSH command. First, I would suggest that you change the listening URL path in the example from a host name to an IP address. It makes everything a lot easier. Doing a Replace All from "localhost" to "127.0.0.1" in the example should do the trick. Change the global constant $HTTP_HOST's protocol from "http" to "https". Save or "Save As" the changes to the example script. That's all that needs to be changed in the script. Next, you need import a SSL certificate into the Local Machine's "Personal" key store. Make sure it is in the Local Machine hive, not the Current User. As I'm sure you already know, you can do this by either running the certmgr.msc MMC plugin or right-clicking the file and selecting "Install PFX". The imported SSL cert must contain the key. So you will most likely need to have a .p12 or .pfx file to easily import it. The last step is to "bind" the IP:Port combination to the SSL certificate in the Local Machine's Personal key store. To do this, you need to make a note of the SSL certificate's thumbprint hash. If it was hashed with SHA-1, it will be a 20 hex bytes (40 char hex string). This will be needed by the NETSH command that follows. Execute the following command: netsh http add sslcert ipport=127.0.0.1:9000 certhash=<thumbprint hash> appid={<GUID>} example: netsh http add sslcert ipport=127.0.0.1:9000 certhash=84c6501539603c1b131fec8695c886227b0363a5 appid={CC305314-5579-44BF-BCD2-180FE2DB2BD2} The appid GUID can be any valid GUID. I just used the AutoIt3 _WinAPI_CreateGUID function to generate one. If the command is successful, you will see a message saying that the cert was added. Otherwise, you will probably see a message simply saying "Invalid parameter". The binding of the ip:port to the certificate is persistent. The entry will stay until it is deleted. That's it! If everything went well, you should be able to start your http server and access it in your browser using https. If you run into any issues, just let me know and I'll help you get it resolved.
    1 point
  11. zeenmakr, Try StringSplit on the decimal point. M23
    1 point
  12. ..and that is why I did the way I did @HurleyShanabarger
    1 point
  13. I like this, but even less typing: sln() sln() Func sln($sln = @ScriptLineNumber) ConsoleWrite($sln & @CRLF) Return $sln EndFunc sln()
    1 point
  14. ConsoleWrite(sln() & @CRLF) ConsoleWrite(sln() & @CRLF) ConsoleWrite(sln() & @CRLF) Func sln($sln = @ScriptLineNumber) Return $sln EndFunc
    1 point
  15. Looking back I did mention one thing extra: abrev manager
    1 point
  16. any activities which engage your brain is not waste of time. EDIT: btw. I missed too.
    1 point
  17. I don't think it was a complete waste of time. There are different ways to get to the goal. Your post contains some information that might help @zeenmakr in case he does not understand my description. According to the motto, double works better .
    1 point
  18. Go to sctite and in tools>scite config>other tools>run abrev manager>create Alternatively: If you dont have these filenames showing up in the options drop down menu: au3UserAbbrev.properties au3.keywords.user.abbreviations.properties you can create them in: C:\Users\%userprofile%\AppData\Local\AutoIt v3\SciTE then inside au3.keywords.user.abbreviations.properties you can have something like: au3.keywords.userabbrev=sln And inside au3UserAbbrev.properties: sln=@ScriptLineNumber After creating the abreviations you can save these files so you dont have to create again in case you format the pc or something.
    1 point
  19. Also configurable abbreviation and I think that you can have a shortcut sln > @ScriptLineNumber
    1 point
  20. AFAIK , the macros are not declared in one of the open standard UDF's. I would add a new abbreviation to the SciTE editor. => Open au3.keywords.abbreviations.properties ---> add sln ==> Search for au3abbrev.properties (better : au3UserAbbrev.properties (create one, if it doesn't exist)) --> add : sln=@ScriptLineNumber | You can do this within the SciTE editor itself (-> Options) :
    1 point
  21. Jos

    Where is @ScriptLineNumber

    This is an internal Keyword, so you can't change that, but just install the Full version of SciTE4Autoit3 and you will have an easy AutoComplete function!
    1 point
  22. The semaphore one better fit my coding style**. A note on the advantages of one over the other at the first post will be welcomed by those that code like me. **good luck running this unstructured thoughtless rambling called code
    1 point
  23. If you only need a count... DirGetSize ( "path" [, flag] ) Parameters dest dir The directory path to get the size from, e.g. "C:\Windows". flag [optional] this flag determines the behaviour and result of the function, and can be a combination of the following: 0 = (default) 1 = Extended mode is On -> returns an array that contains extended information (see Remarks). 2 = Don't get the size of files in subdirectories (recursive mode is Off) Return Value Success: Returns >= 0 the sizes Failure: Returns -1 and sets @error to 1 if the path doesn't exist. Remarks If the script is paused then this function is paused too and will only continue when the script continues! If you use the extended mode then the array returned from this function is a single dimension array containing the following elements: $array[0] = Size $array[1] = Files count $array[2] = Dirs Count
    1 point
×
×
  • Create New...