Sign in to follow this  
Followers 0
Alupis

little confused on passing arrays to functions

18 posts in this topic

I'm a little confused on the best practice of passing data to functions from functions. Basically I have a large script that starts with a set of data it reads from a text file and then manipulates the data several times... during the script the array formed from the text file data gets passed down from function to function. I do this so that each function can work with the already-properly-formated data instead of having to reformat the original text file data into a new array every time a new function runs.

Basically my question is how is it best to do this? Currently I have at the end of a function a line that calls the next function and uses the same array... then in the next function the first line i use a ByRef with the same array.

So kind-of like this:

Func somefunction()
     $array = some_data
     stuff_happens_here
     next_function($array)
EndFunc
Func next_function(ByRef $array)
     stuff_happens_here
     3rd_function($array)
EndFunc
Func 3rd_function(ByRef $array)
     stuff_happens_here
EndFunc
somefunction()

from reading the ByRef help guide, it looks like simply using the ByRef would make the function use the same array since it has already been set. I do not declare this array as a GLOBAL or contast or variable except within the first function... so am I correct in thinking that i still have to call the function with the array (like this: next_function($array)...) as well as using the ByRef?

Thanks for the clarification!

Share this post


Link to post
Share on other sites



Alupis,

As long as you only want to read the array within somefunction() you are fine as you are:

somefunction()

Func somefunction()
    Local $array[2] = [0, 0]
    _next_function($array)
    ConsoleWrite($array[0] & " - " & $array[1] & @CRLF)
EndFunc   ;==>somefunction

Func _next_function(ByRef $array)
    $array[0] = 1
    _3rd_function($array)
EndFunc   ;==>_next_function

Func _3rd_function(ByRef $array)
    $array[1] = 1
EndFunc   ;==>_3rd_function

If you ever want to access the array outside that function then you will need to declare it as Global (preferably at the start of the script). All clear? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

If it is declared globally, then it is not necessary to use byref, but it should still work.

Personally I somewhat avoid using globals, just because I think it makes it harder to troubleshoot the script.

Share this post


Link to post
Share on other sites

If it is declared globally, then it is not necessary to use byref, but it should still work.

This unfortunately isn't true. If you use the name of a global array as the parameter of a function, and don't use ByRef, that array is declared local automatically and doesn't affect the Global array.

This script demonstrates what I mean

#include <_array.au3>
Local $array[2] = [0, 0]
somefunction()
    ConsoleWrite("Global $array = " & $array[0] & " - " & $array[1] & @CRLF)

Func somefunction()
    _next_function($array) ; Global array being sent as parameter to the next function
    ConsoleWrite("somefunction  = "& $array[0] & " - " & $array[1] & @CRLF) ; Still using global array
EndFunc   ;==>somefunction

Func _next_function($array) ; declares $array as local
    $array[0] = 1
    ConsoleWrite("_next_function = " & $array[0] & " - " & $array[1] & @CRLF)
    _3rd_function($array) ; sends altered local $array as parameter to 3rd function
    ConsoleWrite("After running _3rd_function = " & $array[0] & " - " & $array[1] & @CRLF) ; you'll notice that $array hasn't changed after running 3rd
EndFunc   ;==>_next_function

Func _3rd_function($array)
    $array[1] = 1
    ConsoleWrite("_3rd_function = "&$array[0] & " - " & $array[1] & @CRLF) ; local $array
EndFunc   ;==>_3rd_function

You'll notice that the $array that's being passed around isn't received "byref" so it only alters the local copy 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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Alupis,

As long as you only want to read the array within somefunction() you are fine as you are:

somefunction()

Func somefunction()
    Local $array[2] = [0, 0]
    _next_function($array)
    ConsoleWrite($array[0] & " - " & $array[1] & @CRLF)
EndFunc   ;==>somefunction

Func _next_function(ByRef $array)
    $array[0] = 1
    _3rd_function($array)
EndFunc   ;==>_next_function

Func _3rd_function(ByRef $array)
    $array[1] = 1
EndFunc   ;==>_3rd_function

