FastScripts 3.0 Sneak Peek

Just bought this, and am loving it!

Can you tell me how I’d get results in a format I could use? For example, set urlTest to search text theURL matching pattern “facebook” It gives me the result {{text:“facebook”, offset:12}} which is fine, but what if I wanted to programmatically access the ‘12’ and work with it? I can’t seem to force the result into a string or access item 1 of the result.

Hi Peter - glad to hear you are enjoying the app! A problem some others have run into is trying to use the results of the search outside the scope of the “tell” block that is addressing FastScripts. For example, does this script work for you?

tell application "FastScripts"
    set theURL to "https://facebook.com/test"
    set urlTest to search text theURL matching pattern "facebook"
    offset of item 1 of urlTest
end tell

Does that work for you? If so the key might be to just make sure you either wrap all your management of FastScripts results inside a “tell” block for FastScripts, or wrap your whole script in:

using terms from app "FastScripts"
    <your script>
end

Something like this.

using terms from application "FastScripts"
	set myResult to {{text:"facebook", offset:12}}
	offset of item 1 of myResult
end using terms from
-->12

I think the problem is that both “text” and “offset” are appleScript keywords.

Otherwise, something like this would work.

set myResult to {{theText:"facebook", theOffset:12}}
theOffset of item 1 of myResult
-->12

Oh, thanks. That is probably the case. It sounds like maybe I should consider revising the dictionary to use more unique names. If I do that I’ll keep the existing names as aliases so that anybody who’s worked around the problem can have their scripts keep working, I think.

I suspect that’s not going to help.

As long as people have saved their scripts in compiled form, changing the terminology won’t matter.