Contributions
check if process is running script
Hello, I have a problem with the following vb script. If (Sys.Process("x").Exists) Then do A ElseIf (Not Sys.Process("x").Exists) Then do B Else do C End If When I run this script when process x is NOT running, it "does B" successfully, but still outputs 2 errors into the log saying that it could not find process x when executing the first if statement, and that it could not find x when executing the elseif either. I do not want to see any errors. I want to perform the action "do A" if the process is running, and "do B" if the process is not running. What am I doing wrong?16KViews0likes1CommentUsing script variables in keyword tests
Hi there folks, I am trying to call a script variable for use as a keyword test value. The script variable holds the location of the current users desktop, and looks like .... function desktopPath() { try { var wshShell = Sys.OleObject("WScript.Shell"); var desktopPath = (wshShell.ExpandEnvironmentStrings("%USERPROFILE%\\Desktop")); Log.Message(desktopPath); } catch(exception) { Log.Error("Exception", exception.description); } } I am trying to use "desktopPath" variable as the value of a step in my keyword test which saves a file. I want to be able to re-use this "desktopPath" variable throughout my keyword test so that the need to hardcode filepaths is removed. I am aware that I could simply use a regular test variable and put the path in there, but the special folder %USERPROFILE% does not work there. The use of %USERPROFILE% is crucial so that my keyword tests will work which ever system or user profile they are run on. Hope that all makes sense, thanks.11KViews0likes3Comments