Andromo - Start Making Apps - Free Signup

Announcement

Collapse

New Forum Software

If you're here, you've found the new home for our forums. There will be some bugs to iron out, so thanks for your patience...
See more
See less

string help

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.
    Regards,

    -Ron

    Music | Video | Pictures

  • #2
    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
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

    Comment


    • #3
      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?
      Regards,

      -Ron

      Music | Video | Pictures

      Comment


      • #4
        That is how I understand it.
        TJ-Tigger
        "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
        "Draco dormiens nunquam titillandus."
        Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

        Comment


        • #5
          Thanks Tigg, I'll give it a shot. Working on 2 projects at once here.
          Regards,

          -Ron

          Music | Video | Pictures

          Comment


          • #6
            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.
            Regards,

            -Ron

            Music | Video | Pictures

            Comment


            • #7
              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, 06:05 AM.

              Comment

              Working...
              X