Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

[Feature] TimedWaitForWindow and CloseWindow

- - - - -

  • Please log in to reply
1 reply to this topic

#1
Francesco

Francesco

    Advanced Member

  • Member
  • PipPipPip
  • 411 posts
  • Joined 20-March 04

Description

An alternative to abruptly terminating processes with TASKKILL.

 

Changes

In jscript.js before

function TimedWaitForProgram(ImageName,HowLong)

add

function TimedWaitForWindow(WindowName,HowLong)
{
 	position="jscript.js";
	whatfunc="TimedWaitForWindow()";
	
	RunCmd('"' + wpipath + '\\Tools\\WPI Tool.exe" /Action=WaitForWindow /WindowName="' + WindowName + '" /Timeout=' + HowLong, false, true);
}

In configwizard.js replace

CommandsMenuBar.addNewChild("jscript_dos", 3, "jscript_setEnvVar", "setEnvVar()", false, "", "");
	CommandsMenuBar.addNewChild("jscript_dos", 4, "jscript_removeEnvVar", "removeEnvVar()", false, "", "");
	CommandsMenuBar.addNewChild("jscript_dos", 5, "jscript_FormatDrive", "FormatDrive()", false, "", "");

with

CommandsMenuBar.addNewChild("jscript_dos", 3, "jscript_TimedWaitForWindow", "TimedWaitForWindow()", false, "", "");
					CommandsMenuBar.addNewChild("jscript_dos", 4, "jscript_setEnvVar", "setEnvVar()", false, "", "");
					CommandsMenuBar.addNewChild("jscript_dos", 5, "jscript_removeEnvVar", "removeEnvVar()", false, "", "");
					CommandsMenuBar.addNewChild("jscript_dos", 6, "jscript_FormatDrive", "FormatDrive()", false, "", "");

and

CommandsMenuBar.addNewChild("cmd_other", 3, "other_sleep", "Sleep", false, "", ""); 
    CommandsMenuBar.addNewChild("cmd_other", 4, "other_reboot", "Reboot", false, "", "");

with

CommandsMenuBar.addNewChild("cmd_other", 3, "other_closewindow", "CloseWindow", false, "", ""); 
			CommandsMenuBar.addNewChild("cmd_other", 4, "other_sleep", "Sleep", false, "", ""); 
			CommandsMenuBar.addNewChild("cmd_other", 5, "other_reboot", "Reboot", false, "", "");

and before

case 'jscript_CreateRegKey':

add

case 'jscript_TimedWaitForWindow':
			HandleCommandsSelectionMenu('{JSCRIPT}=TimedWaitForProgram("Setup",10)');
			break;

and before

case 'other_sleep':

add

case 'other_closewindow':
			HandleCommandsSelectionMenu("{CLOSEWINDOW} WindowName");
			break;

In installer.js before

case 'SLEEP':

add

case 'CLOSEWINDOW':
				cmd="\"" + wpipath + "\\Tools\\WPI Tool.exe\" /Action=CloseWindow /WindowName=\"" + cmd + "\"";
				fsoCmd=true;
				break;

In the Tools folder add the WPI Tool.exe attached to this post

Attached Files


Edited by Francesco, 14 July 2013 - 05:28 PM.



How to remove advertisement from MSFN

#2
Kelsenellenelvian

Kelsenellenelvian

    WPI Guru

  • Developer
  • 8,864 posts
  • Joined 18-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Got it.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users