If you ever want to access the array outside that function then you will need to declare it as Global (preferably at the start of the script). All clear? :)

M23

hmm... actually i think you confused me a little bit more... lol

in your sample script i can see that you use the the $array in _some_function() but then you pass it to the next function by calling "_next_function($array)" and then at the start of "_next_function" you use "_next_function(ByRef $array)... whcih is pretty much exactly how i wrote my sample script... isn't it?

if so, then it seems in order to pass the same array to the next function so it can work wiht it, i would need to call the function using the array (like this: _next_function($array)... ) and then start my "_next_function" with a ByRef of $array.

Sorry guys... i'm not a programmer... my script works as-is... just trying to "clean" it up a bit to reduce the massive task of debugging when something goes wrong. i wrote it back when i understood even less than i do now (thats not saying much lol). its about 800ish lines of stuff, but i know its not optimal...

EDIT: let me just add that i'm not really key on using GLOBAL variables... i have several variables currently but all are just written without any "LOCAL" or "GLOBAL" tags... so i guess they are open to being manipulated by teh script... which is fine with me.

Edited by Alupis

Share this post


Link to post
Share on other sites

Alupis,

The example was to show that using ByRef means that the array [0, 0] was changed by the functions into [1, 1] - look in the SciTE lower pane to see the result. :)

Passing a parameter ByRef means that you use the same variable in both functions - you need the ByRef keyword in the function declaration to tell AutoIt that it what you want as it cannot read your mind! ;)

If you do not use ByRef in the function declaration then the function uses a copy of the parameter which is lost when you end the function, while the original remains unchanged. This example shows that you do NOT change the original function if you omit the ByRef keyword:

somefunction()

Func somefunction()
    Local $array[2] = [0, 0]
    _next_function($array)
    ConsoleWrite($array[0] & " - " & $array[1] & @CRLF)
EndFunc   ;==>somefunction

Func _next_function($array)
    $array[0] = 1
    _3rd_function($array)
EndFunc   ;==>_next_function

Func _3rd_function($array)
    $array[1] = 1
EndFunc   ;==>_3rd_function

Any clearer now? ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Alupis,

The example was to show that using ByRef means that the array [0, 0] was changed by the functions into [1, 1] - look in the SciTE lower pane to see the result. :)

Passing a parameter ByRef means that you use the same variable in both functions - you need the ByRef keyword in the function declaration to tell AutoIt that it what you want as it cannot read your mind! ;)

If you do not use ByRef in the function declaration then the function uses a copy of the parameter which is lost when you end the function, while the original remains unchanged. This example shows that you do NOT change the original function if you omit the ByRef keyword:

somefunction()

Func somefunction()
    Local $array[2] = [0, 0]
    _next_function($array)
    ConsoleWrite($array[0] & " - " & $array[1] & @CRLF)
EndFunc   ;==>somefunction

Func _next_function($array)
    $array[0] = 1
    _3rd_function($array)
EndFunc   ;==>_next_function

Func _3rd_function($array)
    $array[1] = 1
EndFunc   ;==>_3rd_function

Any clearer now? ;)

M23

oh ok... I think you made that a lot clearer... thanks!

So if i'm understanding you correctly... if i dont' ByRef the array in the function declaration (like:

Func _some_function(ByRef $array)
) , then the "_some_function()" function will work with the original array, and any changes to that array this function makes will be lost once the function ends? This of course assumes i set the function delcaration to be
Func _some_function($array)
instead of using the ByRef.

Ok... so this sums up part of my question... i think... lol

the other part is having to do with calling functions from within another function... do i still need to call functions including the $array variable? or is ByRef enough?

for example...

Func _some_function($array)
     stuff_happens_here
     _next_function($array)
EndFunc
Func _next_function(ByRef $array)
     stuff_happens_here
EndFunc

or is this good enough:

Func _some_function($array)
     stuff_happens_here
     _next_function()
EndFunc
Func _next_function(ByRef $array)
     stuff_happens_here
EndFunc

or how about:

Func _some_function($array)
     stuff_happens_here
     _next_function($array)
EndFunc
Func _next_function()
     stuff_happens_here
