Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Two script questions: send Fn key? and detect profile loaded?

Reply
 
Old 01-27-2009   #1 (permalink)
Ed from AZ


 
 

Two script questions: send Fn key? and detect profile loaded?

I have a small script to launch a program on my laptop. I'd like to
put this script into the startup folder of the profile I use, but I
don't want the script to run until the laptop has finished booting and
the profile is completely loaded. Can I detect when the profile is
finished loading and run the script then? Or perhaps just put in
several seconds of sleep and make it wait that way?

Also, I'd like to see if I can somehow send a Function (Fn) key
combination via the script. Will SendKeys work with Fn?

Ed

My System SpecsSystem Spec
Old 01-27-2009   #2 (permalink)
Tom Lavedas


 
 

Re: Two script questions: send Fn key? and detect profile loaded?

On Jan 27, 1:56*pm, Ed from AZ <prof_ofw...@xxxxxx> wrote:
Quote:

> I have a small script to launch a program on my laptop. *I'd like to
> put this script into the startup folder of the profile I use, but I
> don't want the script to run until the laptop has finished booting and
> the profile is completely loaded. *Can I detect when the profile is
> finished loading and run the script then? *Or perhaps just put in
> several seconds of sleep and make it wait that way?
>
> Also, I'd like to see if I can somehow send a Function (Fn) key
> combination via the script. *Will SendKeys work with Fn?
>
> Ed
Doesn't the a shortcut in the "%userprofile%\Start Menu\Programs
\Startup" folder do the job you want? If it doesn't you can certainly
add a WSH.Sleep 10000 line at the head of the script.

An Sendkey sends function keys as {Fn}, when n is the number of the
desired key ({F1}, {F2}, ...). The tough part is making sure it is
sent to the right application. That requires judicious use of the
AppActivate method.

Tom Lavedas
***********
http://there.is.no.more/tglbatch/
My System SpecsSystem Spec
Old 01-27-2009   #3 (permalink)
Ed from AZ


 
 

Re: Two script questions: send Fn key? and detect profile loaded?

Hi, Tom. Thanks for responding.
Quote:

> Doesn't a shortcut in the "%userprofile%\Start Menu\Programs
> \Startup" folder do the job you want? If it doesn't you can certainly
> add a WSH.Sleep 10000 line at the head of the script.
To be honest, I have not yet put the script in the startup folder, as
I wanted to check and see if there was a way to detect the end of the
load-up process first. I do intend on putting it there - I just want
the script to be the last thing to run.
Quote:

> An Sendkey sends function keys as {Fn}, when n is the number of the
> desired key ({F1}, {F2}, ...). The tough part is making sure it is
> sent to the right application. That requires judicious use of the
> AppActivate method.
The "Fn" button is a separate button on the laptop keyboard - it
activates something specific to the Dell scheme of things, I suspect
(turning off the WiFi antenna). So I want to send the "Fn" button
plus the "F2" button after Windows XP Pro finishes loading, but it
does something within Dell's influence, I think, rather than to
Windows or any other app.

Ed


On Jan 27, 1:23*pm, Tom Lavedas <tglba...@xxxxxx> wrote:
Quote:

> On Jan 27, 1:56*pm, Ed from AZ <prof_ofw...@xxxxxx> wrote:
>
Quote:

> > I have a small script to launch a program on my laptop. *I'd like to
> > put this script into the startup folder of the profile I use, but I
> > don't want the script to run until the laptop has finished booting and
> > the profile is completely loaded. *Can I detect when the profile is
> > finished loading and run the script then? *Or perhaps just put in
> > several seconds of sleep and make it wait that way?
>
Quote:

> > Also, I'd like to see if I can somehow send a Function (Fn) key
> > combination via the script. *Will SendKeys work with Fn?
>
Quote:

> > Ed
>
> Doesn't the a shortcut in the "%userprofile%\Start Menu\Programs
> \Startup" folder do the job you want? *If it doesn't you can certainly
> add a WSH.Sleep 10000 line at the head of the script.
>
> An Sendkey sends function keys as {Fn}, when n is the number of the
> desired key ({F1}, {F2}, ...). *The tough part is making sure it is
> sent to the right application. *That requires judicious use of the
> AppActivate method.
>
> Tom Lavedas
> ***********http://there.is.no.more/tglbatch/
My System SpecsSystem Spec
Old 01-28-2009   #4 (permalink)
Al Dunbar


 
 

Re: Two script questions: send Fn key? and detect profile loaded?


"Ed from AZ" <prof_ofwhat@xxxxxx> wrote in message
news:381f05f5-cffd-46e0-a612-b4787c43cffd@xxxxxx
Hi, Tom. Thanks for responding.
Quote:

> Doesn't a shortcut in the "%userprofile%\Start Menu\Programs
> \Startup" folder do the job you want? If it doesn't you can certainly
> add a WSH.Sleep 10000 line at the head of the script.
To be honest, I have not yet put the script in the startup folder, as
I wanted to check and see if there was a way to detect the end of the
load-up process first. I do intend on putting it there - I just want
the script to be the last thing to run.

===> I bel
Quote:

> An Sendkey sends function keys as {Fn}, when n is the number of the
> desired key ({F1}, {F2}, ...). The tough part is making sure it is
> sent to the right application. That requires judicious use of the
> AppActivate method.
The "Fn" button is a separate button on the laptop keyboard - it
activates something specific to the Dell scheme of things, I suspect
(turning off the WiFi antenna). So I want to send the "Fn" button
plus the "F2" button after Windows XP Pro finishes loading, but it
does something within Dell's influence, I think, rather than to
Windows or any other app.

Ed


On Jan 27, 1:23 pm, Tom Lavedas <tglba...@xxxxxx> wrote:
Quote:

> On Jan 27, 1:56 pm, Ed from AZ <prof_ofw...@xxxxxx> wrote:
>
Quote:

> > I have a small script to launch a program on my laptop. I'd like to
> > put this script into the startup folder of the profile I use, but I
> > don't want the script to run until the laptop has finished booting and
> > the profile is completely loaded. Can I detect when the profile is
> > finished loading and run the script then? Or perhaps just put in
> > several seconds of sleep and make it wait that way?
>
Quote:

> > Also, I'd like to see if I can somehow send a Function (Fn) key
> > combination via the script. Will SendKeys work with Fn?
>
Quote:

> > Ed
>
> Doesn't the a shortcut in the "%userprofile%\Start Menu\Programs
> \Startup" folder do the job you want? If it doesn't you can certainly
> add a WSH.Sleep 10000 line at the head of the script.
>
> An Sendkey sends function keys as {Fn}, when n is the number of the
> desired key ({F1}, {F2}, ...). The tough part is making sure it is
> sent to the right application. That requires judicious use of the
> AppActivate method.
>
> Tom Lavedas
> ***********http://there.is.no.more/tglbatch/

My System SpecsSystem Spec
Old 01-28-2009   #5 (permalink)
Al Dunbar


 
 

Re: Two script questions: send Fn key? and detect profile loaded?


"Ed from AZ" <prof_ofwhat@xxxxxx> wrote in message
news:381f05f5-cffd-46e0-a612-b4787c43cffd@xxxxxx
Hi, Tom. Thanks for responding.
Quote:

> Doesn't a shortcut in the "%userprofile%\Start Menu\Programs
> \Startup" folder do the job you want? If it doesn't you can certainly
> add a WSH.Sleep 10000 line at the head of the script.
To be honest, I have not yet put the script in the startup folder, as
I wanted to check and see if there was a way to detect the end of the
load-up process first. I do intend on putting it there - I just want
the script to be the last thing to run.

===> I believe that nothing runs from the startup folder until the system is
fully booted and operational. I don't know of any way to pre-determine the
order of execution from the startup folder - I think they all run
asynchronously.
Quote:

> An Sendkey sends function keys as {Fn}, when n is the number of the
> desired key ({F1}, {F2}, ...). The tough part is making sure it is
> sent to the right application. That requires judicious use of the
> AppActivate method.
The "Fn" button is a separate button on the laptop keyboard - it
activates something specific to the Dell scheme of things, I suspect
(turning off the WiFi antenna). So I want to send the "Fn" button
plus the "F2" button after Windows XP Pro finishes loading, but it
does something within Dell's influence, I think, rather than to
Windows or any other app.

===> sendkeys can only deal with keys known to and processed by windows. In
most cases, the FN key deals directly with the hardware, and not through the
o/s.

Ed


On Jan 27, 1:23 pm, Tom Lavedas <tglba...@xxxxxx> wrote:
Quote:

> On Jan 27, 1:56 pm, Ed from AZ <prof_ofw...@xxxxxx> wrote:
>
Quote:

> > I have a small script to launch a program on my laptop. I'd like to
> > put this script into the startup folder of the profile I use, but I
> > don't want the script to run until the laptop has finished booting and
> > the profile is completely loaded. Can I detect when the profile is
> > finished loading and run the script then? Or perhaps just put in
> > several seconds of sleep and make it wait that way?
>
Quote:

> > Also, I'd like to see if I can somehow send a Function (Fn) key
> > combination via the script. Will SendKeys work with Fn?
>
Quote:

> > Ed
>
> Doesn't the a shortcut in the "%userprofile%\Start Menu\Programs
> \Startup" folder do the job you want? If it doesn't you can certainly
> add a WSH.Sleep 10000 line at the head of the script.
>
> An Sendkey sends function keys as {Fn}, when n is the number of the
> desired key ({F1}, {F2}, ...). The tough part is making sure it is
> sent to the right application. That requires judicious use of the
> AppActivate method.
>
> Tom Lavedas
> ***********http://there.is.no.more/tglbatch/

My System SpecsSystem Spec
Old 01-28-2009   #6 (permalink)
Paul Randall


 
 

Re: Two script questions: send Fn key? and detect profile loaded?


"Ed from AZ" <prof_ofwhat@xxxxxx> wrote in message
news:5dae9c76-36e4-4256-ab9a-0c0667053c13@xxxxxx
Quote:

>I have a small script to launch a program on my laptop. I'd like to
> put this script into the startup folder of the profile I use, but I
> don't want the script to run until the laptop has finished booting and
> the profile is completely loaded. Can I detect when the profile is
> finished loading and run the script then? Or perhaps just put in
> several seconds of sleep and make it wait that way?
>
> Also, I'd like to see if I can somehow send a Function (Fn) key
> combination via the script. Will SendKeys work with Fn?
Hi, Ed

In 1998, Rob Blackmore posted the following.

<HTML>
<INPUT TYPE=TEXT NAME="txtField" SIZE=40>
</HTML>

<SCRIPT LANGUAGE="VBScript">

SUB txtField_OnKeyDown
msgbox window.event.keycode
END SUB

</SCRIPT>

Copy the code above to a .htm file, and run it. Put the cursor in the input
box in the HTML window and press various keys. On my Compaq laptop,
pressing the Fn key does not trigger the OnKeyDown event; I think all the
other keys on my keyboard are seen by this event. Hopefully someone will
find a way to do something with the Fn key.


My System SpecsSystem Spec
Old 01-28-2009   #7 (permalink)
Pegasus \(MVP\)


 
 

Re: Two script questions: send Fn key? and detect profile loaded?


"Paul Randall" <paulr90@xxxxxx> wrote in message
news:ODse71XgJHA.5556@xxxxxx
Quote:

>
> "Ed from AZ" <prof_ofwhat@xxxxxx> wrote in message
> news:5dae9c76-36e4-4256-ab9a-0c0667053c13@xxxxxx
Quote:

>>I have a small script to launch a program on my laptop. I'd like to
>> put this script into the startup folder of the profile I use, but I
>> don't want the script to run until the laptop has finished booting and
>> the profile is completely loaded. Can I detect when the profile is
>> finished loading and run the script then? Or perhaps just put in
>> several seconds of sleep and make it wait that way?
>>
>> Also, I'd like to see if I can somehow send a Function (Fn) key
>> combination via the script. Will SendKeys work with Fn?
>
> Hi, Ed
>
> In 1998, Rob Blackmore posted the following.
>
> <HTML>
> <INPUT TYPE=TEXT NAME="txtField" SIZE=40>
> </HTML>
>
> <SCRIPT LANGUAGE="VBScript">
>
> SUB txtField_OnKeyDown
> msgbox window.event.keycode
> END SUB
>
> </SCRIPT>
>
> Copy the code above to a .htm file, and run it. Put the cursor in the
> input box in the HTML window and press various keys. On my Compaq laptop,
> pressing the Fn key does not trigger the OnKeyDown event; I think all the
> other keys on my keyboard are seen by this event. Hopefully someone will
> find a way to do something with the Fn key.
On my Thinkpad the Fn key triggers event 255. But there is more to it when
pressing several keys, one after the other:
- Ctrl 17
- Fn 255
- Fn, then Ctrl 255 255

I suspect that Fn keys are hardwired and need special methods to pick them
up.


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
The User Profile Service failed the logon. User profile cannot be loaded. Tutorials
"Profile not loaded correctly" and other questions Vista General
The User Profile Service failed the logon. User profile cannot be loaded. Vista General
"Your user profile was not loaded correctly" with roaming profile in AD domain Vista General
Vista Roaming Profile Questions (Default Profile & User Folder on Desktop) Vista networking & sharing


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46