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?

Multiple Password Generator

Description
Generates multiple passwords.
Language
C#.net
Minimum Version
Created By
jackz98
Contributors
-
Date Created
Aug 29, 2019
Date Last Modified
Sep 3, 2019

Macro Code

using System;
using System.Text;
// The 'text' parameter will contain the text from the:
//   - Current Clipboard when run by HotKey
//   - History Item when run from the History Menu
// The returned string will be:
//   - Placed directly on the Clipboard
//   - Ignored by ClipboardFusion if it is 'null'
public static class ClipboardFusionHelper
{
    public static string ProcessText(string text)
    {
        // your code goes here
        // Input how many passwords you want to generate
        string input = BFS.Dialog.GetUserInput("How many passwords?", "");
        int n;
        bool test = int.TryParse(input, out n);

        if (test)
        {
            StringBuilder builder = new StringBuilder(17 * n);
            for (int i = 0; i < n; ++i)
            {
                builder.Append(System.Web.Security.Membership.GeneratePassword(16, 1));
                builder.Append(System.Environment.NewLine);
            }
            BFS.ClipboardFusion.PauseClipboardListener();
            BFS.Clipboard.PasteText(builder.ToString());
            BFS.Clipboard.Clear();
            BFS.ClipboardFusion.ResumeClipboardListener();
        }
        return null;
    }
}