Globals are a very bad idea, and should be avoided unless absolutely necessary, which in this case they are not.
Why not pass $exeDir as an optional parameter:
Code:
Function ALLHKU ($ALLHKUKeyname, $ALLHKUEntry, $ALLHKUExpression, $ALLHKUDatatype, $ALLHKUDefault, $ALLHKUDeleteLog,Optional $exeDir)
If Not $exedir
$ExeDir=@SCRIPTDIR
EndIf
...
If you really must use a global, then you should still declare it:
Code:
If Not IsDeclared($exeDir)
Global $exeDir
EndIf
This will allow your code to be used by people (like me) who use SetOption("Explicit","ON") in our scripts.
Not embedding variables is good practice. If you must embed variables then you can ensure that your function continues to work with people (like me) who use SetOption("NoVarsInStrings","ON") add the following to the top of your script to save the setting:
Code:
Dim $sNoVarsInStrings
$sNoVarsInStrings=SetOption("NoVarsInStrings","OFF")
At the end of your script just before you exit, restore the setting with:
Code:
$rc=SetOption("NoVarsInStrings",$sNoVarsInStrings)
Now, no-one is going to come round and knee-cap you (or even sue you) if you don't make these changes.
We ask for them becuase it will make your function portable, generic and give it a professional finish. It will mean that anyone can cut'n'paste your function into their own script and know that it will work first time with no odd side effects.