Page 1 of 1 1
Topic Options
#100472 - 2003-04-21 10:33 PM SetFocus to Desktop?
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4574
Loc: USA
Anyone know of a way to SetFocus to the desktop?
_________________________
(... better days ahead)

Top
#100473 - 2003-04-21 10:58 PM Re: SetFocus to Desktop?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I think you need to issue minimize all to do that.

there is UDF for that, but can I ask why you need it?
_________________________
!

download KiXnet

Top
#100474 - 2003-04-21 11:25 PM Re: SetFocus to Desktop?
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4574
Loc: USA
Well... one of those odd ball things. [Roll Eyes]

We are creating a new short cut on the desktop and if there is an existing short cut with a similar name to the one we are creating, deleting the old one. The problem is, even though the lnk file is actually gone, the icon still appears on the desktop. Simply hitting F5 while focused on the desktop makes the icon disappear.

I would be interested in the UDF... do you know the name?
_________________________
(... better days ahead)

Top
#100475 - 2003-04-21 11:34 PM Re: SetFocus to Desktop?
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4574
Loc: USA
Nevermind... Found it. Thanks for the idea.
_________________________
(... better days ahead)

Top
#100476 - 2003-04-21 11:36 PM Re: SetFocus to Desktop?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
not sure if it works...

never actually tried as we have got the refresh issue with other UDF...

never even thought about that it could work that way.

if it does, please tell.
_________________________
!

download KiXnet

Top
#100477 - 2003-04-22 05:29 AM Re: SetFocus to Desktop?
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4574
Loc: USA
A slight modification to your code was all that was needed. Thanks!

RefreshDesktop

function RefreshDesktop()
dim $shell
$shell=createobject("shell.application")
$shell.MinimizeAll()
sleep 0.5
$=sendkeys("{f5}")
$shell.UndoMinimizeAll
endfunction

The odd thing is, on my home pcs, I couldn't reproduce the symptoms I was having on my work pcs. Hmmmmm??? I'll post more if I can figure out the difference.
_________________________
(... better days ahead)

Top
#100478 - 2003-04-22 05:35 AM Re: SetFocus to Desktop?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
modification?
that looks like totally different UDF [Big Grin]

are you sure that the sleep is needed?
_________________________
!

download KiXnet

Top
#100479 - 2003-04-22 05:47 AM Re: SetFocus to Desktop?
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4574
Loc: USA
[Razz] I'll take no credit for this UDF, EVEN THOUGH I did change the name of your vars and add 3 lines of code. That was a lot work you know. [Wink]

Not absolutely sure about the sleep... When I test it at work tommorrow I will know for sure... and pass along the results.

Thanks again.
_________________________
(... better days ahead)

Top
#100480 - 2003-04-22 03:23 PM Re: SetFocus to Desktop?
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4574
Loc: USA
Sleeping is necessary [Frown] and requires more than 0.5 seconds or even 0.75. Sleeping for a second seemed to do the job.

code:
 
function RefreshDesktop()
dim $shell
$shell=createobject("shell.application")
$shell.MinimizeAll
sleep 1
$=sendkeys("{f5}")
$shell.UndoMinimizeAll
endfunction

_________________________
(... better days ahead)

Top
#100481 - 2003-04-22 07:52 PM Re: SetFocus to Desktop?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
found a way to script this but it's not supported below XP [Frown]

the sleeping is awfull thus I want to search for a better way...

btw, have you tried what happens if you open explorer window...
it should also refresh it.
well, the problem with that is then that I have been unable to close just that window but my script closes all IE and explorer windows [Big Grin]

anyway, that way you wouldn't need to trust sendkeys and users slowness of not screwing everything up...
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2175 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.062 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org