-
Posts
8 -
Joined
-
Last visited
-
Days Won
1
Content Type
Blogs
Gallery
Downloads
Events
Profiles
Forums
Articles
Media Demo
Posts posted by Donald786
-
-
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_linkend 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" ??
-
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
-
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.
-
5 hours ago, vitor said:
I did see this, but I do not want to sync my preferences with another MAC. I would like to be able to backup only workflows so I can recover one if I needed to. Not all the preferences in one unreadable file. Maybe they need to add a "backup workflow" feature...
-
Only tested on a MAC/Big Sur 11.6.3
1. Select some text,
2. press the keyboard shortcut (CMD+4 in example), and
3. CR/LF characters will be removed from text
4. the result will go to the clipboard
5. use CNTRL V to paste in in Obsidian.
Donald Chandonnet -
Wow, I have my first workflow working! Thanks. How do you backup the workflows installed in Alfred? Is there an easier way than exporting each one individually?
Donald
-
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!
Remove CR/LF From Selected Text -MAC
in Share your Workflows
Posted
I found a better way to do this. CNTL + N directly in Obsidian! Remove New Lines. Don't install my utility. Use this instead. Have fun.