Close window

I am currently a system that has a main window (Full screen) and a number of windows that pop up as an overlay for the operator to enter or select items. I have a cancel button that will close this window using ‘system. nav.closeParentWindow(event)’ works fine of cousre. What I cannot get to happen is when the opertor selects the enter button I run a number of app’s in the script module and want to close the window at the end of the script. Unable to get any of the closeWindow commands to work, what am I missing?


You should be able to use the same system.nav.closeParentWindow(event) function call. I bet your script is not even getting to that line. Are you getting an error? Can you post the script here?

Hi Travis,

The code is getting to that point and beyond. I am not getting any errors. I had even set ip up to tell me if there was a problem with the window and it wpould come up as window not open.


Routine Definitions


1 - Box count

2 - Bag Count

def record(routine, lotNum):
import system
import app
from java.util import Date

Variable Declaration Section


lotNumber = ‘’

date = ‘’

operatorName = system.tag.getTagValue('[Client]Tracking/Current_Operator')
operatorId = system.tag.getTagValue('[Client]Tracking/Current_Operator_ID')
ingName = system.tag.getTagValue('[Client]Tracking/Selected_Ing')
qtyUsed = system.tag.getTagValue('[Client]Tracking/Select_Box_Count')
balanceQty = system.tag.getTagValue('[Client]Tracking/Balance_Qty')
recordId = system.tag.getTagValue('[Client]Tracking/Lot_RecordId')

now = Date()
ts = system.db.dateFormat(now, "HH:mm:ss")	#database entry generation time
ds = system.db.dateFormat(now, "yyyy-MM-dd")	#database entry generation date
date = ds + " " + ts

if routine == 1:	#1 - Box count
	system.db.runUpdateQuery("INSERT INTO Used_Lot_Numbers (Lot_Number, Date, Operator, Operator_ID, Ing_Name, Qty_Used, Qty_Balance) VALUES ( %d, '%s' , '%s', %d, '%s', %d, %d);" % (lotNum, date, operatorName, operatorId, ingName, qtyUsed, balanceQty), 'Mill_Tracking')
	system.db.runUpdateQuery("UPDATE Lot_Numbers SET Qty_Balance = %d WHERE idLot = %d ;" % (balanceQty, recordId), 'Mill_Tracking')	
	system.db.runUpdateQuery("UPDATE Lot_Numbers SET Date_Modified = '%s' WHERE idLot = %d ;" % (date, recordId), 'Mill_Tracking')	



Is “Popup_Box_Count” the correct path to your window? In the designer right click on the window and select copy path. Paste it somewhere to make sure. When a window is in a folder you would get a path like this:


The window is not in a folder. It is a branch of windows in the designer. The copy and paste only showed the ‘PopUp_Box_Count’

Oh, I made a rookie mistake. You are using the close parent window function which only works when passing the event object in. You have to use system.nav.closeWindow when you specify a window path:system.nav.closeWindow('Popup_Box_Count')That will work!