I want my task paper to load “my.taskpaper” file by default. how can i set the file(“my.taskpaper”) for default loading?
One approach would be to make a custom launcher – a script or icon on your desktop, for example, or a keyboard shortcut, which combines Taskpaper launch with loading a particular file.
You could, for example,
- copy the full source code below (right down to the bottom of the scrolling code panel),
- paste it into Script Editor, and set the language tab at top left to Javascript,
- save it as a script file for use with FastScripts or Keyboard Maestro etc, or as an application file to create a clickable icon on your desktop.
https://guide.taskpaper.com/using-taskpaper/using-scripts.html
(() => {
'use strict';
const strPath = '~/my.taskpaper'
const main = () => {
const
fp = filePath(strPath),
tp3 = Application('Taskpaper');
return (
// Taskpaper file found or created
doesFileExist(fp) || standardAdditions()
.doShellScript('touch "' + fp + '"'),
tp3.open(fp),
tp3.activate(),
fp
);
};
// standardAdditions :: () -> Application
const standardAdditions = () =>
Object.assign(Application.currentApplication(), {
includeStandardAdditions: true
});
// doesFileExist :: FilePath -> IO Bool
const doesFileExist = strPath => {
const ref = Ref();
return $.NSFileManager.defaultManager
.fileExistsAtPathIsDirectory(
$(strPath)
.stringByStandardizingPath, ref
) && ref[0] !== 1;
};
// filePath :: String -> FilePath
const filePath = s =>
ObjC.unwrap(ObjC.wrap(s)
.stringByStandardizingPath);
// MAIN // ---
return main();
})();
Also please see:
1 Like
this is a cool answer… thanks. i unchecked it… System Preferences > General > Close window and it worked as what i wanted.