Jump to content

Recommended Posts

Posted
  Quote

 

The real question is whether a novice programmer reading HelpFile, acquires bad programming habits ?

I think that relates well to the Spanish speaking students learning English in my classes - while it is my 'responsibility' to make sure they learn 'proper' speaking habits, it is also, and a more important responsibility to expose them to a variety of words, phrases and situations where it is then THEIR responsibility to apply those to situations they face in their own lives.

There is no one way to do things, and making the help file extremely uniform, while in some ways preferable, would also eliminate the true sense of TEACHING - that there are things in this world that aren't simply answered in some manual.  

There are, in fact, some things that you must figure out for yourself!

(that is not to say there aren't some 'improvements' I'd like to see in the help file, though uniformity in coding style is not one of them)

Posted

I agree, which is why newly updated examples always have code inside functions, because that's what we consider to be good practice generally.

However, there is no "you must do this" rule. There is a reason AutoIt allows code at the global level, and that's so that small code snippets are much easier to read. This example would be a little bit stupid:

#include <MsgBoxConstants.au3>

_Example()

Func _Example()
    MsgBox($MB_SYSTEMMODAL, "Test", "Hello, World!")
EndFunc

I can think of no easier way to alienate a new user by giving them that as a Hello, World! example. So an element of common sense has to be applied, and like the variables prefix thread started yesterday, we can tell you "these are good programming practices" but that doesn't mean you follow them 100% of the time, you follow them unless it doesn't make sense to follow them.

Posted

Thank you very much for your valuable comments.

Best regards

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

  • 3 weeks later...
Posted

I do not know if this topic was not previously discussed.
But I think it's worth talking so:

In the "Keyword Reference" there is "Dim / Global / Local / Const" section.
We all probably well aware of its contents so I will not elaborate on this, the more that this is not my goal.

But I wonder if the HelpFile does not add additional information.

example provided here:

http://www.autoitscript.com/wiki/Best_coding_practices#Names_of_Variables
and
http://www.autoitscript.com/wiki/Best_coding_practices#Scopes_of_Variables

The reason because this notation is used in the UDF file.

IMHO:
Explanations as to how {create / action / description} UDF file should be included in HelpFile, as these files are part of the environment AutoIt.
Anyone who analyzes the mode of action of the UDF file, should know what to expect.
By the way, these are still good tips on how to write good code.

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)

I noticed that in some instances used alternately quotation marks, once a single character and then double quotation mark, In the same line of code.

look in

StringRegExpGUI.au3 example

$sResult &= StringFormat("%0" & $iStrLgth & "i", $c) & ' => ' & $aB[$j] & @CRLF

and

$sResult &= StringFormat("%0" & $iStrLgth & "i", $i) & ' => ' & $aA[$i] & @CRLF

What do you think about this ?

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

It's syntactially correct to use either one as long as you're consistent in their usage in opening and closing quotes. So other than a visual issue, it doesn't really matter does it?

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

  • 2 weeks later...
Posted

AZJIO

I make a Track Ticket ##2724

Cheers

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 (edited)

IniReadSectionNames
The number returned is limited to the names of the lengths of all the names of no more than 32,767 characters.

#include <Array.au3>
$Ini = @ScriptDir & '\test.ini'
For $i = 1 To 5000
    IniWrite($Ini, (100000000000000 + $i) & 'a', 'Sec', 'var1')
Next
$a = IniReadSectionNames($Ini)
_ArrayDisplay($a)
FileDelete($Ini)

 
_IEImgGetCollection -> Example 1
to the 6th Image
4th Image Info

_IEQuit
It is therefore good practice to call _IEQuit() whenever the browser process is not needed after the script exists.
exits ???

FileCopy
Examples became difficult

Exit ; protection against accidental startup

; Please note, copying is not recursive, subdirectories are not processed.

; Copies all log-files in txt-files, leaving the original names of the same
; Flag 9 = (1 + 8) where 1 - to overwrite the file, 8 - to create the destination folder
FileCopy("C:\Temp\*.log", "C:\Temp2\*.txt", 9)

; Copies all .txt files with their original names.
; Without the flag = 8, if the destination folder does not exist, the copy will not happen
FileCopy("C:\Temp\*.txt", "C:\Temp\TxtFiles\", 8)

; Copies the file to a different folder with the specified name. Flag of 9 = (1 + 8)
FileCopy("C:\Temp\file.txt", "C:\Temp\TxtFiles\NewFile.txt", 9)

; Create a destination folder if you do not want to check for a folder using the flag = 1 for subsequent calls FileCopy.
DirCreate("C:\new\data1")
FileCopy("C:\old\file1.txt", "C:\new\")
FileCopy("C:\old\file2.txt", "C:\new\data1\")
  Quote

this flag determines whether to overwrite files if they already exist.

 
You repeat the same thing 3 times. Once in the flag name, the second time in the parameter description, the third time in a note.
 
DirCreate

  Quote

Failure: 0 if there is an error creating the directory.

If the directory already existed, whether the function should fail?
Failure: 0 if the directory does not exist after the execution of the function

_IEAttach
of of

Edited by AZJIO
  • 2 weeks later...
Posted (edited)

FileOpen

A file may fail to open due to access rights or attributes.

A file may fail to open due to access rights or attributes (R for the flag 1, RSH for 2).

#include <File.au3>

$sPath = @ScriptDir & '\Test.txt'
_FileCreate($sPath)
MsgBox(0, 'flags', _Test($sPath))
FileDelete($sPath)

Func _Test($sPath)
    Local $hFile, $sRet, $Ret = ''
    $aAtr = StringSplit('RSHAT', '')

    For $i = 0 To 2
        $sRet &= $i & ' = '
        For $j = 1 To 5
            FileSetAttrib($sPath, '-RSHAT') 
            FileSetAttrib($sPath, '+' & $aAtr[$j]) 
            $hFile = FileOpen($sPath, $i)
            If $hFile = -1 Then $sRet &= FileGetAttrib($sPath) 
            FileClose($hFile)
        Next
        $sRet &= @CRLF 
    Next
    Return $sRet
EndFunc

FileCopy, FileMove, FileDelete
It is possible to specify that works not recursively.

 

FileFindFirstFile
Returns a search "handle" according to file search string.

1. Initializes a search handle, defined by a path and file mask.
2. Creates an object to start searching, storing path, mask and position for the next file.

FileFindNextFile

Returns a filename according to a previous call to FileFindFirstFile.
Returns the next filename defined by the search handle.

 

AutoIt -> Using AutoIt -> Running under Windows 64-bit Edition
Running the 32-bit version of AutoIt on a x64 System
The table also indicates a 64-bit AutoIt

Directories | 32-bit Value | 64-bit Value
Directories | 32-bit version of AutoIt | 64-bit version of AutoIt

Edited by AZJIO
Posted

Found two wrong entries in _GDIPlus_ImageGetHeight and _GDIPlus_ImageGetWidth examples:

ShellExecute(@MyDocumentsDir & "GDIPlus_Image.jpg") must be  ShellExecute(@MyDocumentsDir & "GDIPlus_Image.bmp")

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

  • Moderators
Posted

UEZ,

Fixed. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

AZJIO,

I have fixed some of the issues reported, but because you didn't create a ticket I am unable to report which ones I rejected.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

I have a proposal to the 

http://www.autoitscript.com/autoit3/docs/history.htm

and

"THIS IS A SCRIPT BREAKING CHANGE" description.

 

can you bold this

or even colored red ?

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

I have changed the build script to make that sentence bold (strong).

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

Thank you.

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

  • Moderators
Posted

JScript,

Perhaps you could supply one for us? ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

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
×
×
  • Create New...