This might be too simple, but I didn’t find anything with the search.
I am trying to open a link in Safari with a script. The “open” or “open location” basically works, but the problem is that a part of the URL is some sort of session ID, i.e. different every time I open the website.
If you can do it manually, then probably. If you can’t, then probably not. But it should be possible to find the current link in the source code, either using JavaScript or something like this:
tell application "Safari" to set srce to source of front document
set linkURL to (do shell script ("<<<" & quoted form of srce & " grep -Eo 'http://www.domain.com/[^/]+/file.html'"))