The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Working outside the box

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Working outside the box Posted: Jun 12, 2007 6:13 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Working outside the box
Feed Title: David Buck - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/buck-rss.xml
Feed Description: Smalltalk can do that
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From David Buck - Blog

Advertisement

When we develop software in Smalltalk, we normally limit ourselves to our Smalltalk image and rarely interact with other applications on the platform. When we do, we use COM, OLE, DDE or sockets to talk to the other application assuming it has a public API we can use. It does, however, get hard to drive Excel, for example, from an OLE interface.

I've recently been doing some work on interfacing to Windows applications by simulating the user events. This has the advantage that it's easy to explain to someone and it doesn't need the application to expose any interface to us or require us to understand that interface.

I've been using pywinauto and sendkeys as inspiration for this work. So far, I have basic control over Windows applications. For example, I can drive Notepad like this:

	(WinRemote.Window new)
 		typeString: '^{ESC}';
 		delayMilliseconds: 300;
 		typeString: 'r';
 		delayMilliseconds: 300;
 		typeString: 'notepad.exe{ENTER}';
 		delayMilliseconds: 300
 

This means, press CTRL-ESC r (for Run...), type notepad.exe and press the ENTER key.

This opens the Notepad application. I can now find that window and start driving it:

(WinRemote.Window withTitle: '.*Notepad')
	selectMenu: 'Help / About';
	delay: 1;
	typeString: '{ENTER}';
	typeString: 'This is a test{ENTER}{TAB}of the text entry{ENTER 3}capability+1{HOME}-->';
	delay: 1;
	selectMenu: 'File / Save As';
	delayMilliseconds: 300;
	typeString: 'junk.txt{ENTER}' 
 

The strings for the typeString: method can contain special characters such as:

  • + SHIFT the next character
  • ^ CONTROL the next character
  • % ALT the next character
  • ~ same as ENTER
  • {<keyname>} press the named key
  • {<keyname> 5} press the named key 5 times

So far, I've been able to get pretty good control over other windows. If anyone is interested in trying it out, check out the package Windows Remote Control in the public Store repository. This is still a work in progress and I expect to make a lot of changes and improvements over the next few weeks.

Read: Working outside the box

Topic: Remote Desktop Pain Previous Topic   Next Topic Topic: STIC Needs a Webmaster

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use