Indigo Rose Software

Professional Software Development Tools

 
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 18
  1. #1
    Join Date
    Oct 2002
    Location
    RealFake, RF
    Posts
    403

    How to do a function ONLY if a window is open...need help...

    Hey guys,

    I've been attempting to do a specific function only if a specific window is the TOP Z-order.

    In other words, only if Internet Explorer is the TOP-most (active window), do XYZ.

    So far I can do it if it's running, but I can't find out if it's the active window:

    AllWindows = Window.EnumerateTitles();
    Ignore = "Internet Explorer";
    for CurrentHandle, title in AllWindows do
    TitleSearch = String.Find(title, Ignore, 1, false);
    if (TitleSearch ~= -1) then
    Window.Minimize(CurrentHandle);
    end
    end

    Any ideas guys?

    Protocol
    "White-colla-AMS-gangsta."

  2. #2
    Join Date
    Oct 2002
    Location
    RealFake, RF
    Posts
    403

    ???



    "White-colla-AMS-gangsta."

  3. #3
    Josué Alba Guest
    well you can search the froum or go to:
    http://www.indigorose.com/forums/sho...t=close+window

  4. #4
    Join Date
    Oct 2002
    Location
    RealFake, RF
    Posts
    403

    Re: Blah, blah...

    Thanks Jos,

    But that's just the problem. I've found a lot of posts as well as a great example in the help file in regards to finding out if a window is open, but nothing in regards to wether or not the window is the ACTIVE window (the highest Z-order).

    This is important to make sure I don't close or in any way alter an active window if the user is currently looking at it.

    Any ideas as to how to find out what the active window is?

    Thanks again...


    Protocol
    "White-colla-AMS-gangsta."

  5. #5
    Josué Alba Guest
    Ohoho, sorry I need to read carefullier.
    but I think corey made an example using Z-order but I couldn't found it. I'll have it at home. so if you cannot found it tell me and I'll send it to you.

  6. #6
    Join Date
    Oct 2002
    Location
    RealFake, RF
    Posts
    403

    Re: Blah, blah...

    That's be great...thanks Jos!

    "White-colla-AMS-gangsta."

  7. #7
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Code:
    ActiveWindowHandle = String.ToNumber(DLL.CallFunction(_SystemFolder.."\\User32.dll", "GetForegroundWindow", "", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL))

  8. #8
    Join Date
    Oct 2002
    Location
    RealFake, RF
    Posts
    403

    Re:Blah Blah

    Can it be said enough?

    Worm...You...Are...The...Man.



    Thank you both!

    Protocol
    "White-colla-AMS-gangsta."

  9. #9
    Join Date
    Oct 2002
    Location
    RealFake, RF
    Posts
    403

    Whatta

    Have I got it wrong:

    TopWindow = DLL.CallFunction(_SystemFolder.."\\User32.dll", "GetForegroundWindow", "", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
    Dialog.Message("Notice", TopWindow, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

    This just pops up a 6-digit number. A seemingly random one at that. =(

    So how would I get it to respond from that data? What I want to do is:

    If Internet Explorer is the TOP window, do nothing...but if it's NOT the TOP window...do something.

    Thanks for your help... =|

    Protocol
    "White-colla-AMS-gangsta."

  10. #10
    Josué Alba Guest
    Well I think the 6 numbers are the window handler. The bad news are that I have never been good enoght with that. sorry pal

  11. #11
    SUF6NEWBIE Guest
    The return 'integer' from the dll call is the actual 'window handle'

    you can then control the window with any of the available actions
    relating to Windows (consult the help docs- examples) in this regard.

    eG: Window.Close(ActiveWindowHandle);

    ..just check this action syntax and other options etc

    you just need to refer to the returned window handle in the action to perform
    Last edited by SUF6NEWBIE; 10-20-2004 at 09:27 PM.

  12. #12
    Join Date
    Oct 2002
    Location
    RealFake, RF
    Posts
    403

    Re: Blah, blah...

    Thanks for the suggestions and the code guys...

    The only problem is that I still need to recognize the currently TOP window. From what I've tested, these windows handles don't say which is the TOP window. They may help in deciding which window was opened first, but not the currently active one.

    Again, what I'm trying to do is:

    1) Look at which window is the active window.

    2) Either get the name of that window such as "Internet Explorer" (or even better) get the program name that runs that window (in case it's a pop-up that isn't called "Internet Explorer", but is still using Internet Explorer to view it).

    3) If the name of the window or name of the program running the window is on a given "ignore list", then do nothing. Otherwise, if it's not on the "ignore list", then do something.

    But so far all I can do (using the help file example as well as some of my own) is have it find out if a window is open or not. Even though it works like a charm, it doesn't really help with what I'm doing.

    Worm's little code works, but it seems to only return the window handle (in code form). It doesn't tell me the active window (at least from what I can tell). And if it can, I would need it to do so across the board (meaning that it would have to work of a general number, and not the number assigned by the computer).

    This is because I would need to distribute a program that does XYZ on a window if it's currently the active one and I need a value to work on. I can't program code to say shut down handle number 15366 if that number is session specific (a number randomly assigned by the Windows session.

    For insatance, 15366 might be the active window, but if I close it and reopen it it will show up as another number such as 19494 even though it's the same exact window such as Google's homepage shown in Internet Explorer.

    This is the quandry I'm in. There's a great function in the actions list to SET the Z-Order of active windows, but nothing to GET the Z-Order of the active windows.

    Again, I appreciate your help...any suggestions?

    Protocol

    "White-colla-AMS-gangsta."

  13. #13
    SUF6NEWBIE Guest
    Possibility...have a look at the Enumerate.Proccesses action

    BRETT created a handy bit of script on proccess name targeting..
    Its in the SUF7 Script examples section..may help you out.
    once a 'handle' is known could use the returned table to 'match-id-filter'
    the proccess name with that known 'handle' and go from there..

  14. #14
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Maybe this will help you along.
    Attached Files

  15. #15
    Join Date
    Oct 2002
    Location
    RealFake, RF
    Posts
    403

    You did it!

    You did it!

    Woohoo!

    ...

    Woohoo!

    Thanks for everyone's help. I appreciate it. Additionally, Worm...your a savior...as always.

    Let me know if I can return the favor...

    Protocol
    "White-colla-AMS-gangsta."

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Function: Resize an Image to Fit your Project Window
    By Adam in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 06-03-2004, 11:55 AM
  2. Function: Center window on screen
    By Ted Sullivan in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 05-07-2004, 02:19 PM
  3. open internet explorer window
    By josecastello in forum AutoPlay Media Studio 4.0
    Replies: 3
    Last Post: 06-19-2003, 02:14 AM
  4. How to open a web page in pop up window?
    By livio in forum AutoPlay Media Studio 4.0
    Replies: 11
    Last Post: 09-16-2002, 01:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts