Apps that can't receive Send output?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
David Ayer
Newbie
Posts: 7
Joined: Sun Mar 27, 2011 2:45 pm

Apps that can't receive Send output?

Post by David Ayer » Sun Mar 27, 2011 2:58 pm

Has anyone tried to automate an application which could not seem to receive Send output?

I have successfully sent text and/or control sequences to Notepad, the Ruby 1.92 interactive interpreter, and the ActiveState Komodo 6.1 multilanguage editor.

However, the app I'm trying to automate, TradeStation 8.8, a stock trading platform, does not respond to the Send (the same is true for its sister app from the same vendor, a development environment for trading stategies).

It is clear that TradeStation is receiving focus. To begin it's window is displayed and Macro 12's is on top of it. As the macro runs, TradeStation's window is brought to the top, the Macro Scheduler Eval message is displayed top right, and the TradeStation window border lights up. After the macro runs (I kill it manually since it hangs on the WaitWindowOpen) I can manually do the Send from the keyboard (meaning I just type the sequence in and it is responded to).


I find the window names by using:

Code: Select all

GetWindowList>winlist
Separate>winlist,CRLF,windows
Let>k=1
Repeat>k
Let>this=windows_%k%
MessageModal>this
Let>k=k+1
Until>k>windows_count
// end code

And my test code:

Code: Select all

Let>WaitTime=2

Input>theSymbol,Enter Symbol
MessageModal>theSymbol

SetFocus>TradeStation 8.8*
Wait>WaitTime

Press ALT
Wait>WaitTime
Send>o
Wait>WaitTime
Send>s
Wait>WaitTime
Release ALT
Wait>WaitTime

WaitWindowOpen>Format Symbol*
SetFocus>Format Symbol*
Wait>WaitTime

Send>theSymbol
Wait>WaitTime

Press Enter
Wait>WaitTime
Release Enter
// end code

The ALT-os should pop up a dialog box, but does not.


Other details you may want to know:
- All programs are 32 bit
- Windows 7 64 bit Home Premium, fully updated as of 3/27/11
- Microsoft HID Keyboard Driver Version 6.1.7600.16385 June 21, 2006

Ideas?

Thanks, David

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Mar 28, 2011 3:09 am

If you have Macro Scheduler simply press the ALT key does TradeStation's menu get focus? If yes maybe you can press arrow keys to get to your menu item.
For example, something like this:
Press ALT
Press Right
Press Down*3
Release ALT


Have you tried removing the Waits?

Have you tried putting the "os" in one Send> (Send>os)?

David Ayer
Newbie
Posts: 7
Joined: Sun Mar 27, 2011 2:45 pm

Post by David Ayer » Mon Mar 28, 2011 2:19 pm

Thanks for the response. The press ALT Right sequence did not even work manually. But I did try the simplest sequence I could find, pressing F1 manually which pops up a Help screen. But when I tried the following script:

Code: Select all

Let>WaitTime=2

SetFocus>TradeStation 8.8*
Wait>WaitTime

Press F1
...there was still no response after focus moved to TradeStation.


Also I have tried many variations of my original including no waits, "os" in one Send, etc.

Even if I can get this to work with just Press commands I still need a way to send characters. The primary goal is edit two dialog boxes, one for switching stock symbols, the other for initializing optimization parameters for a test of a trading strategy on historical data for that symbol.

Since Press and Send work with so many other programs I'm wondering if the problem is TradeStation (hence the name of the post). It looks like they have their own window manager since the dialog windows show up in the GetWindowList, but the window to display the stock chart does not. Maybe they are doing something with the keyboard processing (like inserting a Streams module like someone could do in a Unix context) to hijack key sequences meant for their window manager. How are Press and Send implemented?

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Mar 28, 2011 2:43 pm

Can you manipulate the menu with mouse clicks?

Can you manually use Ctrl + v to paste into the dialog fields? If yes then try putting the data to the clipboard and using Press ctrl + send>v.

David Ayer
Newbie
Posts: 7
Joined: Sun Mar 27, 2011 2:45 pm

Post by David Ayer » Mon Mar 28, 2011 3:25 pm

In addition to Send, Press is not working (see my previous post). There is something fundamentally wrong under the covers.

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Mar 28, 2011 5:27 pm

Try using mousemoverel and lclick to manipulate the menu.

The only other thoughts that I have for entering data is first, try using the SetControlTextfunction to fill in the fields. The last idea is to see if there is a way to populate the TradeStation data structure without using the dialogs.

David Ayer
Newbie
Posts: 7
Joined: Sun Mar 27, 2011 2:45 pm

Post by David Ayer » Mon Mar 28, 2011 8:55 pm

JRL, thanks much for all these ideas.

Unfortunately, the mouse commands do not work either (we need an emoticon for frickin' frustrated!).

I will try the clipboard and SetControlText techniques if we can somehow get a dialog up (which will probably mean Send works).

I'm not sure what you mean by the last suggestion. TradeStation is limited in its openess. It has no meta-object protocol (pity). Anything I write, such as indicators or trading strategies, gets attached (and thus made to execute) to charts or screeners only through their GUI dialogs. I can't inherit from charts or any of their data types (the damned language, "EasyLanguage", doesn't even have user-define types).

Btw, one further detail I forgot to mention is that I'm using a wireless keyboard and mouse with a USB receiver. I was an OS geek for 2 decades but know nothing about Windows internals. Maybe we can get an mjtnet developer to explain how the USB driver, the keyboard/mouse driver, and the various Macro Scheduler commands all play together to communicate with the app.

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Tue Mar 29, 2011 12:15 pm

Is TradeStation a compiled desktop application or does it run inside a browser?


On the website for Trade Station they mention as system requirements that Microsoft Internet Explorer 7.x is ABSOLUTELY required. I'm thinking that most people by now have 8.x, so you might want to check that you have 7.x available to run on your system.
http://www.tradestation.com/platform/sy ... ments.shtm

David Ayer
Newbie
Posts: 7
Joined: Sun Mar 27, 2011 2:45 pm

Post by David Ayer » Tue Mar 29, 2011 1:17 pm

It's a compiled desktop app. The browser is invoked from the app and is used for account services, such as wire transfers and adding/deleting data feeds, etc.

Anyways, I'm on 8.x, but always go to the website directly from the browser since the app/browser path will take over an existing page (for a number of cases I've concluded that the idea of "well-behaved" is not part of their user experience design goals).

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Tue Mar 29, 2011 1:31 pm

I'm on 8.x
Just a thought here... The browser is MUCH more than just one exe in the system..... it is made up of quite a few DLL's which are used ALL OVER the Operating System to do stuff.

The TradeStation may also be using functions contained within those DLL's


Before I gave up on this, If it were me, I'd install IE 7.x like their system requirements state, and then evaluate how the product performs.

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Mar 29, 2011 2:13 pm

Are you sure this isn't just something really simple ... like UAC? Is TradeStation running elevated but Macro Scheduler not? Or Vice Versa? E.g. if you're running under Vista/Win7 and TradeStation is running as admin then Macro Scheduler will also need to be running as admin in order to interact with it.

Macro Scheduler just simulates keystrokes using the Windows API functions.

If it's not something as simple as different process levels, then it is possible they are preventing simulated input in order to prevent automated tools and "bots". Or perhaps it has it's own keyboard driver or something unusual like that. But it's also possible that it is something much more simple, like the wrong internal window having the focus. While the main application window may appear focused it's possible that the correct child window is not.

I went to their website to try to download it to try for myself but it requires I sign up for an account and provide proof of identity etc, which I'm not really prepared to do, and, as I'm in the UK, requires rather a lot of hoops. I can't really do that just to test it out.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

David Ayer
Newbie
Posts: 7
Joined: Sun Mar 27, 2011 2:45 pm

Post by David Ayer » Wed Mar 30, 2011 2:39 pm

I'm a novice wrt Windows admin so please bear with me.

The system was preconfigured by the manufacturer and to my surprise my account is an admin account. Both TradeStation and Macro 12 were installed by me. When I installed Macro 12 I was asked if I wanted to allow it to change the machine and I agreed. However, TradeStation asks me upon each invocation.


In the Windows Task Manager, all of the TradeStation processes and the Macro 12 process run at a Base Priority of Normal. The running of my macro does not fork off another process, so it runs at Normal as well.

There is a field (of unknown relevance) entitled "UAC Virtualization" which is described as "redirects file and registry write failures to per-user locations". For the TradeStation processes it is "Not Allowed" and for Macro 12 "Disabled".


I spoke with TradeStation technical support. They do not block third party software and use the Windows API for keyboard and mouse.


With respect to a possible inner window focus problem, I closed all of my TradeStation workspaces, so that only the outer window existed. When I pressed F1 a Help window pops up. When I tried it with the macro:

Code: Select all

Let>WaitTime=2

SetFocus>TradeStation 8.8*
Wait>WaitTime

Press F1
...there was no response after focus was changed.


Even if you had set up the account I believe you have to fund it with a min of $5k USD before you can logon (which you must do at invocation time). Marcus, let me propose that we spend a modest amount of time (<30min) on the phone and you can lead me by the nose through a set of steps of your choosing. If we can get the above macro working then I'll purchase the Macro Scheduler Standard while we are talking. Otherwise we go our separate ways with no regrets (I do need to cut my losses at some point). Agreed?

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Mar 30, 2011 2:45 pm

However, TradeStation asks me upon each invocation.
Then it is running with administrator privileges and is therefore running at a higher process level. Ergo Macro Scheduler cannot interact with it.

Try this:

1. Exit Macro Scheduler assuming it is already running
2. Ensuring no copies of Macro Scheduler running RIGHT CLICK on the Macro Scheduler icon on the desktop or in the start menu
3. Select "Run as administrator". It is the option with the blue and yellow shield icon next to it.
4. It will ask if you want to allow it to make changes.
5. Select Yes.

NOW, Macro Scheduler and TradeStation are BOTH running as admin level processes and should be able to interact with each other.

Why the heck a stock trading application requires administrator privileges is beyond me. But there you go.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

David Ayer
Newbie
Posts: 7
Joined: Sun Mar 27, 2011 2:45 pm

Post by David Ayer » Wed Mar 30, 2011 4:38 pm

Marcus, too bad you didn't take me up on my offer - you missed hearing my squeals of delight! That did the trick. I was able to run the first script I posted which pops up the Format Symbol dialog and switches symbols.

So let me get this straight. I'm the admin and install and run programs in that account but some programs run as admin and some not?? And why didn't the Task Manager note that something was different in their status?? How I miss the coherence of Unix systems. Unfortunately TradeStation only runs on Windows.

I did place the order for the Standard version plus the maintenance contract. But why would I need a backup CD? I hope if I do need it you will allow me to add it.

Thanks much to all the responders, JRL, adroege, and Marcus. I appreciate you taking the time to help out a newbie.

Yeah, baby!!

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Mar 30, 2011 5:16 pm

It's called User Account Control or UAC:

http://en.wikipedia.org/wiki/User_Account_Control
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts