Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 11 of 11
  1. #1
    Join Date
    Apr 2006
    Posts
    12

    WndHandle, Get a partial title

    http://www.indigorose.com/forums/sho...ight=WndHandle
    For example, to close this window (indigorose forums), i used the following code and it worked:


    Code:
    windows = Window.EnumerateTitles(); 
    window_name = "stopping a program - Indigo Rose Software Forums - Mozilla Firefox"; 
    for handle, title in windows do result = String.Find(title, window_name, 1, false); 
    if (result ~= -1) then Window.Close(handle, CLOSEWND_SENDMESSAGE); 
    end 
    end

    If you are using firefox, it should work perfectly with you

    Is it possible for me just to search for just to have
    Code:
    window_name = "stopping a program - Indigo Rose Software Forums"
    Because they may not use Firefox =P

  2. #2
    Join Date
    Nov 2005
    Location
    Banned by moderator.
    Posts
    264
    Yes, it is. Just replace the string and it will work.

  3. #3
    Join Date
    Apr 2006
    Posts
    12
    Still lost so how would I wildcard the title?

  4. #4
    Join Date
    Dec 2003
    Posts
    891
    do a string.replace action

    windows = Window.EnumerateTitles();
    window_name = "stopping a program - Indigo Rose Software Forums - Mozilla Firefox";
    sWindowName = String.Replace(window_name, " - Mozilla Firefox", "", false);
    for handle, title in windows do result = String.Find(title, sWindowName, 1, false);
    if (result ~= -1) then Window.Close(handle, CLOSEWND_SENDMESSAGE);
    end
    end

    Actually, the first word in the window title is all you neeed, the rest are redundant.
    Last edited by Roboblue; 04-13-2006 at 09:52 AM.

  5. #5
    Join Date
    Nov 2005
    Location
    Banned by moderator.
    Posts
    264
    You don't need. The String.Find action will search for what you gave it.

  6. #6
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Volt, String.Find searches for any instance of the characters you feed it. If you want to omit the " - Mozilla Firefox" from your title, any window that has
    "stopping a program - Indigo Rose Software Forums" in the title would close. Think of it as a substring search.

  7. #7
    Join Date
    Nov 2005
    Location
    Banned by moderator.
    Posts
    264
    Worm, I was faster

  8. #8
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    That'll teach not to actually try to explain why rather than blurting out the answer

  9. #9
    Join Date
    Apr 2006
    Posts
    12
    Ok, I understand now!!

    Thank You all!!

  10. #10
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Quote Originally Posted by Worm
    That'll teach not to actually try to explain why rather than blurting out the answer
    Worm it was worth the extra minute (literally!).

    Intrigued

  11. #11
    Join Date
    Oct 2005
    Location
    American Dubai
    Posts
    629
    "Being fast and not very spatial doesn't make you any better in spatial kinds of things; you probably just get the wrong answer more quickly."
    Howard Gardner

Similar Threads

  1. Custom title in the Title Bar...
    By cscorp in forum AutoPlay Media Studio 5.0
    Replies: 3
    Last Post: 07-15-2005, 12:28 PM
  2. Example: Animating the Window Title Text
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 05-13-2004, 01:30 PM
  3. Changing the Title Bar Text
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 10-03-2003, 02:28 PM
  4. Hiding the Title Bar
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 10-01-2003, 02:26 PM
  5. How to add an icon to the active title window...
    By darylsewell in forum AutoPlay Media Studio 4.0
    Replies: 6
    Last Post: 12-12-2002, 12:24 AM

Posting Permissions

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