Discussion:
Make HTA page always on top?
(too old to reply)
Dave "Crash" Dummy
2012-02-27 16:58:54 UTC
Permalink
I have a HTA utility I wrote which I would like to remain on top when
another program is opened. (It contains material I want to copy to the
new program.) Is there some way to do this with VBScript?
--
Crash

"I'm told that Wagner's music is not as bad as it sounds."
~ Mark Twain ~
Todd Vargo
2012-02-27 21:43:30 UTC
Permalink
Post by Dave "Crash" Dummy
I have a HTA utility I wrote which I would like to remain on top when
another program is opened. (It contains material I want to copy to the
new program.) Is there some way to do this with VBScript?
I don't know if vbscript can do that, but I use a freeware utility
called DeskPins to keep my calculator on top. There are several others
that provide the same functionality, I just happen to use DeskPins.
Google will find it for you.
--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)
Dave "Crash" Dummy
2012-02-27 23:10:29 UTC
Permalink
Post by Todd Vargo
Post by Dave "Crash" Dummy
I have a HTA utility I wrote which I would like to remain on top
when another program is opened. (It contains material I want to
copy to the new program.) Is there some way to do this with
VBScript?
I don't know if vbscript can do that, but I use a freeware utility
called DeskPins to keep my calculator on top. There are several
others that provide the same functionality, I just happen to use
DeskPins. Google will find it for you.
Thanks. Yes, I am aware of third party utilities. I was hoping for a way
to write it into the script.
--
Crash

I always thought Mensa was a Japanese import.
Mayayana
2012-02-27 23:22:16 UTC
Permalink
This post might be inappropriate. Click to display it.
Dave "Crash" Dummy
2012-02-28 02:07:40 UTC
Permalink
Post by Mayayana
| Thanks. Yes, I am aware of third party utilities. I was hoping for
a way | to write it into the script. |
I doubt it's possible. Even using API functions it requires a hack
that involves finding the active window and then hijacking it to put
one's own window on top. The reason is because Microsoft decided,
back around Win2000, that one software program shouldn't be able to
mess around with other processes.
After further research, I'm afraid you are right.

I tried DeskPins that Todd recommended, and adding the always-on-top pin
each time the script was called was more trouble than just clicking the
taskbar icon to reestablish focus.
--
Crash

"Facts are stubborn things, but statistics are more pliable."
~ Laurence J. Peter ~
Mayayana
2012-02-28 02:35:39 UTC
Permalink
This may not be any easier, but I have a component
that has that function:

http://www.jsware.net/jsware/scripts.php5#jsshl

I have a number of components, most of which don't
support Vista/7. I was updating an Active Accessibility
component recently to support Vista/7 and decided to
turn it into a general shell component, to manage open
windows and processes, access AA easily, etc.

WSH has never had good shell support. There's been
little more than Shell.Application, which really only sees
Explorer and IE, and was just accidentally usable in the
first place. It was designed for Active Desktop functionality --
no more and no less. So I designed the new component
to provide pretty much everything that WSH lacks in
terms of GUI functions:

. Enumerate running processes.

. Return information about display properties and current mouse position.

. Dialog windows: FileOpen, Multi-FileOpen, FileSave, BrowseForFolder,
ChooseColor.

. Get/Set the active window.

. Enumerate open windows and their child windows.

. Find extensive information about any of those windows -- parent or
child -- including size, position, classname, handle, titlebar text, and
associated executable. jsShell can also return details about all
sub-windows, or controls, in those windows. Through the MS Active
Accessibility API it can provide the text in a textbox, the caption on a
button, the selected item in a listbox, etc. It can, for example, find a
button in a given window with the caption "Start", then select or even
auto-click that button.

