Regexandstufflib fails using FastScripts

Hello everyone!

I’am getting a weird error with running the script using FastScripts that I don’t get using Applescript Script Editor.
Screenshot 2021-10-25 at 04.19.28

The script I am using at forum.latenightsw

use scripting additions
use script "RegexAndStuffLib" version "1.0.7"

tell application "Safari" to tell the front document to set theText to do JavaScript "document.body.innerText"

set transaction_service_from to regex search once theText search pattern "Late (\\S.*)" replace template "$1"

Is this repeatable? Last I heard, there is an issue with AppleScript where this happens intermittently. You might want to contact Daniel at Red Sweater to find out the latest.

Thanks @ShaneStanley for the heads up about this thread. Yes, it’s an issue I’ve seen reported at least once before. I think it’s exacerbated by the new behavior in FastScripts 3 to run every script in its own process. Whatever the odds of this bug happening, I think it’s a situation where it is likely to happen earlier in the running time of a process.

If it is repeatable, it would be very helpful to try to do some debugging on the issue. Please drop me a line separately at support@redsweater.com so I can follow up with more debugging ideas. Thanks!

Daniel

I am not sure what has happened but it went to normal after restarting my pc, so I have not faced that error anymore and will update this topic if this will happen again.

Hey @kreal – How do?

Nice that the problem went away, but frustrating to not be able to solve they why of it…

I ran this on my MacBook Air with Mojave with FastScripts 3.0b50 – no problems so far.

-Chris

AppleScript Code
--------------------------------------------------------
use scripting additions
use script "RegexAndStuffLib" version "1.0.7"
--------------------------------------------------------

set jsCmdStr to "document.body.innerText"
set theText to doJavaScriptInChrome(jsCmdStr)
set transaction_service_from to regex search once theText search pattern "Late (\\S.*)" replace template "$1"

tell application "FastScripts"
   display message transaction_service_from ¬
      dismissing after delay 4 ¬
      at screen position top right
end tell

--------------------------------------------------------
--» HANDLERS
--------------------------------------------------------
on doJavaScriptInChrome(jsCmdStr)
   try
      tell application "Google Chrome" to tell front window's active tab to execute javascript jsCmdStr
   on error e
      error "Error in handler doJavaScriptInChrome() of library NLb!" & return & return & e
   end try
end doJavaScriptInChrome

--------------------------------------------------------