Arthur Jay Posted March 24, 2006 Share Posted March 24, 2006 Can you write sub-routines in this language? If so, where can I learn how to do so? Arthur jay Link to comment Share on other sites More sharing options...
GaryFrost Posted March 24, 2006 Share Posted March 24, 2006 (edited) Can you write sub-routines in this language? If so, where can I learn how to do so?Arthur jayLook up Function in the help file Edited March 24, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
blindwig Posted March 24, 2006 Share Posted March 24, 2006 Can you write sub-routines in this language? If so, where can I learn how to do so?Arthur jayNo, AutoIt does not allow functions in the local scope - all functions are global. My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
Arthur Jay Posted March 24, 2006 Author Share Posted March 24, 2006 Look up Function in the help fileSo I went to Function Reference and found no reference to sub-routine. I searched for "function" and got 391 hits. Can you be more specific? Link to comment Share on other sites More sharing options...
GaryFrost Posted March 24, 2006 Share Posted March 24, 2006 So I went to Function Reference and found no reference to sub-routine. I searched for "function" and got 391 hits. Can you be more specific?some languages use the term sub-routine, some use the term functionAutoIt has Functions SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Developers Jos Posted March 24, 2006 Developers Share Posted March 24, 2006 So I went to Function Reference and found no reference to sub-routine. I searched for "function" and got 391 hits. Can you be more specific?Keyword: Func...EndFunc 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 More sharing options...
Arthur Jay Posted March 24, 2006 Author Share Posted March 24, 2006 some languages use the term sub-routine, some use the term functionAutoIt has FunctionsOK, call them whatever you want. What I need to do is execute a specific bunch of functions that produce a desired result. Typically, in a main program you set some parameters, call the sub-routine to operate as needed, then use that result in the subsequent steps in the main program. It saves having to repeat lines of code that do repetitive work.Now, can this language do that?Arthur Jay Link to comment Share on other sites More sharing options...
billmez Posted March 24, 2006 Share Posted March 24, 2006 OK, call them whatever you want. What I need to do is execute a specific bunch of functions that produce a desired result. Typically, in a main program you set some parameters, call the sub-routine to operate as needed, then use that result in the subsequent steps in the main program. It saves having to repeat lines of code that do repetitive work.Now, can this language do that?Arthur JayHelp -> Index tab -> func Link to comment Share on other sites More sharing options...
Developers Jos Posted March 24, 2006 Developers Share Posted March 24, 2006 OK, call them whatever you want. What I need to do is execute a specific bunch of functions that produce a desired result. Typically, in a main program you set some parameters, call the sub-routine to operate as needed, then use that result in the subsequent steps in the main program. It saves having to repeat lines of code that do repetitive work.Now, can this language do that?Arthur JayHow often do you want to get the answer? Func...EndFunc 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 More sharing options...
Gene Posted March 24, 2006 Share Posted March 24, 2006 OK, call them whatever you want. What I need to do is execute a specific bunch of functions that produce a desired result. Typically, in a main program you set some parameters, call the sub-routine to operate as needed, then use that result in the subsequent steps in the main program. It saves having to repeat lines of code that do repetitive work. Now, can this language do that? Arthur Jay As @jpm said, the key words are Func and EndFunc. These two words define a User Defined Function An example is below... Func _EndProgram() If $iErrorFlg > 0 Then Exit $iErrorFlg Else Exit Endif EndFunc ;==>_EndProgram You can call this UDF directly or conditionally. A conditional example follows. If NOT FileExists ($sFile) Then _EndProgram() EndIf Gene Note there are a number of UDFs supplied with AutoIt. In the Help file scroll all the way to the bottom in the left panel. [font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right... Link to comment Share on other sites More sharing options...
Just_Plain_Cool Posted March 25, 2006 Share Posted March 25, 2006 How often do you want to get the answer? Func...EndFuncHmmm...maybe you could write a function to answer the question? It would save the aforementioned repetitive work. JPC Link to comment Share on other sites More sharing options...
Arthur Jay Posted March 25, 2006 Author Share Posted March 25, 2006 Hmmm...maybe you could write a function to answer the question? It would save the aforementioned repetitive work. JPC What's still not clear to me is the flow of the program. In some other languages, you define all the sub-routines first, and then write the main program that calls these as needed. I have written menu-based programs for control of test equipment in which the execution is essentially endless. You just bounce around doing sub-routines until you are through with the day's work. I don't see that type of structure here yet, but I'll keep on trying. I'll have to bear with being a newbie subject to ritual in the process.Arthur Jay Link to comment Share on other sites More sharing options...
billmez Posted March 25, 2006 Share Posted March 25, 2006 Hmmm...maybe you could write a function to answer the question? It would save the aforementioned repetitive work. JPC Good Idea! DIM $AsManyTimesAsItTakes = ???; Your number here DIM $ThresholdForCrap = ???; Your number here $WhatSubRoutine = _WhatFunction() Func _WhatFunction($PFA) If Not $PFA Then For $i = 1 to $AsManyTimesAsItTakes MsgBox(0, "Look Here!", "RTFM - Func") If $i > $ThresholdForCrap Then Return("Threshold For Crap Exceeded") ExitLoop EndIf Next Else $PFA = "Pay Fu??ing Attention" MsgBox(0, "Look Here!", $PFA) EndIf EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now