. Return a usable IE Document from any window hosting an IE browser window.
(IE, HTAs, pre-XP folder windows, or 3rd-party software.)
--
--
"Dave "Crash" Dummy" <***@invalid.invalid> wrote in message news:jihctd$k98$***@dont-email.me...
| Mayayana wrote:
| > | Thanks. Yes, I am aware of third party utilities. I was hoping for
| > a way | to write it into the script. |
| >
| > I doubt it's possible. Even using API functions it requires a hack
| > that involves finding the active window and then hijacking it to put
| > one's own window on top. The reason is because Microsoft decided,
| > back around Win2000, that one software program shouldn't be able to
| > mess around with other processes.
|
| After further research, I'm afraid you are right.
|
| I tried DeskPins that Todd recommended, and adding the always-on-top pin
| each time the script was called was more trouble than just clicking the
| taskbar icon to reestablish focus.
| --
| Crash
|
| "Facts are stubborn things, but statistics are more pliable."
| ~ Laurence J. Peter ~
Dave "Crash" Dummy
2012-02-28 12:17:24 UTC
Permalink
This may not be any easier, but I have a component that has that
http://www.jsware.net/jsware/scripts.php5#jsshl
Thanks. I have downloaded it for exploration. I'm sure I soon will be
pestering you with questions. :-)
--
Crash

Today is the first day of the rest of your life, and there's not a
damned thing you can do about it.
Mayayana
2012-02-28 15:24:39 UTC
Permalink
| Thanks. I have downloaded it for exploration. I'm sure I soon will be
| pestering you with questions. :-)
| --

Fire away. :)

And feel free to write to me if questions are too specific
for posting here. There's a fairly thorough help, file, and
samples that cover each method, but it's all quite complex.
Active Accessibility, alone, is very complex. And the Win32
API functions for windows (which I've tried to wrap as
efficiently as possible) are extensive.

If you get into dealing with windows a lot you might want
to try to find some of the SDK software for that. I don't
have links offhand, but available Win32 Platform SDKs may
have some of it. Two programs that really stand out are
spyxx.exe, known as "Spy++", and AccExplorer.exe.

* Spy++ - allows you to view all open windows, in their
hierarchies, as a simple treeview list. That makes it
easy to map out the window structure of a program
window. Spy++ probably comes in the SDK.

* AccExplorer - comes with the AA SDK v. 1.3. It allows you
to pick an open window and see everything that AA can
see. The AA view overlaps with the Windows window
hierarchy view, but is more extensive.
I don't think AccExplorer comes with the v. 2 AA SDK.
From what I could see that package seems to be inferior
to the v. 1.3 SDK.

AA is an interesting thing. The idea was to provide
functionality for screen readers, etc. (For those who
may not know, accessibility is the P.C. euphemism for
functionality to help handicapped people.)

I have a friend who's blind, so I got into
exploring AA some time ago. Unfortunately, Windows was
never designed for accessibility in the first place. MS
added it later, mainly through oleacc.dll, but they could
only tack AA on top of the existing strucure, and they
never really bothered to finish it. AA is really just a
repackaging of all the window APIs in the Win32 API.
It can do a lot, but the object model is quirky and
unfinished; difficult to use. The jsShell (and former jsAA)
methods are an attempt to clean up the funky AA COM
interfaces and make them more usable by presenting them
as a sensible object model.

Actual screen reader software has to use all
sorts of little hacks in order to work because AA just
can't do it all.

