#192755 - 2009-03-0909:21 PMRe: check if program is running
[Re: jeff_eisenberg]
Glenn BarnasGlenn Barnas KiX Supporter
Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
You neglected to load the UDF. You need to find the EnumProcess UDF, download it, and either paste it into your script or save it in a separate file and dynamically load it with Call 'somepath\enumprocess.udf'
Then things should work better.
Glenn
_________________________ Actually I am a Rocket Scientist!
#192757 - 2009-03-0910:25 PMRe: check if program is running
[Re: jeff_eisenberg]
Glenn BarnasGlenn Barnas KiX Supporter
Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
I'd say "grab them from my web site where they're indexed", but the web server seems to be down. Will be another hour before I can get there to see what's going on. In the mean time, here are two UDFs I have in my library:
And..
_________________________ Actually I am a Rocket Scientist!
I'm calling your script, Call "WMIProcessList.KIX" in my script. That seems to run fine. But when I run the two lines above I get the line 132 in WMIProcessList.kix expected ')'
#192762 - 2009-03-1012:01 AMRe: check if program is running
[Re: jeff_eisenberg]
Glenn BarnasGlenn Barnas KiX Supporter
Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Jeff,
Doh! I was rushing to get out the door.. the first UDF has a dependency on the TimeDiff UDF.
My web site's back up - you can grab the latest copy of TimeDiff from there - Resources / Kix Function Library. Insert that in your script and you should be fine.
Glenn
_________________________ Actually I am a Rocket Scientist!
#192764 - 2009-03-1003:37 AMRe: check if program is running
[Re: Glenn Barnas]
Glenn BarnasGlenn Barnas KiX Supporter
Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
BTW, Jeff..
The UDFs that are published here have a pretty standardized header - sort of a mini-manual for the function. The important thing (which I overlooked today) is the Dependencies list, which identifies special needs of the UDF, whether they be other UDFs, external programs, or even DLLs needing to be registered.
Regarding your error message, try this:
Code:
$Val = BadFunc()
'Val is ' $Val ?
Then try
Code:
$Val = BadFunc('SomeData')
'Val is ' $Val ?
Do you see what's happening? The result is that "BadFunc" is treated as an unquoted string and simply stored in the variable. The parenthesis are used to group what is now either nothing (ex 1) or a string (ex 2), which is simply displayed on the console. This is a simple example to illustrate the result of a missing UDF... your earlier problem had a much more complex syntax, and I'd wager that things were fine until the interpreter encountered the comma and thought "hey! what's this doing here, and where is the ')' to close the opening '(' from back there?"... of course, what it thought was different from what it said - "line 132 expected')'". You can prove this logic by supplying a second arg to BadFunc in example 2.
I don't know your kix or scripting experience, but this is a fairly common mistake that many can learn from.. I often give my class a page full of bad commands so they can recognize what's wrong from the often cryptic messages.
Glenn
_________________________ Actually I am a Rocket Scientist!
one more thing, there is a thing called "search" in the board menu. if you say "enumprocess" you will get to the udf. if you look in to google with "enumprocess()", it's the 4th hit. if you search for "enumprocess udf", it's the first.
so not really sure you even looked around.
also, enumprocess() is able to kill the process as well, so you would get 2 of those above functions in one
Actually, I looked I just didn't realize that that fucntion was what I needed to use. Now it working using the short simple piece of code. I'm new at this so I catch on a littel slow.
I thought that was an example or somehting, not the code you need to use. I'm up and running now. I didn't realize it was that simple.