I have no experience with Swift , but my organisation don't want anyone to run AppleScript anymore. I'll be alright using swift though
I was hopping to be able to get text from safari on a desktop swift app
for e.g
property leftEdge5 : "class=\"value\">"
property rightEdge5 : "</span>"
tell application "Safari"
set TheTransactionIDGraber to do JavaScript "document.getElementsByClassName('field emphasizedid')[0].innerHTML;" in current tab of window 1
end tell
set transactionID to ""
set theText to Unicode text
set theSource to TheTransactionIDGraber
try
set saveTID to text item delimiters
set text item delimiters to leftEdge5
set classValue to text item 2 of theSource
set text item delimiters to rightEdge5
set transactionID to text item 1 of classValue
set text item delimiters to saveTID
transactionID
end try
set the clipboard to "PID: " & transactionID
is they an easy way to do the same with Swift ? or get swift to run a basic applescript and store the value ? perhaps in a plist file