MS later came up with User Interface Automation
(UIA) in Vista/7, which I looked into. But as far as I can see
UIA is really just a repackaging of AA to cater to .Net
programmers. (AA is very COM-heavy and uses a lot of
Variant data types. .Net doesn't handle COM well and
variant is not a native .Net type.)
There have actually been several updates to AA and
to UIA, etc., but as far as I can tell those have mainly
been to provide better support for newer MS Office
programs and to provide the .Net-friendly APIs.
... Much ado about nothing, but with more extensive
dependencies. An AA version of at least 1.3, which jsShell
depends on, is pre-installed on nearly all current Windows
systems, so it can be thought of as a pre-installed, core
system library.
Todd Vargo
2012-02-29 06:53:54 UTC
Permalink
Post by Dave "Crash" Dummy
Post by Mayayana
| Thanks. Yes, I am aware of third party utilities. I was hoping for
a way | to write it into the script. |
I doubt it's possible. Even using API functions it requires a hack
that involves finding the active window and then hijacking it to put
one's own window on top. The reason is because Microsoft decided,
back around Win2000, that one software program shouldn't be able to
mess around with other processes.
After further research, I'm afraid you are right.
I tried DeskPins that Todd recommended, and adding the always-on-top pin
each time the script was called was more trouble than just clicking the
taskbar icon to reestablish focus.
Read the help to set up an Autopin rule and you will be pleased.
--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)
Dave "Crash" Dummy
2012-02-29 13:36:40 UTC
Permalink
Post by Todd Vargo
Post by Dave "Crash" Dummy
Post by Mayayana
| Thanks. Yes, I am aware of third party utilities. I was hoping for
a way | to write it into the script. |
I doubt it's possible. Even using API functions it requires a hack
that involves finding the active window and then hijacking it to put
one's own window on top. The reason is because Microsoft decided,
back around Win2000, that one software program shouldn't be able to
mess around with other processes.
After further research, I'm afraid you are right.
I tried DeskPins that Todd recommended, and adding the always-on-top pin
each time the script was called was more trouble than just clicking the
taskbar icon to reestablish focus.
Read the help to set up an Autopin rule and you will be pleased.
Oops. I'll reinstall it and take a look.
--
Crash

"Something there is that doesn't love a wall, that wants it down."
~ Robert Frost ~
Dave "Crash" Dummy
2012-02-29 14:13:40 UTC
Permalink
Post by Dave "Crash" Dummy
Post by Todd Vargo
Post by Dave "Crash" Dummy
Post by Mayayana
| Thanks. Yes, I am aware of third party utilities. I was hoping for
a way | to write it into the script. |
I doubt it's possible. Even using API functions it requires a hack
that involves finding the active window and then hijacking it to put
one's own window on top. The reason is because Microsoft decided,
back around Win2000, that one software program shouldn't be able to
mess around with other processes.
After further research, I'm afraid you are right.
I tried DeskPins that Todd recommended, and adding the always-on-top pin
each time the script was called was more trouble than just clicking the
taskbar icon to reestablish focus.
Read the help to set up an Autopin rule and you will be pleased.
Oops. I'll reinstall it and take a look.
I can't get it to "autopin" my HTA script. Have you tried it?
--
Crash

"I am not young enough to know everything."
~ Oscar Wilde ~
Dave "Crash" Dummy
2012-02-29 15:59:29 UTC
Permalink
Post by Dave "Crash" Dummy
Post by Dave "Crash" Dummy
Post by Todd Vargo
Post by Dave "Crash" Dummy
Post by Mayayana
| Thanks. Yes, I am aware of third party utilities. I was
hoping for a way | to write it into the script. |
I doubt it's possible. Even using API functions it requires a
hack that involves finding the active window and then
hijacking it to put one's own window on top. The reason is
because Microsoft decided, back around Win2000, that one
software program shouldn't be able to mess around with other
processes.
After further research, I'm afraid you are right.
I tried DeskPins that Todd recommended, and adding the
always-on-top pin each time the script was called was more
trouble than just clicking the taskbar icon to reestablish
focus.
Read the help to set up an Autopin rule and you will be pleased.
Oops. I'll reinstall it and take a look.
I can't get it to "autopin" my HTA script. Have you tried it?
Got it. The problem was in how I used shortcuts. I use shortcuts to load
HTA files as arguments for the script interpreter:
"c:\windows\system32\mshta.exe d:\path\script.hta." If I set the
shortcut to load "d:\path\script.hta" directly, the auto pin works.

Thanks!
--
Crash

"The fewer the facts, the stronger the opinion."
~ Arnold H. Glasow ~
Todd Vargo
2012-02-29 21:19:45 UTC
Permalink
Post by Dave "Crash" Dummy
Got it. The problem was in how I used shortcuts. I use shortcuts to load
"c:\windows\system32\mshta.exe d:\path\script.hta." If I set the
shortcut to load "d:\path\script.hta" directly, the auto pin works.
Excellent. Another happy camper.
--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)
t***@gmail.com
2018-01-22 18:18:05 UTC
Permalink
<script language="vbscript">

window.setInterval "setfocus()", 100

Function setfocus

 window.focus()

End Function

Loading...