Jump to content

Recommended Posts

Posted (edited)

I would like to introduce a function that can help for testing the scripts for movement toward EDIT: a the new version of AutoIt EDIT: or when testing the Beta version.

Func _IsBeta()
    Return Mod(StringSplit(@AutoItVersion, '.')[3], 2) == 1
EndFunc   ;==>_IsBeta

  Reveal hidden contents

Old function:

EXAMPLE:

#include <Array.au3>
#include <MsgBoxConstants.au3>

_SomeFunc()

Func _SomeFunc()
    Local $aTest[10]
    _ArrayUnique($aTest, 0, 5)
    Local $iError = @error
    ConsoleWrite('$iError = ' & $iError & @CRLF)
    If _IsBeta() Then
        If $iError = 3 Then
            MsgBox($MB_SYSTEMMODAL, '@error', '3 - $iBase or $iCase contains an invalid value' & @CRLF & @AutoItVersion)
        EndIf
    Else
        If $iError = 2 Then
            MsgBox($MB_SYSTEMMODAL, '@error', '2 - $iBase or $iCase contains an invalid value' & @CRLF & @AutoItVersion)
        EndIf
    EndIf
EndFunc   ;==>_SomeFunc

Func _IsBeta()
       Return Mod(StringSplit(@AutoItVersion, '.')[3], 2) == 1
EndFunc   ;==>_IsBeta

EDIT:
I started to use it in order to be able to use both the current version and the beta, to become independent of the "SCRIPT BREAKING CHANGE".

EDIT2:

_IsBeta() - changed.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

you mean why do not I use simply:

Func _IsBeta()
    If Mod(StringSplit(@AutoItVersion, '.')[3], 2) = 0 Then
        Return False
    Else
        Return True
    EndIf
EndFunc   ;==>_IsBeta

or even:

Func _IsBeta()
    Return Mod(StringSplit(@AutoItVersion, '.')[3], 2) == 1
EndFunc   ;==>_IsBeta

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

It reminded me why.
Initially, my function in @Extended returns arrays content that was results from the function StringSplit.

I forgot to clean up.

But thanks, because of your note, now I cleaned up completely this function ;)

Cheers

mLipok

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Great. This function should only return a bool.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

This function can theoretically cause additional load on the CPU, and it is due to anti-virus, as opposed to my Versions, your refers again to the file that is already running, and my work completely in memory.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 5/6/2014 at 7:38 PM, Inververs said:
Return StringInStr(FileGetVersion (@AutoItExe,'ProductName'),'Beta') > 0

and this?

This is different to mLipok's version. I can compile the executable using the beta and change the productname via pragma, thus your version won't work.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

Of course, if Jon decides tomorrow to release a new version 3.3.11.xx then the original function fails as well. Fortunately, the release versions have all been using an even number or 0 for the 3rd minor version number so far.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

I fail to see how the original function will fail if Jon releases a new beta version.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

I meant a NON-beta version that uses an odd number in the third position. Using the function would say that it's a beta version.

I thought that was made clear by the rest of the post I made.

  Quote

 

Fortunately, the release versions have all been using an even number or 0 for the 3rd minor version number so far.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

Agreed, unless it is some sort of standard which Jon adheres to, it is only good for purpose and not in general.

Also you restructure it to use in versions upto ans including 3.3.8.1

ConsoleWrite(_IsBeta() & @LF)

Func _IsBeta()
    $a = StringSplit(@AutoItVersion, '.')
    Return Mod($a[3], 2) == 1
EndFunc   ;==>_IsBeta

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

It's the standard to use an odd number for the build scheme of the version value. mLipok's code is good.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...