Jump to content

Return codes -- Function returns ?


Recommended Posts

The Help file talks alot about the function or command RETURNING either a specific name OR a 0 (zero)

How do I see what a function/command returned?

Say I use ProcessExist ("somename")

According to the Help File..

Return Value

Success: Returns the PID of the process.

Failure: Returns 0 if process does not exist.

How do I view this or check it? -- that's the part I can't find in the Help file.

Do I have to assign a variable to the command and then reference the variable, such as

$Var = ProcessExist ("somename")
MsgBox (0, "test", "$Var")

I've used NSIS installer and the Return value is stored in a stack as $0 or $1 -- so you can do a message box display $0 to view the result

~J. Schutzmanwww.alchemistgamer.com

Link to post
Share on other sites

Right here is a function from one of my scripts, it gets the dir size of a folder. The return value is either the file count $aSize[1] or -1 for failure (i.e the Dir does not exist)

To get the information from the function I would use $DirSize = GetCount("C:\MyFolder")

When the function is ran it will set the Var $DirSize to either the file count or -1

Func GetCount($Dir)

If FileExists($Dir) Then

$aSize = DirGetSize($Dir, 1)

Return $aSize[1]

Else

Return -1

EndIf

EndFunc

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...