The Miscellaneous commands in Python start and stop other processes that are not named in other command groups.
Note: These commands are not available for Custom Statistics or Device Profiles. |
See Python™ commands for other commands you can use with GainSeeker.
Syntax |
Example |
Description/Remarks |
New or changed in GainSeeker version |
myvar1 = 345 misc.executescript("Show Result form") myvar2 = "abc" Sets a variable, runs the GainSeeker Inspections Module script named "Show Result form", and then sets another variable. |
Executes a Python script. The script being called ("scriptname") must exist in the GainSeeker Inspections module. This can take the place of copying and pasting the same code into multiple scripts, and changes to that code only need to happen in one script. All variables, effects, etc. carry back into the parent script. |
8.7 |
|
misc.parsecolumn(input, index, spliton="character(s)", isnumeric=True, noempty=False) |
print misc.parsecolumn("Part#; Feature1; USpec; LSpec; Value1; A-50RB; Length; ; ; 0.503", 9, "; ", True, False) Returns 0.503 as a number. |
Splits the input into columns based on the character(s) specified by spliton. Returns the value for the specified column index returned by the split. Columns are zero based. If isnumeric is True, the value to be returned should be a number. If noempty is True, empty columns are automatically removed and are not counted for the column index. |
|
misc.restart() |
misc.restart() |
Restarts the Python script from the beginning. |
|
misc.run(target, waitforexit) |
misc.run("C:\\temp\\sample.xlsx", True) Uses the Windows default application for files with the .xlsx extension (such as Microsoft Excel) to open C:\temp\sample.xlsx . Halts further script execution until the specified file (C:\temp\sample.xlsx) is closed. |
Runs the specified application. If the file is not an executable, the default application for opening that file is launched. If waitforexit is True, the script halts until the application closes. |
|
misc.run("C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\EXCEL.EXE", True, "/x /e") Launches Microsoft Excel from the specified folder, with arguments /x and /e . Halts further script execution until the specified file (EXCEL.EXE) is closed. |
Runs the specified application. If the file is not an executable, the default application for opening that file is launched. If waitforexit is True, the script halts until the application closes. You can specify command line arguments for the application when it launches. |
|
|
misc.stop() |
misc.stop() |
Stops the execution of the Python script. |
|
To fully refresh a Dynamic Desktop, it is necessary to close the current charts and re-open the desktop. When chart display is unattended (e.g., using a large screen to display charts as a Slideshow), another approach is required.
This script terminates the currently-running GainSeeker Charts module and then launches it again with command line parameters to log in and open the desktop.
You could create a Windows Scheduled Task that launches the GSConsole module and runs this script.
import time
import os
while True:
# taskkill - https://technet.microsoft.com/en-us/library/bb491009.aspx
os.system("taskkill /f /im GSCharts.exe")
misc.run("GSCharts.exe", False, "OpenType=0 Open=DesktopName UserName=\"SPC Manager\"")
# time.sleep takes number of seconds - 30 mins is 60 * 30 = 1800
time.sleep(1800)