cant figure out how to put code here without it getting reformatted, but the script creates a text file, but SD seems to think that i changed the script
Just select the code in SD, copy it to the macOS clipboard, come back to the forum and type three backticks (`) on one line, press return, paste your code below the backticks, and then type a line of three backticks below it, like this:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
on run
#~-- your code goes here...~#
end run
Thank you emendelson for the tip - here is the code - when i open the script and close it, no problem, but if i run it, it thinks that oi changed the script and wants me to save it.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "Safari"
set windowCount to number of windows
set docText to "<!DOCTYPE HTML><html>" & linefeed as string
set docText to docText & "<head><title>Safari 9-2022</title></head>" & linefeed as string
set docText to docText & "<body><hr>" & linefeed as string
set minText to "<hr>" & linefeed as string
repeat with x from 1 to windowCount
set tabcount to number of tabs in window x
repeat with y from 1 to tabcount
set tabURL to URL of tab y of window x
set tabName to name of tab y of window x
if tabName is "" then
set tabName to "untitled"
end if
if window x is miniaturized then
set minText to minText & "<br><a href=\"" & tabURL & "\">" & tabName & "</a>" & linefeed as string
else
set docText to docText & "<br><a href=\"" & tabURL & "\">" & tabName & "</a>" & linefeed as string
end if
end repeat
if window x is miniaturized then
set minText to minText & "<p>" & linefeed as string
else
set docText to docText & "<p>" & linefeed as string
end if
end repeat
set docText to docText & minText & "<hr></body></html>" & linefeed as string
end tell
tell application "TextEdit"
activate
make new document
set the text of the front document to docText
end tell
Doesn’t happen here: no prompt to save after running the script in latest SD. Maybe something in your settings is affecting this?
I tested and this doesn’t happen on my Ventura computer.
BTW, as mentioned by emendelson, a lot of settings in Script Debugger can cause a script to be identified as “Edited” even when the script has not been changed. One example is running a script with debug mode enabled.
Thanks emendelson and peavine - i’ll check out my settings
i found the debugging switch and turned it off but it still says the script changed, but i’ll start looking around for other default settings that i don’t need to have on