more then one function in a single file

is it possible to place more then one function in a single file? if so, how to call them? how to pass parameters to them? example please.
i’m just curious, because i usually place only single function inside of one file and it’s getting a bit messy in my repository now.

best regards,

Hello kupix,

Yes, you can put functions together in a script. Simply put them all in the same script, and then call them using this syntax:


Here is a short example:
Main Script (Calling)

//Do Something
FunctionScript.FunctionName "parameter string", parameterVariable
log the result

Called Script

to FunctionName ImageName
click ImageName
put parameterVariable + 1 into CountVariable
return CountVariable
end FunctionName

Also, see attached image for a working example.

Yes, you make a function script or scripts and add it to the suite you are currently working or you can add it to the common suite. You then call these scripts in the “master” that you will run with the “helper” command. Once you run the “master” it will then have all the functions loaded that are needed. This reduces code and time.

Good Luck!

set helperList to { "Script1", "Script2", "Script3", "Script4", "Script5" }

repeat with each helper of helperList
	start using helper
end repeat

^^^put that at the beginning of the “master”…