Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/08/2019 in all areas

  1. Aside from the ghost in the machine or gremlins, there is only one logical explanation... somewhere in that function, is a statement which updates the "critical data", it doesn't have to be the variable directly, sometimes other factors may influence it in ways that may have been forgotten. I suggest you do a full review of the code, especially the function which gives you the warning message. You will certainly find the culprit sooner or later.
    2 points
  2. New version - 17 Jun 23 ======================= Added: Added 24hr unpadded H mask. New UDF in zip below. Changelog: Changelog.txt Here is my version of a UDF to transform date/time formats. It is entirely self-contained and although it defaults to English for the month/day names, you can set any other language very simply, even having different ones for the input and output. You need to provide a date/time string, a mask to tell the UDF what is in the string, and a second mask to format the output - the masks use the standard "yMdhmsT" characters. This is an example script showing some of the features: #include <Constants.au3> ; Only required for MsgBox constants #include "DTC.au3" Global $sIn_Date, $sOut_Date ; Basic format $sIn_Date = "13/08/02 18:30:15" $sOut_Date = _Date_Time_Convert($sIn_Date, "yy/MM/dd HH:mm:ss", "dddd, d MMMM yyyy at h:mm TT") MsgBox($MB_SYSTEMMODAL, "DTC Conversion", $sIn_Date & @CRLF & $sOut_Date) ; Note how day name is corrected $sIn_Date = "2013082 Sun 12:15:45 PM" $sOut_Date = _Date_Time_Convert($sIn_Date, "yyyyMMd ddd hh:mm:ss TT", "dddd, dd MMM yy") MsgBox($MB_SYSTEMMODAL, "DTC Conversion", $sIn_Date & @CRLF & $sOut_Date) ; Note use of $i19_20 parameter to change century $sIn_Date = "13/08/02 18:30:15" $sOut_Date = _Date_Time_Convert($sIn_Date, "yy/MM/dd HH:mm:ss", "dddd, d MMMM yyyy at h:mm TT", 10) MsgBox($MB_SYSTEMMODAL, "DTC Conversion", $sIn_Date & @CRLF & $sOut_Date) $sIn_Date = "18:30:15 13/08/02" $sOut_Date = _Date_Time_Convert($sIn_Date, "HH:mm:ss yy/MM/dd", "h:mm TT on ddd d MMM yyyy") MsgBox($MB_SYSTEMMODAL, "DTC Conversion", $sIn_Date & @CRLF & $sOut_Date) ; Just to show it works both ways $sIn_Date = "Friday, 2 August 2013 at 6:30 PM" $sOut_Date = _Date_Time_Convert($sIn_Date, "dddd, d MMMM yyyy at h:mm TT", "dd/MM/yy HH:mm") MsgBox($MB_SYSTEMMODAL, "DTC Conversion", $sIn_Date & @CRLF & $sOut_Date) $sIn_Date = $sOut_Date $sOut_Date = _Date_Time_Convert($sIn_Date, "dd/MM/yy HH:mm", "dddd, d MMMM yyyy at h:mm TT") MsgBox($MB_SYSTEMMODAL, "DTC Conversion", $sIn_Date & @CRLF & $sOut_Date) ; Note false returns for non-specified elements $sIn_Date = "6:15 P" $sOut_Date = _Date_Time_Convert($sIn_Date, "h:m T", "yy/MM/dd HH:mm:ss") MsgBox($MB_SYSTEMMODAL, "DTC Conversion", $sIn_Date & @CRLF & $sOut_Date) ; Note use of "x" in place of actual spacing/punctuation $sIn_Date = "Sun 12:15:45 PM" $sOut_Date = _Date_Time_Convert($sIn_Date, "dddxhhxmmxssxTT", "dddd HH:mm") MsgBox($MB_SYSTEMMODAL, "DTC Conversion", $sIn_Date & @CRLF & $sOut_Date) ; Output month/day strings changed to French _Date_Time_Convert_Set("smo", "jan,fév,mar,avr,mai,juin,juil,août,sept,oct,nov,déc") _Date_Time_Convert_Set("ldo", "dimanche,lundi,mardi,mercredi,jeudi,vendredi,samedi") _Date_Time_Convert_Set("SDO", 3) ; Each short name is first 3 chars of equivalent long name ; Note as only the short day names are required, they could have been set directly: ; _Date_Time_Convert_Set("sdo", "dim,lun,mar,mer,jeu,ven,sam") $sIn_Date = "20130716 Sun 12:15:45 PM" $sOut_Date = _Date_Time_Convert($sIn_Date, "yyyyMMd ddd hh:mm:ss TT", "ddd, d MMM yy") MsgBox($MB_SYSTEMMODAL, "DTC Conversion", $sIn_Date & @CRLF & $sOut_Date) ; Output month/day strings changed to German _Date_Time_Convert_Set("smo", "Jan.,Feb.,März,Apr.,Mai,Juni,Juli,Aug.,Sept.,Okt.,Nov.,Dez.") _Date_Time_Convert_Set("ldo", "Sonntag,Montag,Dienstag,Mittwoch,Donnerstag,Freitag,Samstag") $sIn_Date = "20130716 Sun 12:15:45 PM" $sOut_Date = _Date_Time_Convert($sIn_Date, "yyyyMMd ddd hh:mm:ss TT", "dddd, d MMM yy") MsgBox($MB_SYSTEMMODAL, "DTC Conversion", $sIn_Date & @CRLF & $sOut_Date) ; All strings reconverted to default English _Date_Time_Convert_Set() ; As shown here $sIn_Date = "20130716 Sun 12:15:45 PM" $sOut_Date = _Date_Time_Convert($sIn_Date, "yyyyMMd ddd hh:mm:ss TT", "ddd, d MMM yy") MsgBox($MB_SYSTEMMODAL, "DTC Conversion", $sIn_Date & @CRLF & $sOut_Date) And here is the UDF and example in zip format: DTC.zip As always, happy for any comments. M23
    1 point
  3. INTERIM VERSION 11 Mar 21 A bug in the x64 implementation of some the library TreeView functions meant that some replacement working functions were added to the UDF. Now the Beta TreeView library (from 15.3) has been modified, these functions are no longer required, but they will remain until the modified library is formally released. However, other changes in the Beta mean that the replacement functions will not work under it - don't you just love compatibility problems! So here is an interim release with a modified replacement function so that it will function with Release and Beta versions under both x32 and x64 - I hope! New UDF and examples in zip below. Previous version descriptions: ChangeLog.txt I was fed up with using the native FileOpenDialog and FileSelectFolder which appeared anywhere on the screen in seemingly random sizes and often allowed users to select files from other than the path desired. So I decided to write my own version of an Explorer-type treeview and here it is: ChooseFileFolder. What are the main advantages of this UDF over the normal dialogs? Common format for both file and folder selection. Ability to size and place the dialog where you want it rather than how Windows last left it. Ability to select (and delete) multiple items - even from different folders or drives. You can also select both files and folders from the same tree Ability to preselect items. And there is also a function to allow you to use an existing treeview in your own GUI to display the folder tree - no need to have a dialog at all. Here is a zip file with the UDF and several example scripts: ChooseFileFolder.zip As usual happy to take feedback and, preferably, plaudits. M23
    1 point
  4. Write a function that takes parameters. Send it the variable name as first parameter and the data you want to assign it to. That function should log everything. Then you should see what’s happening
    1 point
  5. I am afriad it isn't directly possible to monitor a specific variable for changes from within the script itself. Seeing how AutoIt lacks a native debugger, it may also not be possible for the several 3rd party debuggers to accomplish this task, however I recommend trying out some of them, see if they are of help. Good luck
    1 point
  6. Letraindusoir, And the only way I can think of answering the first question is to append the variable name to its content like this: $vVariable = "VarName|12345679*9" _Expand($vVariable) Func _Expand($vVar) $aContent = StringSplit($vVar, "|") ConsoleWrite($aContent[1] & " = [" & Execute($aContent[2]) & "]" & @CRLF) EndFunc You will need a wrapper function to reassign the variable content within the script, but that is pretty trivial. M23
    1 point
  7. In addition to my earlier comments, AutoIt is a very forgiving and quite flexible language, that doesn't need a lot of recall or understanding of a huge bunch of concepts. Sure, knowing that stuff can improve how your use of or understanding of AutoIt is, but for many uses you can get by just fine relying on the wonderful Help file and online help and examples. I've never regretted giving up on other languages for the most part, and just relying on AutoIt. But then, I am just a hobby programmer who wants better control and usage of his PC, and I answer to no-one .... except my wife & kids & mother. I don't have to be a perfectionist, though I am very organised with structure and method. I do usually put in extra effort though, because I regularly share my work, but my comments can often be sparse, and not as many error checks as could be.
    1 point
  8. they allow it because some people DO that stuff... lol, it's just how the compilers work. I love C/C++/C# and Python. all golden languages that have high earnings potential if you can program well. I do not prefer the VB like loosey goosey stuff, too much leeway for error, strict and strongly typed languages for the win. I still like Autoit for it's simplicity when I have simple tasks to do for automation purposes. it's a good and useful automation scripting language. if it's complicated or needs to be fast, it's one of the other languages I use. Like said here before, use the tool that fits the job. If you are an uber AutoIt guru, have at it. for automating the installs of our products, autoit is golden and simplest to use. super reliable if written well. I have a template based on my UDF that handles most of the control waiting and clicking and logging. That way all my installer scripts work in the same unified way. This way I can fully test the installers GUI (and is done once silent install works perfectly) for full installer regression testing.
    1 point
  9. AutoIt is a pretty good all-rounder, generally being capable of doing most things, and far speedier to get up & running than other languages in that regard, though not speedier when it comes to process execution, which is one of its few downfalls, but which rarely matters normally. At the end of the day, you should use the right tool for the right job, but if your Toolbox only contains AutoIt, you are still looking damn good and cooking with fire in 95%+ instances.
    1 point
  10. 1) From idea on the shitter --> proof of concept is rarely measured in anything other than minutes. 2) The helpfile is gd amazing (which often facilitates #1). 3) people who have to maintain your uncommented code in the future get the luxury of 1 and 2.
    1 point
  11. Because when you distribute an AutoIt program, you clients/customers/users wont need to download some 100MB shitty redistributables... And, knowing pretty well AutoIt and others languages (C and GoLang), I can tell you that AutoIt is strong enough to make pretty anything for Windows.
    1 point
  12. I will answer by reverse your question. I do not know C# and do not know Python. From 2004 my only one programming language is AutoIt. I have my own small bussines and I hire 3 people. AutoIt scripts which I made for my clients, are generating about 1/4 of my company incomes. Why I should use other programming language ? EDIT: currently in 2020 I hire 4 people
    1 point
  13. I posted this the other day, but thought I would post in a separate topic instead. #include <MsgBoxConstants.au3> ; ---- Start of Person Class ; Stored in the 'object' to verify it's our 'object' and not some random array Global Const $PERSON_GUID = '4197B285-6AB1-489B-8585-08C852E33F3D' ; Friendly names for 0, 1, 2 and 3 Global Enum $PERSON_AGE, $PERSON_NAME, $PERSON_ID, $PERSON_MAX ; Constructor Func Person($sName, $iAge) Local $hPerson[$PERSON_MAX] ; Set the GUID, so as the verification will work $hPerson[$PERSON_ID] = $PERSON_GUID Person_SetAge($hPerson, $iAge) Person_SetName($hPerson, $sName) ; Return the Person 'object' Return $hPerson EndFunc ;==>Person ; Getter for the age property Func Person_GetAge(ByRef $hPerson) Return _Person_IsObject($hPerson) ? $hPerson[$PERSON_AGE] : Null EndFunc ;==>Person_GetAge ; Setter for the age property Func Person_SetAge(ByRef $hPerson, $iAge) ; If not a valid 'object' or integer then return If Not _Person_IsObject($hPerson) Or Not IsInt($iAge) Then Return ; Set the age $hPerson[$PERSON_AGE] = $iAge EndFunc ;==>Person_SetAge ; Getter for the name property Func Person_GetName(ByRef $hPerson) Return _Person_IsObject($hPerson) ? $hPerson[$PERSON_NAME] : Null EndFunc ;==>Person_GetName ; Setter for the name property Func Person_SetName(ByRef $hPerson, $sName) ; If not a valid 'object' then return If Not _Person_IsObject($hPerson) Then Return ; Set the name $hPerson[$PERSON_NAME] = $sName EndFunc ;==>Person_SetName ; ToString() for the 'object' Func Person_ToString(ByRef $hPerson) Return _Person_IsObject($hPerson) ? StringFormat('Name: %s, Age: %i', $hPerson[$PERSON_NAME], $hPerson[$PERSON_AGE]) : Null EndFunc ;==>Person_ToString ; Check if it's a valid 'object' and not some random array. "NTERNAL ONLY! Func _Person_IsObject(ByRef $hPerson) Return UBound($hPerson) = $PERSON_MAX And $hPerson[$PERSON_ID] == $PERSON_GUID EndFunc ;==>_Person_IsObject ; ---- End of Person Class Example() Func Example() ; Store the Person 'object', which is just a glorified array Local $hP1 = Person('John', 30) ; Display the 'object' MsgBox($MB_SYSTEMMODAL, 'Person 1', Person_ToString($hP1)) ; Create a new person ; Store the Person 'object', which is just a glorified array Local $hP2 = Person('James', 36) ; Display the 'object' MsgBox($MB_SYSTEMMODAL, 'Person 2', Person_ToString($hP2)) ; Set the age for Person 2 Person_SetAge($hP2, 45) ; Display the 'object' MsgBox($MB_SYSTEMMODAL, 'Person 2 - Revised', Person_ToString($hP2)) EndFunc ;==>Example
    1 point
×
×
  • Create New...