Jump to content

Amending the FAQ in the help file.


 Share

Recommended Posts

  • Moderators

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:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 2 months later...

Hey.  So I think I may have found a error in the help file.  For function _GUICtrlListBox_GetSelCount, the help file states that if no items are selected, the function will return -1.  However, it appears that it returns the number of selected items in all cases, even if no items are selected (which means it would return 0).  I modified the example script associated with the function so that it would not select any of items in the list, and this was the result:

00JgDUQ.png

Link to comment
Share on other sites

This belongs in the bug tracker and not in this thread, this thread is about modifying the FAQ in the help file.

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!

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

Link to comment
Share on other sites

  • 1 month later...
  • Developers

Why would it need mentioning for this internal function?
The example is using the Include file so do expect it there.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

For the simple reason that all other Help file entries list the required #includes.  Also, in the Help file it is not apparent, unless one opens the example.  Uniformity, completeness and accuracy.  I think it was an oversight.

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

  • Developers

Still missing something here I guess. Isn't it the case that for UDF's the required #Include file is listed and for buildin functions none?

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • 1 year later...
  • 2 months later...

In regards to _WinAPI_MessageBoxCheck(), the Microsoft info is not true.
at https://docs.microsoft.com/en-us/windows/desktop/api/shlwapi/nf-shlwapi-shmessageboxchecka they say that the value will be stored at:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\LowRegistry\DontShowMeThisDialogAgain
just as in AutoIt help file, but in my Win10 PC is stored at:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\DontShowMeThisDialogAgain
even tho, the other one exists.

...just sharing. 

Edited by argumentum
clarify

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

  • 3 weeks later...

in the example of the help file about _Timer_SetTimer(), in  the example, the progress bar leaves no room for the clock to show.

Spoiler
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>
#include <Timers.au3>
#include <WindowsConstants.au3>

Global $g_idMemo, $g_hStatus, $g_idProgress, $g_iPercent = 0, $g_iDirection = 1

_Example_CallBack()

Func _Example_CallBack()
    Local $hGUI, $iTimerProgress, $idChange, $iWait = 10, $idState
    Local $aParts[3] = [55, 280, -1] ; <--- adjust to show the clock

    $hGUI = GUICreate("Timers Using CallBack Function(s)", 400, 320)
    $g_idMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, BitOR($WS_HSCROLL, $WS_VSCROLL))
    GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
    $idState = GUICtrlCreateButton("Start Progress Bar", 70, 270, 100, 25)
    $idChange = GUICtrlCreateButton("Change", 215, 270, 90, 25)
    GUICtrlSetState($idChange, $GUI_DISABLE)
    $g_hStatus = _GUICtrlStatusBar_Create($hGUI, $aParts)
    _GUICtrlStatusBar_SetText($g_hStatus, "Timers")
    _GUICtrlStatusBar_SetText($g_hStatus, @TAB & @TAB & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC) & "  ", 2) ; <--- adjust to show the clock prettier
    $g_idProgress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
    GUICtrlSetColor($g_idProgress, 0xff0000)
    _GUICtrlStatusBar_EmbedControl($g_hStatus, 1, GUICtrlGetHandle($g_idProgress))
    GUISetState(@SW_SHOW)

    _Timer_SetTimer($hGUI, 1000, "_UpdateStatusBarClock" ) ; create timer

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $idState
                If GUICtrlRead($idState) = "Start Progress Bar" Then
                    $iTimerProgress = _Timer_SetTimer($hGUI, $iWait, "_UpdateProgressBar") ; create timer
                    If @error Or $iTimerProgress = 0 Then ContinueLoop
                    GUICtrlSetData($idState, "Stop Progress Bar")
                    GUICtrlSetState($idChange, $GUI_ENABLE)
                Else
                    GUICtrlSetState($idChange, $GUI_DISABLE)
                    _Timer_KillTimer($hGUI, $iTimerProgress)
                    GUICtrlSetData($idState, "Start Progress Bar")
                EndIf

            Case $idChange
                If $iWait = 10 Then
                    $iWait = 250
                Else
                    $iWait = 10
                EndIf
                MemoWrite("Timer for _UpdateProgressBar set at: " & $iWait & " milliseconds")
                $iTimerProgress = _Timer_SetTimer($hGUI, $iWait, "", $iTimerProgress) ; reuse timer with different interval
        EndSwitch
    WEnd
    ConsoleWrite("Killed All Timers? " & _Timer_KillAllTimers($hGUI) & @CRLF) ; must be True as the timer to "_UpdateStatusBarClock" have not been killed
    GUIDelete()
EndFunc   ;==>_Example_CallBack

