Many note-taking Applications have some sort of plugin to import selections or whole websites into their database (Evernote, DevonThink, Notebook, Mendeley, and many more)
I was thinking to modify one of the chrome plugins (which is javascript) to input data from Web into MacJournal (anyone remembers Journler ? :P)
Anyway, it isn’t that easy with plugins, so I build my own with UI Scripting. And… it works great.
Still, I am wondering if there is not a better way to push data into MacJournal, like so:
tell application "MacJournal"
tell document 1
set docLs to (get properties as list)
set getJ to item 4 of docLs
make new URL file at getJ with properties {name:"Test", URL:"https://macscripter.net/index.php"}
end tell
end tell
(*
Add manually a shortcut to import "Web Page…" for MacJournal in System Prefs>Keyboard, I use a combination of control, option and command + u
tell application "MacJournal" to activate
delay 0.3
tell application "System Events"
tell process "MacJournal"
keystroke "u" using {command down, control down, option down}
delay 0.5
tell sheet 1 of window 1
set value of text field 1 to myUrl
end tell
end tell
end tell
*)
Btw, currently MacJournal is free. Check it out here
Edit. I forgot to say that version 7.0 is buggy (window manager), AppleScript (some records cleaned up) does not work for the frontmost journal. It did not by default but now not even with workaround. I reported to the developer
I use v. 6.2.2
Your version does not work for me. The error is produced by the code line make new URL file. But, since the application interested me, I wrote my own code. Also, there is no need to create shortcut. I used version 6.2.2, like you:
set anURL to "https://macscripter.net/index.php"
set journalName to "macscripterJournal"
tell application "MacJournal"
activate
-- make new journal with properties {name: journalName}
tell document 1 to set selected journal to journal journalName
end tell
tell application "System Events"
tell application process "MacJournal"
tell menu bar 1 to tell menu 1 of menu bar item "File"
click menu item "Web Page…" of menu 1 of menu item "New Entry from"
end tell
end tell
keystroke anURL & return
tell application process "MacJournal"
repeat until (button "OK" of sheet 1 of window journalName exists)
delay 0.1
end repeat
click button "OK" of sheet 1 of window journalName
end tell
end tell
Hi
My script should work, you coded much more as needed, because u didn’t reflect on what I put in comments in my script. It’s ok, let me explain
move your mouse to the top menu bar: Apple > system preferences > keyboard > shortcuts > application shortcuts
There you have to add MacJournal to the custom application list yourself and write the exact command of the menu item you wanna target
Only then you define a keyboard shortcut for MacJournal’s “web page” menu item, I choosed command +option +control +u (my script uses that shortcut too so if course it couldn’t work for you by default)
select a folder (not a smart folder) in your frontmost journal(not the journal you defined in MacJournal’s preferences - if you use more than one journal) where you wanna save your website clip
Just then, execute my script. And this is valid for the gui scripting part.
But…
I wanted a more elegant and direct way to import web pages into MacJournal (no gui scripting, as gui scripting forces me to bring up MacJournal to finalize the import)
So, in other words, I just"tried" with make new URL file.
Don’t get me wrong, it didn’t work for me either. Because of this reason I asked here, to check if somebody knows a better syntax, if anyway doable
Joy,
It is GUI scripting, but it works fine. With my script you load the webpage as Web entry. I updated my script above, as you want get selected journal and not make one new. No need move mouse, create shortcut, select folder and so on.
Maro,
Thank you, I will look at your scripts with MacJournal.app.