EndFunc

my assumption is the first example works with the $array since its part of the function declaration... the "stuff_happens_here" section works with the array data, and then sends this current version of the $array (the manipulated version) to the _next_function(). Then the ByRef in the _next_function() basically tells it to use that same $array that it was just passed at the end of the first function? this doens't sound correct now that i'm thinking about it... is this right?

my assumption on the second example is the _some_function works with the $array, then runs the _next_function() which woudl use the ByRef to refrence the original $array... meaning it would not be working with the manipulated data the _some_function() had changed... essentially as M23 stated... the _some_function() would loose its changes after the function ended... is this right?

my assumtion on the third example is the _some_function works with the $array and then runs the_next_function() using the $array .. meaning the _next_function() would work with the array after the _some_function had manipulated the data or whatever... is htis right?

thanks guys!

Edited by Alupis

Share this post


Link to post
Share on other sites

I would suggest looking at the code I posted above and second running some of your scripts you have questions about before posting here for answers.

This code won't even run due to syntax errors, which you could have seen for yourself rather than asking about whether it would work or not. There's a line that goes "Give a man a fish he eats for a day, teach a man to fish he eats for a lifetime". Being self-taught will teach your how to fish for yourself.

Func _some_function($array)
     ;stuff_happens_here
     _next_function();<<<<<<<<<<<<< syntax errors
EndFunc
Func _next_function(ByRef $array)
     stuff_happens_here
EndFunc

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

Share this post


Link to post
Share on other sites

I would suggest looking at the code I posted above and second running some of your scripts you have questions about before posting here for answers.

This code won't even run due to syntax errors, which you could have seen for yourself rather than asking about whether it would work or not. There's a line that goes "Give a man a fish he eats for a day, teach a man to fish he eats for a lifetime". Being self-taught will teach your how to fish for yourself.

Func _some_function($array)
     ;stuff_happens_here
     _next_function();<<<<<<<<<<<<< syntax errors
EndFunc
Func _next_function(ByRef $array)
     stuff_happens_here
EndFunc

thanks for the snooty response BrewMan... I am trying to learn, and i do realize that the sample functions i wrote were not perfect and wouldn't run correctly in a real script... they were just samples so i can understand the behavior of how these lines will be interpreted by autoit. Yes... I could put these into autoit and it would freak out and give me errors... but that does absolutely nothing for my understanding of why this is incorrect. If you dont have anything helpful to post, please dont post... I take offense to your response quite frankly as it implies i'm an idiot.

If anyone else has something helpful to post, please do. I'm trying to understand how these lines get interpreted by autoit so i can understand their behaviors correclty instead of just assuming i know.

Thanks in advance.

Share this post


Link to post
Share on other sites

Alupis,

BrewManNH has a point - if you post any old code snippet asking if it works without even having checked it for errors yourself, you are very likely to find that the more experienced members will ignore your post and you will rapidly get no sensible answers. If, on the other hand, you show some initiative you will get more help than you could imagine. So, stop assuming and start trying things out for yourself. ;)

As to your questions above, of course you need to pass the array as a parameter to the new function and have a parameter (possibly with ByRef) in the new fuction definition - how else is the new function supposed to know what to use for its operations? :)

M23

P.S. In future please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - we know what we wrote and it just pads the thread unneccesarily. ;)


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Simply put global variables can be accessed from any scope in the script. byref passes a array to a function by memory address well i don't really know but it seems to work the exact same way as '&' in C++. So if you pass byref you can access and modify the array from within the function. And BrewMan is the MAN ok he is one of the people who can help you when you are ready to learn. Provided you don't piss him off ahead of time. Think I'm going to the river to fish. All in all just remember this is a community forum we must think how we appear to others. You may need to add salt to everything to not be offended by what other people say. I enjoy programming and helping others. Good luck!

Edited by Xandy

I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

Share this post


Link to post
Share on other sites

thanks for the info guys.