; call back function
Func _UpdateStatusBarClock($hWnd, $iMsg, $iIDTimer, $iTime)
    #forceref $hWnd, $iMsg, $iIDTimer, $iTime
    _GUICtrlStatusBar_SetText($g_hStatus, @TAB & @TAB & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC) & "  ", 2) ; <--- adjust to show the clock prettier
EndFunc   ;==>_UpdateStatusBarClock

; call back function
Func _UpdateProgressBar($hWnd, $iMsg, $iIDTimer, $iTime)
    #forceref $hWnd, $iMsg, $iIDTimer, $iTime
    $g_iPercent += 5 * $g_iDirection
    GUICtrlSetData($g_idProgress, $g_iPercent)
    If $g_iPercent = 100 Or $g_iPercent = 0 Then $g_iDirection *= -1
    If $g_iPercent = 100 Then
        GUICtrlSetColor($g_idProgress, 0xff0000)
    ElseIf $g_iPercent = 0 Then
        GUICtrlSetColor($g_idProgress, 0x0000ff)
    EndIf
EndFunc   ;==>_UpdateProgressBar

; Write a line to the memo control
Func MemoWrite($sMessage)
    GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite

 

..I added notes to the code where I made changes.

Edited by argumentum

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

  • 5 months later...

More of a peeve than anything else; I'd describe this as Melba probably would - a lesson for the student.

The function correctly states that it returns either a string or an array:
_GUICtrlListView_GetSelectedIndices()

And this function correctly states that it accepts an input type of Integer (as the required parameter is formatted as $iIndex):
_GUICtrlListView_GetItemText()

It took me an embarassing amount of time to realise that the returned string from the GetSelectedIndices() needs to be converted to a number before it can be used in GetItemText()

Example to demonstrate.

#include <GuiListView.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $sString = ""

$hGui = GUICreate('Test', 150, 200)
$hListView = GUICtrlCreateListView("1|2", 10, 10, 130, 123)
$hButton1 = GUICtrlCreateButton("1", 10, 135)
$hButton2 = GUICtrlCreateButton("2", 10, 165)

For $i = 1 To 5
    GUICtrlCreateListViewItem("a|b", $hListView)
Next

GUISetState()

While True
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $hButton1
            $sString = ""
            $iSelected = _GUICtrlListView_GetSelectedIndices($hListView)
            If $iSelected = "" Then
                MsgBox(0, "Error", "You must select something", 0, $hGui)
                ContinueLoop
            EndIf
            $sString = _GUICtrlListView_GetItemText($hListView, $iSelected)
            ConsoleWrite($sString & @CRLF)
        Case $hButton2
            $sString = ""
            $iSelected = _GUICtrlListView_GetSelectedIndices($hListView)
            If $iSelected = "" Then
                MsgBox(0, "Error", "You must select something", 0, $hGui)
                ContinueLoop
            EndIf
            $sString = _GUICtrlListView_GetItemText($hListView, Number($iSelected))
            ConsoleWrite($sString & @CRLF)
    EndSwitch
WEnd

Imo this something that the help file should inform the user about, what you say?

Link to comment
Share on other sites

Why? _GUICtrlListView_GetItemText() clearly states that the index is expected in integer format.
You choose to obtain selected index (or indices) as string, thus it's your responsability to perform the conversion.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

I don't think it's a big bother in itself; it's just the inconsistency across functions. There are other functions which state that they require an integer, but if you feed them a string, the function does the conversion (or the function doesn't fail at least). ArrayColDelete comes to mind. 

I guess if a user doesn't know which functions will automatically convert datatypes, the lesson is to always convert yourself.

Link to comment
Share on other sites

Observe that the function mention Indices (a plural). When more than one item index are selected, the string returned contains a series on numeric indices separated by |. It's up to you the user to decide which index to feed to other functions, so you have to extract the index you want (each in turn if needed) and perform the conversion.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

  • 10 months later...
1 hour ago, Skysnake said:

Request for inclusion of an additional example:

I used this

ChrW ( 0xA0 ) ; hex for non-breaking space

 

Maybe it would be more enlightning to examplify a codepoint which is <= 0xFF in Windows Occidental codepage but >= 0x100 in Unicode.
The first example of such is the Euro symbol:

MsgBox(0, "", "Today 1 " & Chr(0x80) & " = 2 " & ChrW(0x20AC))

Because AutoIt strings are using [a subset of] Unicode, Chr(0x80) is interpreted as that value in the Windows codepage (Occidental for me) and internally converted to its Unicode counterpart to be stored as string. We then concat the actual Unicode codepoint to show what happens.

Meanwhile it immediately doubles the savings of users who actually read to the help file!

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Correct and by the way we can thusly point out the implied conversion which occurs with Chr(), with no additional cost.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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