Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2007
    Posts
    16

    Please help about the asterisk

    I want to close all opened windows that names are begin with "C:",so the windows name will be "C:\[folder name]"

    Code:
    windows = Window.EnumerateTitles();
    
    window_name = "C:"..**
    for handle, title in windows do
    
        result = String.Find(title, window_name, 1, false);
       
            if (result1 ~= -1) then
            Window.Close(handle, CLOSEWND_SENDMESSAGE);
        end
           
    end
    I tried to replace [folder name] by **,but it didn't work,please help
    Last edited by phucasimo; 08-18-2007 at 11:20 PM.

  2. #2
    Join Date
    Jun 2002
    Location
    Israel
    Posts
    1,843
    If there is no chance of having a window title which includes C: except as directory path , just change:
    window_name = "C:"..**
    to
    window_name = "C:"

    And you have a mistake:
    if (result1 ~= -1) then
    it should be:
    if (result ~= -1) then

    Good luck
    Yossi

  3. #3
    Join Date
    Jul 2007
    Posts
    16
    but it only close the drive C: window,how can i close all windows of folders in drive C:,ex: C:\Firefox, C:\Awasu,...with only one line code,i know about using asterisk as a certain path,maybe it's possible ???

  4. #4
    Join Date
    Apr 2007
    Location
    Mar Sara
    Posts
    292
    Code:
    -- enumerate all the open windows
    local tblOpenWindows = Window.EnumerateTitles();
    
    -- browse hrough the resulting table
    for numWinHanlde, strWinTitle in tblOpenWindows do
    	-- if "C:" is found in the title
    	if String.Find(strWinTitle, "C:", 1, false) ~= -1 then
    		-- send it a message to close
    		Window.Close(numWinHanlde, CLOSEWND_SENDMESSAGE);
    	end
    end
    I added comments to make you notice what for loop does. It will loop through the list and close any windows that have "C:" anywhere in their titles.

  5. #5
    Join Date
    Jul 2007
    Posts
    16
    Thanks alot

Similar Threads

  1. Asterisk In IF statements?
    By cpmusick in forum Setup Factory 6.0
    Replies: 5
    Last Post: 06-17-2003, 02:02 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