Jump to content

Stephen_C

Community Hero
  • Posts

    1,432
  • Joined

  • Last visited

  • Days Won

    72

Posts posted by Stephen_C

  1. 27 minutes ago, mathieudaudelin said:

    My Clipboard History holds 10 items (raw text words), which I frequently rely on and use through my day

    This is just a thought, which may be completely off-track, but couldn't you use Snippets for those items rather than copying them from the clipboard history all the time?

     

    Sorry if that's not helpful!

     

    Stephen

  2. This is a rather basic workflow (primarily an AppleScript script) designed to facilitate logging on to sites which require you to input specified characters from your mother's maiden name, the name of your first school, a memorable date, etc. Some of us use password managers which don't show the numbering of the characters and this workflow is designed to help. I've never used GitHub and certainly don't think this worth "hosting" so please excuse the way in which it's presented. (I shall probably get into trouble for that! 😀.)

     

    It looks like this:

     

    Workflow.jpg.472b677cca6113fb1bd6eb80019b08dc.jpg

     

    First copy the relevant word to the clipboard from your password manager. The Keyword (I used "gc" for Get characters) to trigger the workflow has no argument and the script will prompt you to provide the numbers of the characters you need (with a space between each number). This is the script:

     

    try
        -- get the word from the clipboard
        set theWord to the clipboard
        -- keep it as a title to the dialogue
        set titleWord to theWord
        -- split the word into characters as a list
        set listChars to characters of theWord as list
        -- get the length of the character list
        set lenList to length of listChars
        -- an empty variable to store the characters we need
        set existingChars to ""
        -- set a default answer to demonstrate correct input
        set dAnswer to "1 3 6"
        -- ensure the dialogue shows the word and max. no. of characters
        set userEntry to display dialog ¬
            "Enter the 3 numbers of the characters you want from " & "'" & titleWord & "'" & " with a space between each:" default answer dAnswer with title "Get characters from " & "'" & titleWord & "'" & "(" & "max. " & lenList & " characters" & ")"
        -- get the dialogue input
        set dAnswer to text returned of userEntry
        set astid to AppleScript's text item delimiters
        -- we are splitting the input numbers by the space character
        set AppleScript's text item delimiters to " "
        -- create a list of the input numbers
        set answerList to text items of dAnswer
        set AppleScript's text item delimiters to astid
        -- set variable to check the last number input is not > than number of characters in word
        set overFlow to item -1 of answerList as integer
        -- check the last input number isn't greater than number of characters in the word
        if overFlow is greater than lenList then
            error "There are not " & overFlow & " characters in " & "'" & titleWord & "'"
        end if
        -- now loop for each number in input
        repeat with i from 1 to (length of answerList)
            -- set each number against the appropriate character of the word
            set seekChar to item i of answerList as integer
            if existingChars is "" then
                set existingChars to item seekChar of listChars
            else
                -- add it if we already have a character
                set existingChars to existingChars & " " & item seekChar of listChars
            end if
        end repeat
        return existingChars
        
    on error error_message number error_number
        if error_number is -1700 then
        set error_message to "Please ensure there is only a space between the numbers"
        return error_message
        else
        if the error_number is not -128 then return error_message
        -- substitute the following line if not running in an Alfred workflow
        -- if the error_number is not -128 then display alert "Error" message error_message as warning
        end if
    end try

     

    The script traps certain errors (including incorrect input format or a number greater than the number of characters in the word).

     

    I don't know if this will be useful for anyone else but I use it a fair bit.

     

    Stephen

  3. 2 hours ago, Belfong said:

    It also seems I can’t exclude Folders from being search. I could have sworn I’ve seen this before. 

    You can use a file filter input to do that. From the page to which I have linked:

     

    Quote

    A file filter allows you to narrow down your search to particular file types you want to find, making it easier to locate the file you need.

    Rather than add every possible file type to your default Alfred results, or trawl through an unfiltered list of all files that match your search term, these finely focused filters will help you find the results you need in a moment.

     

     

    As an alternative, if you run your search a few times and always select the file you need (i.e., the 2022 file) Alfred will remember that and soon it will appear top of your search results.

     

    No doubt there are other ways to achieve what you need but these are the first that occurred to me. I hope they help.

     

    Stephen

  4. Without intending to sound sycophantic, I just wanted to thank Andrew (and Vero) for, not only the development and release of Alfred 5 (which is a significant, and much appreciated, step forward), but the constant, considerate and always responsive support provided on these forums.

     

    It's because of the continuing development and the support here that I am intensely loyal to Alfred.

     

    Thank you.

     

    Stephen

×
×
  • Create New...