Skip to content

Commit

Permalink
Fix bug - STOP.bat not working when run from Task Scheduler (see #117)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlktradewright committed May 27, 2021
1 parent 7988528 commit e1b89d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions resources/Stop.bat
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ set IBC_PATH=%SYSTEMDRIVE%\IBC


:: open a telnet window with a session to IBC
start telnet %ServerAddress% %CommandServerPort%
set TITLE=Stop TWS or Gateway %RANDOM%%RANDOM%%RANDOM%
start "%TITLE%" telnet %ServerAddress% %CommandServerPort%

:: send the required command to IBC
cscript %IBC_PATH%\Scripts\SendStopCommand.vbs
cscript %IBC_PATH%\Scripts\SendStopCommand.vbs "%TITLE%"


:: Acknowledgement: many thanks for the help contained in Mukul Goel's answer to this question at:
Expand Down
2 changes: 2 additions & 0 deletions resources/scripts/SendStopCommand.vbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ WScript.sleep 200

set OBJECT=WScript.CreateObject("WScript.Shell")

OBJECT.AppActivate WScript.Arguments(0)

' STOP IBC
OBJECT.SendKeys "STOP{ENTER}"

Expand Down

0 comments on commit e1b89d8

Please sign in to comment.