Seriously though... I posted my sample scripts and questions because I Am Trying To Learn. Running sample scripts does absolutely nothing other than tell me what wont work correctly (or as expected) and what will. It does absolutely nothing for understanding WHY it does not work or WHY it does work. This is what i'm trying to get a grasp on... to me, all three of my sample scripts looks like they would work... so i'm trying to understand why they might not, or what is the best practice or what the nuances are to the 3 ways of writting the same function.

I do run a lot of test script to help myself learn... my current script that prompted this thread actually is using ALL 3 of my sample-like scripts above, and I get my expected results... I have NO IDEA why though because as BewMan pointed out one of my sample functions sholdn't even run.

BrewMan might be the "Man", but that was a rather terrible way to help someone learn. Instead, he coudl have just skipped over my newby-like thread and not posted anything at all.... makes me wonder how many of his 2,403 posts are similar to his response in my thread... as in not helpful, condesending and downright rude... just to pad his posting stats. Responses like his are what hurts communities like this and makes it difficult for newcomers to learn and get aquainted. I am not a newbie to forums guys, just a newbie to programming/scripting... something a community like the AutoIt forums should be embracing and helping (like most of your are in this thread... thank you).

Now that BrewMan has gotten this thread way off track... can someone please provide me with a basic explanation as to why each of my samples script will or will not work? I'm looking for the WHY's, not the "it just wont work". Or at least link me to a thread or site that has some more information... i've done searches online and haven't come up with anything concrete. As you programmers already know... there is a million and one ways to do anything when it comes to scripting/programming, so my searches all return stuff that isn't relevant or doesn't fully answer the information i'm trying to learn.

Share this post


Link to post
Share on other sites

Alupis,

First off, stop criticizing BrewManNH - he has helped more people than you can imagine and, as I pointed out, had a valid point. If you do not check your own code for basic errors then why should we? :)

If you say you did not get errors with those 3 snippets then I suggest you download and install the enhanced version of SciTE4AutoIt3 that you can find here - among other things it tells you where the obvious syntax errors are in your script. ;)

Now let us look at the 3 snippets and I will add comments explaining what is going on:

; This function has been passed an array as a parameter and has made a copy of it which it will use
Func _some_function($array)
    stuff_happens_here
   ; Another function is now called with the amended array passed as a parameter
    _next_function($array)
   ; This function has now ended and the array will be discarded
EndFunc

; This function has been passed an array as a parameter ByRef and sp will operate on the original array
Func _next_function(ByRef $array)
    stuff_happens_here
    ; Thsi function has now ended and the array still exists in the parent function that passed it ByRef
EndFunc

; This function has been passed an array as a parameter and has made a copy of it which it will use
Func _some_function($array)
     stuff_happens_here
     ; Another function is now called with no parameters
     _next_function()
EndFunc

; This function is expecting a parameter
; Autoit will throw an error because the calling line above did not pass one and there is no default value
Func _next_function(ByRef $array)
    ;stuff_happens_here
EndFunc

; This function has been passed an array as a parameter and has made a copy of it which it will use
Func _some_function($array)
     stuff_happens_here
    ; Another function is now called with the amended array passed as a parameter
     _next_function($array)
EndFunc

; This function is not expecting a parameter
; Autoit will throw an error because the calling line above passed one
Func _next_function()
    ;stuff_happens_here
EndFunc

Have you got it now? ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

M23 - thank you extremely... this is precisely the explanation i've been trying to get. I now KNOW WHY these will or will not work, instead of just "assuming" what will and what wont.... I have now LEARNED the WHY's behind this. I was also not aware of an "Advanced Version" of SCitE, so thank you for this as well. I'm sure it will prove useful in debugging new code or existing code i write... but from the sound of it, it still will not provide teh "WHY" that someone who is learning desperately needs.... whcih is why we have forum communities... no?

Anyways, M23... Thank you.

I will criticize anyone who is blantantly trolling. I have never had contact with BewMan before and this being his first interation with me... it did not leave a very good taste in my mouth. BewMan might be a great guy and a great forums helper, but postings like his ARE NOT HELPFUL IN THE SLIGHTEST. It discourages new comers and shuns those who dare ask questions with the intention to learn.

