Jump to content

Donald786

Member
  • Posts

    8
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Donald786

  1. Thanks. I tried the line you gave me above, but got compile errors... nevertheless, I did hack through this code that seems to work fine:

     

    on alfred_script(q)

    # Get selected file name from Finder
    # ==================================
    tell application "Finder"
        set theItems to selection
        --display dialog number of theItems
        repeat with itemRef in theItems
            --display dialog (get name of itemRef)
            set file_name to (get name of itemRef)
            --display dialog "file_name is " & file_name
        end repeat
    end tell
    # the selection is now in var: file_name
    # ======================================
    --display dialog "file_name is " & file_name
            set the var_ValueX to the file_name
            set var_link to "[" & var_ValueX & "]" & "(<file:///Volumes/Drobo/linked_files/" & file_name & ">)"
            set the clipboard to var_link
            --display dialog var_link

    end alfred_script

     

     

    My problem in the workflow now is to move the file from it's location on the MAC to my hard drive. I was trying to set a workflow variable

    from my applescript so I could read it into a bash script that would move the file, but I got stuck there too.

    Allthough I used the same name for the variable (1) in my applescript, and (2) in the Workflow Environment Variables,

    the variable value is not set by the applescript. ??

     

    Maybe there is another way to fet the filename and then move it to "Volumes/Drobo/linked_files" ??

  2. I would like to select a filename and put this name into an applescript to reformat it into a hard-link that I would place in an obsidian document.

    The script would then move the file to the external drive.

     

    The link could open the external file from an obsidian note... something like: [BookXXX](<file:///Volumes/Drobo/linked_files/BookXXX>)

     

    so far my test script works, but I have not figured out how to set var "file_name" from the selection coming from outside the script 

     

     

    set file_name to "test_file"

    display dialog "what do you what to call this link?" default answer "a_file"

    set the var_ValueX to the text returned of the result

    set var_link to "[" & var_ValueX & "]" & "(<file:///Volumes/Drobo/linked_files/" & file_name & ">)"

    display dialog var_link

  3. I uploaded Version2 of this utility. I use it to clean up text created by an OCR program. The OCR output has lots of CR/LF characters and hyphenated sentences. The utility removes the line breaks and makes editing much less work.

     

    Version 2 of the utility pastes the cleaned text back into the original selection in Obsidian.

    No more need to CNT+V to paste text.

     

  4. I am new with Alfred, and certainly not a programmer, but

    I would like to create a workflow to strip out CR/LF

    characters from text files I have pasted into Obsidian.

     

    What input would I use from Alfred to get the contents of the selected text

    into a variable to send to a script?

     

    Maybe I'd have to run an apple script ?

    I found this discussion: https://apple.stackexchange.com/questions/271161/how-to-get-the-selected-text-into-an-applescript-without-copying-the-text-to-th

    but maybe there are simpler ways to get it into Alfred...

     

    any advice?

    ----- I found a way using bash

    $@ gives you access to the arguments passed from a text selection.

     

    I made the workflow!

     

×
×
  • Create New...