Author |
|
rmackay Groupie
Joined: December 15 2003 Location: United States
Online Status: Offline Posts: 28
|
Posted: January 30 2004 at 00:58 | IP Logged
|
|
|
Where do I find documentation on how to code the sendkeys function? I want to sent an Alt-F4. How do I specify that in the function?
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: January 30 2004 at 13:45 | IP Logged
|
|
|
In the manual, page 36...
"{alt+F4}" should work.
Tony
|
Back to Top |
|
|
rmackay Groupie
Joined: December 15 2003 Location: United States
Online Status: Offline Posts: 28
|
Posted: February 25 2004 at 16:53 | IP Logged
|
|
|
Ok - I got a stumper... in a test scenario, I thought it would be cool to have my office PC shoo away unauthorized visitors. So, when I leave for the night I set a global var to 1 which 'arms' my system. I then have a motion sensor that when motion is detected, waits 15 seconds for a dis-arm, if not, it fires on my desk lamps and using TTS, instructs the visitor to leave the office at once.
The problem is when I arm the system. I currently have a macro (triggered by a remote) that announces the systems is armed and sets the global variable. I also want it to do a send keys to lock my PC for me. To do this, I need to send a Ctrl-Alt-Delete, and then send a 'k'. However, I can not get
ph_sendkeys("{ctrl+alt+delete}k")
to work at all. Any suggestions?
Thank you - Robert
|
Back to Top |
|
|
mustangcoupe Super User
Joined: August 08 2003 Location: United States
Online Status: Offline Posts: 308
|
Posted: February 25 2004 at 17:59 | IP Logged
|
|
|
robert,
Are you trying to send crtl-alt-del K at the same time...
If not I bleive you have to make those two different lines..... And if power home used the same syntex as VB then isnt it going to be
ph_sendkeys("^%{del}"),true ph_sendkeys("K)
^ = ctrl and % = alt
Todd
__________________ Todd Hannemann
HA newbie
PowerHome - UPB - ELK
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: February 25 2004 at 18:57 | IP Logged
|
|
|
Robert,
Well, the Control-Alt-Delete combination cant be simulated with a Sendkeys. You've got the right syntax if it could, but from the research Ive done on the web, this just doesnt work.
However, I do know how you can do it. Use the following formula:
ph_run("Rundll32.exe user32.dll,LockWorkStation")
This will automatically lock your workstation down.
Hope this helps,
Dave.
|
Back to Top |
|
|
rmackay Groupie
Joined: December 15 2003 Location: United States
Online Status: Offline Posts: 28
|
Posted: February 26 2004 at 00:05 | IP Logged
|
|
|
AWESOME! ph_run("Rundll32.exe user32.dll,LockWorkStation") is exactly what I needed! Thank you!
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: February 26 2004 at 10:05 | IP Logged
|
|
|
Robert,
Glad it worked. Just let me know if you have any other questions like that and I'll be glad to help.
Dave.
|
Back to Top |
|
|
rmackay Groupie
Joined: December 15 2003 Location: United States
Online Status: Offline Posts: 28
|
Posted: February 26 2004 at 10:25 | IP Logged
|
|
|
I'll take you up on that offer. Is there anyway to flag a macro to run on startup of PowerHome? Like an autoexec.bat type of thing? If my PC recycles when I am not there, I want Powerhome to start with certain values for the variables, etc.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: February 26 2004 at 10:39 | IP Logged
|
|
|
Robert,
Thats an easy one...Just create a macro with an ID of STARTUP. This macro is automatically executed anytime PowerHome is started.
The next release will also run any macro labeled SHUTDOWN when PowerHome is shutdown.
Dave.
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: February 26 2004 at 13:10 | IP Logged
|
|
|
"The next release will also run any macro labeled SHUTDOWN when PowerHome is shutdown"
Darn good idea!
|
Back to Top |
|
|
hscehome Newbie
Joined: May 24 2004 Location: United States
Online Status: Offline Posts: 3
|
Posted: June 08 2004 at 17:35 | IP Logged
|
|
|
I am looking to use powerhome to control my sage tv i want to be able to move through the menus and select options... how do i move up and down or simulate pushing the up arrow key or down arrow key and for selection i've tried to send key "{enter}" but it doesnt work could i be missing something
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: June 09 2004 at 10:34 | IP Logged
|
|
|
When using sendkeys, the application that you are trying to control must have focus. You want to do this with the switchto macro command or formula function. An example using formulas is below:
ph_switchto("Title of the Sage Window",1) + ph_sendkeys("{downarrow}{downarrow}{enter}")
The above formula will give the Sage Window focus and then simulate the down arrow key being pressed twice followed by the enter key. When using the ph_switchto function, you can search either by the title of the window or the class name. You can use various freeware utilities found on the web to find out the class name of a window. If you do search by classname, the second parameter must be a 0.
HTH,
Dave.
|
Back to Top |
|
|