Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 7 of 7

Thread: string help

  1. #1
    Join Date
    Aug 2003
    Location
    Maine, USA
    Posts
    1,695

    string help

    Need a push on String.*

    Can you use wildcards in any way to locate a string? I tried the below and it doesn't seem to work -

    function screen()
    document = Window.EnumerateProcesses(false);
    for handle, title in document do
    result = String.Find(title, "*.doc", 1, false);
    if (result ~= -1) then
    Window.Close(handle, CLOSEWND_TERMINATE);
    end
    end

    I even tried the string.left and/or right -

    function screen()
    document = Window.EnumerateProcesses(false);
    for handle, title in document do
    result = String.Right(title, "doc", 3, false);
    if (result ~= -1) then
    Window.Close(handle, CLOSEWND_TERMINATE);
    end
    end

    These crashed my computer :confused:

    I'm just trying to look for any process that has the doc extension (sample only) and "do" the results. Thanks.

  2. #2
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    If you are searching for a microsoft work window try searching for "*- Microsoft Word" in your search string. I don't believe that .doc actually makes it into the title of the window.

    Tigg

  3. #3
    Join Date
    Aug 2003
    Location
    Maine, USA
    Posts
    1,695
    LOL, I'm sot searching for a doc extension, I just used that as an example, sorry. But I noticed that you used "* - string". Would this be correct to search for a partial string?

  4. #4
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    That is how I understand it.

  5. #5
    Join Date
    Aug 2003
    Location
    Maine, USA
    Posts
    1,695
    Thanks Tigg, I'll give it a shot. Working on 2 projects at once here.

  6. #6
    Join Date
    Aug 2003
    Location
    Maine, USA
    Posts
    1,695
    Hmm, didn't work Tigg. I've studied all the string functions, and can't find one that searches partial. Like if I wanted to say, search for everything with "system" in a process. It seems you could just use "*system*", but no workie. There's gotta be a way.

  7. #7
    Join Date
    Jun 2002
    Posts
    42
    Hi.

    With the String.Find action, I don't think you need a wildcard character at all - it is automatically searching for a sub-string within the string, returning the position it is found. In the FOR loop example mentioned, the following would close all Windows with .doc in the title:

    function screen()
    document = Window.EnumerateProcesses();
    for handle, title in document do
    result = String.Find(title, ".doc", 1, false);
    if (result ~= -1) then
    Window.Close(handle, CLOSEWND_TERMINATE);
    end
    end
    end

    Hope that helps.
    CW
    Last edited by CWRIGHT; 02-02-2004 at 05:05 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