#80969 - 2002-06-19 12:50 AM
setfocus and send keys
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
the biggest problem with setfocus, is that you can't get a return that the window has focus...
run "notepad.exe" while not setfocus("untitled - notepad") loop sendkeys("look, I finally have focus")
That is like the winwaitactive command in scriptit and autoit. I'd like to use that, but the management doesn't want to trust any 3rd party software (that can't be sued/held liable).
They didn't even want to use kixtart, untill I handed them a resource kit CD that said Microsoft and that kixtart was on it...
|
Top
|
|
|
|
#80970 - 2002-06-19 01:33 AM
Re: setfocus and send keys
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Hmm..
This seems to work..
code:
break on cls run "notepad.exe" setfocus("Untitled - Notepad") ;while not setfocus("Untitled - Notepad") loop sendkeys("look, I finally have focus")
Kent
|
Top
|
|
|
|
#80971 - 2002-06-19 01:58 AM
Re: setfocus and send keys
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
but if the window isn't open yet.. process is still running, it doesn't pause/wait for it, nor return a code that it can't find it
part 2, it the ability to read some of the contents of that window.
Specifically for use in installing apps or completing forms
|
Top
|
|
|
|
#80973 - 2002-06-19 04:55 AM
Re: setfocus and send keys
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
|
Top
|
|
|
|
#80975 - 2002-06-19 01:39 PM
Re: setfocus and send keys
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
winzip was just an example... a easy program to install that I had available for development purposes.
I know all about ISS files, and the making of MSI packages, and command line options for certain apps.
I have serveral in house apps that are deployed with the installers provided with the development tool: VB, Access, whatever. I am more concenrned with the functionality of setfocus and sendkeys than with a specific app...
Has any one played with pausing the kbd and mouse devices to block input.
|
Top
|
|
|
|
#80978 - 2002-06-19 03:07 PM
Re: setfocus and send keys
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
nope... no 3rd party shareware/freeware at all. only apps from 'reliable' sources.
If the app came as a reskit util, then they consider that as a blessing...
They allowed be to use scriptit as it says microsoft, but autoit is from an 'unknown' 3rd party. Even though they see that it looks to be functionally identical to scriptit, with more enhancements... scriptit was probably an 'old' version, before the author went his own way and improved it into autoit.
So my options are: software from a 'reliable' source (that is also free) scripting it with Kix (which I have pretty much done)
I was kind of hoping that there would be a COM method that would have more detail than the setfocus/sendkey methods
|
Top
|
|
|
|
#80980 - 2002-06-19 03:46 PM
Re: setfocus and send keys
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
from management today... quote:
Kelly and Cook are going through the FEDs to get them to understand the problems of distribution of their program; that's why your input of problems and ideas for how they can "fix" it are so important. Arizona did an automated rollout, but they are a Novell network, and used ZENworks to make images for each of their OS's and then pushed them out....very time consuming. They use W95, W98, and some NT clients. An industry standard compliant installation program would solve many problems, indeed. We will not be using the autoit program. If you can use the scriptit's ase.scp that's OK. Joe will be getting the "must install by" deadline from Molly today or tomorrow.
It is a government org... virtually everything is stupid, but since we don't have the time/resources to evaluate/test/inspect every app, we assume that a app from a reliable sourse is reliable. CYA
|
Top
|
|
|
|
#80982 - 2002-06-19 03:55 PM
Re: setfocus and send keys
|
Chris S.
MM club member
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
Well, you can use WSH AppActivate (available in WSH 2.0) to improve upon KiX's Setfocus...
quote:
The AppActivate method returns a Boolean value that identifies whether the procedure call is successful. This method changes the focus to the named application or window, but it does not affect whether it is maximized or minimized. Focus moves from the activated application window when the user takes action to change the focus (or closes the window).
In determining which application to activate, the specified title is compared to the title string of each running application. If no exact match exists, any application whose title string begins with title is activated. If an application still cannot be found, any application whose title string ends with title is activated. If more than one instance of the application named by title exists, one instance is arbitrarily activated.
Example:
code:
$rc=setfocus("Internet Explorer provided by The Relizon Company") if @error<>0 ? "Setfocus Failed" endif $WshShell=CreateObject("WScript.Shell") $ActiveApp=$WshShell.AppActivate("Internet Explorer provided by The Relizon Company") if $ActiveApp=-1 ? "WSH Succeeded." endif
|
Top
|
|
|
|
Moderator: Lonkero, ShaneEP, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart
|
2 registered
(morganw, mole)
and 414 anonymous users online.
|
|
|