Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: How to Close a Window??? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: September 30 2006 at 16:39 | IP Logged Quote smarty

I am using a combination of PowerHome and Xlobby to interact with Winamp. I use Powerhome to display and annouce the current radio station. I use Xlobby's Shoutcast plugin to "dial into" many different radio stations. The plugin does this by sending Winamp a "*.PLS" file to "find" the radio station.

Here is the problem: Periodically, Winamp will open a dialogue box (Winamp - Open Files). I guess this occurs when the radio station is not available or when the plugin sends bad ".PLS" information and Winamp freaks out.

Anyway, this open dialogue box causes any of my other PowerHome announcments to get screwed up (they form a queue until the dialogue box is closed).

What I would like to do is use an "If" statement to see if this window is open (each time after a radio station change) and then close it.

Is there a way to do this from within Powerhome?

__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: September 30 2006 at 17:56 | IP Logged Quote TonyNo

You could use the Window Spy to first get the window's handle then check for it with ph_findwindow.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: October 01 2006 at 11:13 | IP Logged Quote smarty

Yes, Window Spy or Girdier would give the classname or title of the window for the function "ph_findwindow". "ph_finwindow" would then tell me if the window is open or not (1/2 of the battle).

I hope I am not missing the obvious, but I am stuck on how I would actually close the window if I detect that it has opened. I am missing something....

__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: October 01 2006 at 12:48 | IP Logged Quote TonyNo

Oh! You could try ph_switchto( s, n ) then ph_sendkeys("{esc}").

Edited by TonyNo - October 01 2006 at 15:37
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: October 01 2006 at 14:22 | IP Logged Quote smarty

Making some progress.....

I am now able to detect if the window is open (or not), and I am able to "switch to it/bring it to present focus".

However, the ph_sendkeys("{ESC}") does not seem to close it.

If I simply hit the "Esc" keyboard key, the window does close. So, it seems that I am not able to effectively transfer the escape key to the "in focus" window.

Thoughts????

Here is part of my macro:

if(ph_findwindow("Open file(s)",1)>0, 1, 999)
ph_switchto("Open file(s)",1)
Wait 1
ph_sendkeys("{ESC}")




__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: October 01 2006 at 14:33 | IP Logged Quote smarty

NEVER MIND!!!!

{ESC} should NOT be in all CAPS. It should be {esc}.



__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: October 01 2006 at 15:38 | IP Logged Quote TonyNo

Sorry about that. Post updated.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: October 01 2006 at 17:06 | IP Logged Quote smarty

Forgot to say THANKYOU!!

Your help is VERY MUCH appreciated.

__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum