Page 1 of 1

Paste without Crash (AppleScript)

Posted: 2023-07-07 00:00:10
by hatchmo
As Nisus Writer Pro continues to crash when pasting content that has been copied from certain websites (especially threaded ones such as Twitter, Nextdoor, etc.), I have scripted a simple workaround. Just copy the content you want, and then run this little AppleScript. It will paste the clipboard contents into a blank Apple Pages document instead of into Nisus Writer Pro. It then copies the content from Pages to a new Nisus document. No crash. Tip: If you paste these lines into a new Scripting Shortcut, you can turn it into a simple menu item or a Stream Deck button.

tell application "Pages"
activate
make new document with properties {document template:template "Blank"}
tell application "System Events"
tell process "Pages"
key code 9 using {command down} -- paste
delay 1
key code 0 using {command down} -- select all
delay 1
key code 7 using {command down} -- copy
delay 1
end tell
end tell
end tell

tell application "Nisus Writer Pro"
activate
tell application "System Events"
tell process "Nisus Writer Pro"
key code 45 using {command down} --create new document
key code 9 using {command down} --paste
end tell
end tell
end tell

Re: Paste without Crash (AppleScript)

Posted: 2023-07-07 00:58:40
by Bob Stern
Does it solve your problem if you run this AppleScript between copying the web page text and pasting it into NWP?

use scripting additions
set x to the clipboard as text
set the clipboard to x

Re: Paste without Crash (AppleScript)

Posted: 2023-07-07 21:37:05
by hatchmo
Thanks. Yes, that prevents the crashing, and the text portion is pasted.
However, the advantage of my more elaborate script is that it preserves images.

Re: Paste without Crash (AppleScript)

Posted: 2023-12-29 23:23:24
by hatchmo
Good news! This month's version 3.4 update solves this problem.

Re: Paste without Crash (AppleScript)

Posted: 2024-01-02 14:32:07
by martin
hatchmo wrote: 2023-12-29 23:23:24 Good news! This month's version 3.4 update solves this problem.
Thanks for the update Al! The crashes were probably caused by a bug related to SVG images, which are not infrequently encountered on certain websites. That bug was fixed with Nisus Writer Pro version 3.4.

Re: Paste without Crash (AppleScript)

Posted: 2024-01-04 15:33:17
by Vanceone
Hmm... the release notes for Nisus 3.4 were pretty sparse. Did not mention any SVG changes. Was that part of the general Sonoma bug fix suite?

Re: Paste without Crash (AppleScript)

Posted: 2024-01-05 09:50:16
by martin
Vanceone wrote: 2024-01-04 15:33:17 Hmm... the release notes for Nisus 3.4 were pretty sparse. Did not mention any SVG changes. Was that part of the general Sonoma bug fix suite?
There were a variety of unmentioned system compatibility/stability fixes in version 3.4, but the SVG fix should have been called out separately because it wasn't related to Sonoma. That bug affects some earlier systems as well.