You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/bin/bash
# Sends a command to the specified instance of IBC, for example to cause it
# to initiate a tidy closedown or restart of TWS or Gateway
# You must supply the command as the first argument when you call this
# script. It is case-insensitive.
# Please read the notes below and make any required changes, then save this
# file before running it.
# You may need to change this line. Set it to the name or IP address of the
# computer that is running IBC. Note that you can use the local loopback
# address (127.0.0.1) if IBC is running on the current machine.
server_address=127.0.0.1
# You may need to change this line. Make sure it's set to the value of the
# CommandServerPort setting in config.ini:
command_server_port=7462
# You shouldn't need to change anything below this line.
# ==============================================================================
if [[ -z "$1" ]]; then
>&2 echo -e "Error: you must supply a valid IBC command as the first argument"
>&2 exit 1
fi
# send the required command to IBC
(echo "$1"; sleep 1; echo "EXIT" ) | /usr/local/bin/telnet "$server_address" $command_server_port
I noticed on macOS the correct key combination for RECONNECTDATA is actually: Command + Option(Alt) + F
instead of Ctrl + Alt + F
So that the above script doesn't work on macOS.
What i think needs to be done is to change the code from:
I'm not a Java developer, so the alternatives i'm considering until this is resolved are:
Run TW in linux virtualized (docker or something else) and use the command to send a telnet command to the linux TW instance, maybe that one receives it correctly.
Another option would be to implement a library in Objective-C or python to send that key combo to the TW window
Another option would be to investigate the JAVA library and find the bug and fix it directly in the implementation and send a Pull Request to the library as well - this requires knowledge of ant
Another option would be to RESTART the TW app each time, this is the simplest solution that i tested and works out of the box, just need to write handling code for waiting until fully reconnected.
Got the RESTART from this undocumented API:
You seem to have a pretty good handle on what needs to be done, so it shouldn't be a big deal to fix it. But that doesn't make it any easier to find the time for it! I'll try to do so soon.
But I'm curious. What are the circumstances where you find it necessary to use it? Is this a frequent occurrence? Although I have used the manual equivalent of these commands on rare occasions, I've never found that they actually help solve any problems.
I noticed on macOS the correct key combination for
RECONNECTDATA
is actually:Command + Option(Alt) + F
instead of
Ctrl + Alt + F
So that the above script doesn't work on macOS.
What i think needs to be done is to change the code from:
IBC/src/ibcalpha/ibc/CommandDispatcher.java
Line 81 in 8b5f784
and
IBC/src/ibcalpha/ibc/CommandDispatcher.java
Line 99 in 8b5f784
from
int modifiers = KeyEvent.CTRL_DOWN_MASK | KeyEvent.ALT_DOWN_MASK;
to
int modifiers = KeyEvent.VK_META | KeyEvent.ALT_DOWN_MASK;
As per GavriYashar/Matlab-Editor-Plugin#150 (comment) for the key Command
https://stackoverflow.com/a/7375073/1889814
Of course with the check of platform is macOS
https://stackoverflow.com/questions/228477/how-do-i-programmatically-determine-operating-system-in-java
I'm not a Java developer, so the alternatives i'm considering until this is resolved are:
RESTART
the TW app each time, this is the simplest solution that i tested and works out of the box, just need to write handling code for waiting until fully reconnected.Got the
RESTART
from this undocumented API:IBC/src/ibcalpha/ibc/CommandDispatcher.java
Lines 34 to 57 in 8b5f784
Cheers and thanks for this wonderful library!
The text was updated successfully, but these errors were encountered: