Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

Search for files

Description
This script will prompt for some text and then search the directory specified in the searchPath variable.
Language
C#.net
Minimum Version
Created By
KarolPiechoczek
Contributors
-
Date Created
20d ago
Date Last Modified
17h ago

Scripted Function (Macro) Code

using System;
using System.Diagnostics;
using System.Threading;
using System.Windows.Forms;

public class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        // Define your directories here
        string[] directories = {
            @"C:\ExampleDir1",
            @"C:\ExampleDir2",
            @"C:\ExampleDir3"
        };
        
        string selectedDir = BFS.Dialog.GetUserInputList("Select directory to search:", directories);
        
        if (string.IsNullOrEmpty(selectedDir))
            return;
        
        string filename = BFS.Dialog.GetUserInput("I'm looking for...", "");
        
        if (string.IsNullOrEmpty(filename))
            return;
        
        try
        {
            Process.Start("explorer.exe", $"\"{selectedDir}\"");
            Thread.Sleep(1000);
            
            BFS.Input.SendKeys("^f");
            Thread.Sleep(500);
            
            SendKeys.SendWait($"*{filename}*");
        }
        catch (Exception ex)
        {
            BFS.Dialog.ShowMessageError($"Error: {ex.Message}");
        }
    }
}