Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Closing applications in remote windows


  • Please log in to reply
7 replies to this topic
sl_alagappan
  • Members
  • 17 posts
  • Last active: Aug 23 2004 06:29 AM
  • Joined: 03 Mar 2004
Frequently, I need to close and restart some java based windows ( running in DOS environment ) in Windows NT 4 Server.

I wish to close the windows in the remote Widnows NT Server from a client machine usign AutoHotkey.


any idea or suggestion on how to close a remote application window from a client machine?

Beastmaster
  • Guests
  • Last active:
  • Joined: --
Please check if PSExec (from your local box) could trigger/execute an AHK script (left on the remote box).

Additionaly you could use VNC (or one of his clones eg. RealVNC or ThightVNC, to see what's going on - cross platform!)

Beastmaster
  • Guests
  • Last active:
  • Joined: --
If you've accomplished how to identify such JAVA/DOS window, you could run an AHK script (24/7 or scheduled) on the remote box to close that window, without any need of remote action.

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

you could run an AHK script (24/7 or scheduled) on the remote box to close that window, without any need of remote action.

Similar to the above idea, you could have a script running on the remote machine that watches for certain semaphore (signal) file to exist. Such a file can be created via a mapped drive on either machine (or perhaps by using a UNC directly). For example:
Loop
{
    IfExist, M:\StartJob.txt  ; A remote user created this file to tell us to start.
    {
        FileDelete, M:\StartJob.txt  ; Reset for the next time
        Run, Whatever.exe
    }
    Sleep, 1000
}


beardboy
  • Members
  • 443 posts
  • Last active: May 27 2017 08:41 AM
  • Joined: 02 Mar 2004
Here is an example of a program I wrote that runs on remote computers that lets me start any application I want remotely and kill remote programs.

Loop
{
  IFExist, %A_SCRIPTDIR%\trimmenu.ini
  {
    GoSub, INI
  }
  Sleep, 1000
}

INI:
IniRead, type, %A_SCRIPTDIR%\trimmenu.ini, General, Type
IniRead, program, %A_SCRIPTDIR%\trimmenu.ini, General, Program
IniRead, options, %A_SCRIPTDIR%\trimmenu.ini, General, Options
if type = kill
{
  if options = winkill
  {
    WinKill, %program%
  }
  if options = rkill
  {
    RunWait, %comspec% /c rkill /nkill \\%computername% %program%,,hide
  }
}
if type = start
{
  Run, %program% %options%
}
FileDelete, %A_SCRIPTDIR%\trimmenu.ini
return

rkill can be found at http://www.autohotke...wtopic.php?t=95

Then on my local PC I wrote a batch job to create the INI file and copy it to the remote PC.

@echo off
set v=%1
Title Trimmenu Start / Kill
echo Trimmenu Start / Kill
:start
echo ------------------------------------------------
IF "%v%" == "" set /p computer=What PC would you like to do something on?
IF NOT "%v%" == "" set computer=%1
IF "%computer%" == "exit" GOTO END
set /p sork=Would you like to start or kill?
set /p program=What program (remember full path if needed)?
set /p options=Options (Example: /c /d)?

IF NOT EXIST \\%computer%\c$ echo %computer%: Computer is not available&set v=&GOTO START
echo [General]>trimmenu.ini
echo Type=%sork%>>trimmenu.ini
echo Program=%program%>>trimmenu.ini
echo Options=%options%>>trimmenu.ini
move trimmenu.ini \\%computer%\c\winnt\
echo.
echo Command sent to %computer%

echo.
IF "%2" == "done" GOTO END
set v=&GOTO START

:END
title C:\WINNT\System32\cmd.exe

thanks,
beardboy

sl_alagappan
  • Members
  • 17 posts
  • Last active: Aug 23 2004 06:29 AM
  • Joined: 03 Mar 2004
thanks all for yr replies.

I hv implemented similar method to close the remote windows ( a schedular running to check for existance of a file. If found, the autoit v2 script will close all the remote windows and restart the app ).

But the problem, I face is that, when u close and restart the remote windows for the first time, there is no problem. but for the second and consecutive times, there are kernel errors from Windows NT when I kill process using kill.exe. Not sure whether it is due to windows nt or the java app or the autoit v2 script.. I need to come down to office to restart the server manually in this case during night times.

I know the window title and text of the windows to be closed.


What I want is to close windows in order. Once closed a window, check whether it has been safely closed before closing the next window.

I have an existing VB 6 application which I need to interact with. Once the user click a button in VB app, the vb program should iniate the window closing process using autohotkey. For each window close, I need a confirmation from autohotkey script whether the window is safey closed to my vb program. Once all windows are closed, I need to get confirmation to the vb program so as to inform users what is happening on the remote server.

any possible way of achieving this without affecting windows nt?

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
WinClose and WinKill both support an optional "wait until closed" parameter. You could also use WinWaitClose.

Beastmaster
  • Guests
  • Last active:
  • Joined: --
... and you could set/hold the current status of each window/process in an INI:

[PROCSTAT]
win1=YES
win2=YES
win3=NO
VBConfirmation=NO