Jump to content

Recommended Posts

This workflow is a work in progress. As I come up with more things I want to do with Folding Text program, I will be adding to this workflow. If there is something you would like to see added, just let me know. Most of the functions I found on the FoldingText website and compiled them here for easy use.

 

Just added very flexible bookmarking. Give it a try.

 

ft:autofocus 
This does the autofocus workflow. Move the todo at the current cursor to the bottom most "# Autofocus.todo" list. It creates one if there is not one.
 
ft:next 
Find the "@next" todo tag, makes it @done, and sets the next todo as @next.
 
ft:marked 
Open the current file in Marked.app
 
ft:tagremove 
Gives a list of tags in the current document and will remove all the ones selected in the list.
 
ft:safari 
This gets the tabs in the current Safari Web Browser and copies their addresses to the topmost FoldingText document.
 
ft:chrome 
This gets the tabs in the current Chrome Web Browser and copies their addresses to the topmost FoldingText document.
 
ft:countunfolded 
This will count all the characters, words, and lines of text that is not folded. Great for geting word counts of an article with all non-essential areas folded away!
 
ft:getvisible 
This copies all the unfolded text to the clipboard.
 
ft:open 
This will allow you to open any FoldingText, Markdown, or plain txt files in your home directory. It looks for the ‘ft’, ‘md’, ‘txt’ extensions.
 
ft:gototag 
This will list every tag in the topmost document. When you select one, all lines without that tag are folded away. Place the cursor in a line and unfold and you are there in the document.
 
ft:openfilelist 
This will open every file you have in the FoldingText file list.
 
ft:AddFile 
This file action allows you to place files in to your FoldingText file list.
 
ft:showfiles 
This shows you every file in your file list. Selecting one will open just that one file, or bring it to the front if it is already open. Select a file with cmd and the file will be taken off the list (but not touched on the HD).
 
ft:docs 
This gives a list of FoldingText documentation documents you can select and open.
 
ft:addurihandler
This adds a system script to handle "ftdoc://" URIs by loading the file specified in FoldingText. It works to launch bookmarks to files and a location in the file.
 
ft:mbkmark
This gets a URI for the current cursor location in the topmost FoldingText document and adds it to the bookmark list. You have to supply a name for the bookmark.
 
ft:bookmarks
This shows every bookmark and allows you to open it, remove it (function key), or create a markdown link to the bookmark and paste into the topmost application (command key).
 
ft:inbox
This allows you to add a message line to the end of a block with the @inbox tag.
 
ft:notetag
This one will get a list of tags in the top FoldingText document. The user can select a tag and then give a message. That message will be added to the end of that tag node.
 
Site Layout
This is a File Action that you can trigger in the Alfred browser on directories only. When you run it, it creates a file of the directory structure there down with clickable links to each file for FoldingText. You have to have the FoldingText URI handler installed. Once created, it will open the file in FoldingText. This now adds Alfred URI handler action calls to open the directory in Alfred browser and open other files in it's default application.
 
ft:lastsitelayout

This will open the last generated site layout from the above command.

 

Set Tag File Directory
This sets the current directory in the Alfred Browser to the directory for creating tag search files.

Create Tag File
This will take the directory in Alfred Browser and search for files with the ft extensions. Those files will be listed with the lines containing the tag set using the ft:setsearchtag command.

 

ft:setsearchtag
This is used for the create tag files directory command for the Alfred browser. This command allows you to add or remove tags to search.

 

GitHub: https://github.com/raguay/MyAlfred/blob/master/FoldingTextWorkflow.alfredworkflow

Packal: http://www.packal.org/workflow/folding-text-workflow

Edited by raguay.customct

Share this post


Link to post
 

if you want to add it, writes safari's tabs to frontmost foldingtext window or opens the app if necessary.

-- All code grabbed and requested help with from generous parties and unsuspecting github users.
--
-- Create Markdown link from front most tab in safari and append
-- to end of current FoldingText document as new list item.
-- UNCOMMENT FOR USE IN ALFRED
on alfred_script(q)
--on run
	
	-- -- -- -- -- -- -- -- --
	--
	-- BEGIN - INSERT ROUNDED TIME FUNCTION
	--
	-- SHOULD MAKE IT A LIBRARY 
	-- i.e. path from "go to file" or clintxs' "getCurrentDocument()"
	--
	-- -- -- -- -- -- -- -- --
	
	-- https://gist.github.com/Zettt/1081322
	--
	-- Inserts rounded time (15 minutes). Can be called from, e.g. TextExpander. (AppleScript version)
	
	-- AM/PM script by - http://forums.macrumors.com/showpost.php?p=9845114&postcount=2
	
	set currentHour to hours of (current date)
	set currentMinute to minutes of (current date)
	set pre to "AM" -- AM/PM script addition
	if (currentHour > 12) then -- AM/PM script addition
		set currentHour to (currentHour - 12) -- AM/PM script addition
		set pre to "PM" -- AM/PM script addition
	end if -- AM/PM script addition
	
	if (currentHour ≥ 0) and (currentHour < 10) then
		set currentHour to "0" & currentHour
	end if
	
	if (currentMinute ≥ 0) and (currentMinute ≤ 7) then
		set currentMinute to "00"
	else if (currentMinute > 7) and (currentMinute ≤ 23) then
		set currentMinute to "15"
	else if (currentMinute > 23) and (currentMinute ≤ 37) then
		set currentMinute to "30"
	else if (currentMinute > 37) and (currentMinute ≤ 52) then
		set currentMinute to "45"
	else if (currentMinute > 52) then
		set currentMinute to "00"
		set currentHour to currentHour + 1
		----Get "AM or PM"
		--set Pos to offset of " " in timeStr
		--set theSfx to characters (Pos + 1) through end of timeStr as string
	else
		return "Error"
	end if
	
	-- return (currentHour as string) & ":" & (currentMinute as string)
	
	-- -- -- -- -- -- -- -- --
	--
	-- END - INSERT ROUNDED TIME FUNCTION BEGIN
	--
	-- -- -- -- -- -- -- -- ----
	
	
	set time_stamp_rounded to (currentHour as string) & ":" & (currentMinute as string) & (pre as string) -- & " " & (pre as string) -- AM/PM script addition
	-- return time_stamp_rounded
	
	set the date_stamp to (short date string of (current date))
	set parentText to ("# ") & time_stamp_rounded & " - " & the date_stamp & return & ("### Safari Tabs") & " - " & " @ta	g1" & return
	
	
	## ") & time_stamp_rounded & " - " & the date_stamp & " - " & ("Safari Tabs") & " @linklist" & return
	set MDLink to ""
	tell application "Safari"
		set safariWindow to window 1
		try
			repeat with t in (tabs of safariWindow)
				set TabTitle to (name of t)
				set TabURL to (URL of t) as text
				set MDLink to (MDLink & (" - [" & TabTitle & "]" & "(" & TabURL & ") ") & return)
			end repeat
		end try
	end tell
	tell application "FoldingText"
		tell front document
			evaluate script "function(editor, options) {
                var tree = editor.tree();
                var range = tree.createRangeFromLocation(tree.textLength(), 0);
                tree.replaceTextInRange(range, options.link);
            }" with options {link:(parentText & MDLink)}
		end tell
	end tell
--end run
end alfred_script

Share this post


Link to post

Added it. Thanks. Any thing else? Is it possible to make generic for any browser? I am not too good with AppleScript. Chrome at least?

Edited by raguay.customct

Share this post


Link to post

Never mind. I figured it out. It was easier than it looked. Starting to get used to AppleScript. But JavaScript and Swift are so much easier!!!

 

 

AppleScript is utterly insane. I'm so happy they've added JavaScript in Yosemite. I don't like JavaScript at all, but hey, it ain't AppleScript  :)

Share this post


Link to post

Just added flexible bookmarking. It keeps a list and allows you to paste them in markdown link format. Very handy. Give it a try!

 

BTW: You have to run ft:addurihandler  first to get bookmarking to work. This adds a URI handler for the ftdoc:// URI.

 

Thanks to Robin Trew for supplying the handler and the AppleScript for generating bookmarks.

 

https://github.com/RobTrew/txtquery-tools/

Edited by raguay.customct

Share this post


Link to post

This is off-topic but are you finding FoldingText ready for prime time?  I have pretty much dropped HogBay software after some incomprehensible design decisions in WriteRoom 2-> 3 (a shame b/c WriteRoom kind of defined the distraction-free writing market niche, then lost it to better competitors....) and the end of development of TaskPaper on iOS (but I love the format -- just using Editorial)....all except TaskPaper on the Mac.  My impression was that a lot of development time was being spent on FoldingText to the neglect of other projects, but FT itself was getting hammered by App Store reviewers so I left it alone.  Would love to hear what you think of it.

Share this post


Link to post

The latest version of FoldingText is really good. And, you can expand it with JavaScript as you need. I am really liking it. It does todo lists, timers, and of course text folding. You can add more types of processing also. I use it to write my tutorials, fold the text I do not want in a word count, and run my Alfred script to count unfold text areas. Works great!

 

The TaskPaper 3 is coming out soon. It will be a complete revamp done off of the FoldingText base. I believe WriteRoom will be revamped soon also.

 

The idea he has is FoldingText is the main one and the others are smaller pieces of the larger FoldingText. Another company said they were going to make an IOS version completely compatible with TaskPaper. Hogbay just could not keep supporting IOS with their staff.

Share this post


Link to post

Hi,

 

Just added two new commands to this workflow:

 

ft:inbox
This allows you to add a message line to the end of a block with the @inbox tag.
 
ft:notetag
This one will get a list of tags in the top FoldingText document. The user can select a tag and then give a message. That message will be added to the end of that tag node.
 
Try them out and let me know how they work for you.

Share this post


Link to post

I just added the Site Layout  file action that will trigger on just directories in the Alfred browser. When triggered, it will create a site map from that directory down in a FoldingText file call layout.ft in the directory actioned. That file will label each directory with a @dir tag and each file with a @file tag. Each file will be indented as to the directory it it in. Also, all directories will be linked to open in Finder and FoldingText openable files will be tagged to open in FoldingText. 

 

This makes a great way to open files in my flat file system markdown CMS! It is also great for documenting my tutorial writing directories and such. Give it a try and let me know if it is useful or not. It is for me!

Share this post


Link to post

This is off-topic but are you finding FoldingText ready for prime time?  I have pretty much dropped HogBay software after some incomprehensible design decisions in WriteRoom 2-> 3 (a shame b/c WriteRoom kind of defined the distraction-free writing market niche, then lost it to better competitors....) and the end of development of TaskPaper on iOS (but I love the format -- just using Editorial)....all except TaskPaper on the Mac.  My impression was that a lot of development time was being spent on FoldingText to the neglect of other projects, but FT itself was getting hammered by App Store reviewers so I left it alone.  Would love to hear what you think of it.

 

Hey, I added an extension for FoldingText that allows you to do math similar to Calca. It is more stable than Calca (Calca still jitters when scrolling or adding to a large document) and does the math I need. It is the imath extension:  http://customct.com/foldingtext

 

Give it a try!

Share this post


Link to post

I updated the Site Layout function to add leading "#" on the directories to make folding them easier. I also added a link to the FoldingText URI standard documentation to the "ft:docs" script filter. Enjoy!

Share this post


Link to post

Just updated to new functionality that allows you to create a list of tag and then search for all files with those tags. It is assuming you have added the Alfred URI handler and installed the foldingtext node.js command globally:

 

npm install foldingtext -g

Share this post


Link to post

I just updated this workflow by increasing the intelligence of the ft:bookmarks command. If you type partial parts of a title with spaces between, it will wildcard match for the title.

 

For example:

 

ft:bookmarks tut cro

 

will match

 

Tutorial: Cross-platform Application Development

 

Since my bookmark list is over 100, I needed better searching!

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...