12-11-2012 07:16 AM
Hello,
i created a OPUI in Cä that loads a testplan and executes it.
But i cant find a function to close an already opened testplan.
Means when i load testplan-1 it executes SeqFileLoad, the oi load tetsplan-2 and it execute SeqFileLoad.
But when i load again testplan-1 then it doesnt execute SeqFileLoad because it is still loaded.
So i am looging for an anload/close command.
Thanks for help
Solved! Go to Solution.
12-12-2012 07:31 PM
#1.
Are you looking to UnLoadAll Modules of a sequence file?
If so try: SequenceFile.UnloadModules
from TS help:
Return Value
Returns True if all modules were successfully unloaded. If any sequences in the file are executing when you call this method, the method returns False.
Purpose
Unloads the code modules from all steps in all sequences of the sequence file.
#2.
If you are looking to close the sequence file then maybe SequenceFileClosing Event can be helpful.
From TS help:
Syntax
ControlName_SequenceFileClosing ( file)
Purpose
Use this event when you need to perform cleanup or otherwise require a notification when the Application Manager control closes a sequence file. This event is generated immediately before the Application Manager control closes the file. The event handler for this event cannot cancel closing the file. Use the ApplicationMgr.QueryCloseSequenceFile event when you want an opportunity to cancel the closing of sequence files.
12-13-2012 12:23 PM - edited 12-13-2012 12:24 PM
If you are trying to programmatically close a file window, the following statement shows one way to do it. It computes Locals.Unload to avoid trying to unload a file that isn't in a window because that displays an error. You can simply this if you know the file is in a window and you already have its reference:
// assumes presence of:
// Locals.Path (string)
// Locals.File (reference)
// Locals.Unload (boolean)
Locals.File = RunState.Engine.GetSequenceFileEx(Locals.Path),
// We added one load reference with GetSequenceFileEx. Checking !CanUnload tells us if the number of load references is > 1 because it is also open in a window, in which case we want to unload
Locals.Unload = !Locals.File.AsSequenceFile.CanUnload,
// release the load reference we added
RunState.Engine.ReleaseSequenceFileEx(Locals.File),
// UNCOMMENT THIS IF YOU WANT TO NOT CLOSE THE FILE IF IT IS EXECUTING
// now make sure CanUnload is true after we release our load reference
//Locals.Unload = Locals.Unload && Locals.File.AsSequenceFile.CanUnload,
// close the file window
Locals.Unload ? RunState.Engine.PostUIMessage(Nothing, Nothing, UIMsg_CloseWindows, 0.0, "", Locals.File, False) : "",
Locals.File = Nothing