As you mentioned, you have to "take the initiative" in order to learn... I took teh initiative by writing the damn script... now i'm trying to learn why it works and why certain things wont work and why some ways of doing things are better than others. I can contnue writting scripts the way i have been... trying things until they get whatever result i'm expecting... but I dont need to tell you that this is not ideal... not only does it leave possibility for things to go wrong later (due to a wrongly written section or whatever), but it reinforces writting scripts and code THE WRONG WAY... i dont want to learn the wrong way... so asking questions and doing research is the only way to learn correctly.

I will repeat just in case BewMan reads this thread again... please don't post condescending or rude resposnes, it makes you look like a dick, makes question asker feel pissed, and in the end, the question never gets answerd, there fore the original poster does not learn, and hencly will not be able to contribute back into the forums community. You may not be aware, but a lot of people don't have the same intimate knowledge of programming/scripting as you do, and therefore sometimes will ask questions that seem "stupid" to you because you already know the answer. In the event you run accross another thread in which you feel the question is stupid, DON"T POST!

That is all. Thank you for those who are helpful, you are the ones that keep forum communities alive.

Edited by Alupis

Share this post


Link to post
Share on other sites

Alupis,

I told you to stop criticizing BrewManNH - that is the third time you have done it in this thread. If you have a problem with another member then tell a Mod - do NOT get involved in flaming matches. And in case you did not notice I am a Mod and I told you to stop. One more peep out of you on this matter and you will earn yourself a holiday from the forum - do I make myself clear: :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

I wasn't going to post this, I honestly wasn't, until the latest tirade from an obviously butt hurt poster.

thanks for the snooty response BrewMan...

You're welcome.

I am trying to learn,

Then maybe you should actually try and learn rather than asking to be spoon fed answers.

and i do realize that the sample functions i wrote were not perfect and wouldn't run correctly in a real script... they were just samples so i can understand the behavior of how these lines will be interpreted by autoit.

Really? If so, why did you post them asking if they'd work or not? Asking if they'd work but knowing that they don't implies, to me at least, that you can't be bothered to put in the time to test these out first and find out why they might not work. You'd rather have someone else tell you why they won't work so you don't have to do the legwork needed.

Yes... I could put these into autoit and it would freak out and give me errors... but that does absolutely nothing for my understanding of why this is incorrect.

Sometimes the error messages received from AU3Check aren't crystal clear, but if you don't understand the error messages you could have run them and then asked for clarification as to what they mean. You took the easy route and just posted looking to be given the answers without doing the work.

If you dont have anything helpful to post, please dont post... I take offense to your response quite frankly as it implies i'm an idiot.

Your offense is noted, ignored, but noted.

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

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

it has become pretty apparent that some of the users on this forums are hostile to those who are not as familiar with programming as others. My question I originally asked never warranted the response you provided BewMan. You could have just skipped over. I'm trying to learn. Simply knowing what lines of code autoit likes and doens't like doesn't provide a platform to learn on... instead it just provides a base knowledge of what "i personally have attempted to do and didn't work or did work"... given that a lot of scripting/programming can be conditional, a line of code that "works" could work 9 times out of 10, but becaue it is written poorly, the 10th time it could be wrong and return wrong results... since the script in this hypethetical situation has worked 9 times out of 10, I would not know where to beging debugging (this is if I even noticed the incorrect results). Yes, I'm "butt hurt" about this because I feel that you did not want me to learn and that my question was less-than worthy of being posted on this community forums.

@M23 - yes i've noticed you are a Mod. Not sure why you are changing your tone on me here, if anythign as a Mod i would think you would have my back over something like this , I'm not flamming, i'm stating what I see. I came here to learn, and instead got shunned by a bad posting. If I can't learn, I can't contribute back into the community. Please lock this thread, I want to prevent anymore "flaming matches" over my question. I'm sorry I tried to learn, sorry I tried to understand autoit better, and sorry to have wasted forum resources over what I though was important to know and what may have helped future visitors whith the same clarification questions.

Edited by Alupis

Share this post


Link to post
Share on other sites

Alupis,

I am locking this thread because I want to - not because you asked me to. I to make that quite clear. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0