Jump to content

Odd AU3Check error.


MvGulik
 Share

Recommended Posts

You can use a "_Adlib_timer(111)" call after a "AdlibRegister('_Adlib_timer')".

But you can't use a "_Adlib_timer(111)" call before using the "AdlibRegister('_Adlib_timer')"

Odd ... O well.

#AutoIt3Wrapper_Run_Au3Check=y
#AutoIt3Wrapper_Au3Check_Stop_OnWarning=y
;~ #AutoIt3Wrapper_AU3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
_Adlib_timer(111) ;; triggers AU3Check errors.
AdlibRegister('_Adlib_timer')
;~ _Adlib_timer(111) ;; not triggering AU3Check errors.
AdlibUnRegister('_Adlib_timer')
Func _Adlib_timer($parm1 = 1)
#forceref $parm1
EndFunc

#cs
>Running AU3Check (1.54.19.0)  from:C:\...\AutoIt3 || >Running AU3Check (1.54.22.0)  from:C:\...\AutoIt3\beta
D:\...\TEST.au3(5,29) : ERROR: _Adlib_timer() called with wrong number of args.
AdlibRegister('_Adlib_timer')
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\...\TEST.au3(4,17) : REF: definition of _Adlib_timer().
_Adlib_timer(111)
~~~~~~~~~~~~~~~~^
D:\...\TEST.au3(7,31) : ERROR: _Adlib_timer() called with wrong number of args.
AdlibUnRegister('_Adlib_timer')
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\...\TEST.au3(4,17) : REF: definition of _Adlib_timer().
_Adlib_timer(111)
~~~~~~~~~~~~~~~~^
D:\...\TEST.au3 - 2 error(s), 0 warning(s)
!>11:03:19 AU3Check ended.rc:2
#ce

(posting this resolve it for me.)

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

Adlib functions can't have parameters, which I think might be the problem here.

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

Think your statement is ambiguous.

- The Adlib-Register part can't have any function parameter.

The function definition itself can have parameter. (That the parameters of a function are not used when a function is called by a Adlib-call (or other callbacks) is something else.)

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

I started a topic on this not long ago in regards to an OnEvent function with parameters which was throwing errors because of it. Yes it will work with a function with parameters, but you will get error messages from AU3Check because of 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!

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

Erm ... yea.

From Au3Check (code) point of view it probably makes perfect sens.

But that don't changes the fact that from AutoIt's point of view its legit code.

Lets leave it at that.

Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

The fact is, if you have an Adlib or OnEvent function with parameters, those parameters can't be used in the function, so they're basically just errors waiting to happen. You'll get an undeclared variable error if you try to use it, and if you try to declare it in the function you'll be told it's already declared. I think that AU3Check telling you that you made a mistake in your code is a good indication that you made a mistake somewhere in your code in this instance.

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

  • Moderators

Hi,

I am sure you all realise this, but if you want to use the same function in an Adlib and called direct from the script without causing Au3Check to throw a fit, you can do it by using a wrapper function like this: :D

_Adlib_timer_Basic(111) ; Call the basic function

AdlibRegister('_Adlib_timer', 1000) ; Call the wrapper function

$iBegin = TimerInit()
Do
    Sleep(10)
Until TimerDiff($iBegin) > 5000

AdlibUnRegister('_Adlib_timer')

; Wrapper function - no parameters
Func _Adlib_timer()
    _Adlib_timer_Basic()
EndFunc

; Basic function - with parameters
Func _Adlib_timer_Basic($parm1 = 1)
    ; Here is your function
    ConsoleWrite(@SEC & " - " & $parm1 & @CRLF)
EndFunc

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:

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

That's what I did when I found out about the parameter issue, used another function for the OnEvent function that calls the main function.

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

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...