Imported from the Apple Support Forums via the Wayback Machine 🔗
I'd like to have my computer automatically take a screenshot of a specific webpage and save it to an rtfd document for an hour every five minutes.
However, it seems that I cannot place all of my codes between "repeat 11 times" and "end repeat" as error "Syntax Error; Expected “end” but found “to”." keeps showing up highlighting that "to"
Replacing that "to" with "end" according to the error message will simply end up with a loop for only the "set input method to ABC" section, which is not what I'm expecting.
Please help me figure out whether there's something I've done wrong or it's a Script Editor bug and, if possible, kindly offer a solution.
Imported from the Apple Support Forums via the Wayback Machine 🔗
Use the note icon (third from right in the editor's bottom toolbar) to post your AppleScript source code. We are not going to type in the code from your images of source code to debug it locally.
Place all of your AppleScript handlers (e.g. goToWebPage) after all of your other AppleScript main body code which you have ended with a return statement:
The AppleScript Commands Guide gives handler examples where the declaration precedes the main code body. My personal preference is trailing AppleScript handlers after the code body. This is the only language where I do this though.
main code
my goToWebPage(homePage)
…
return
-- separate your handlers from all other main code. The final return will do that.
to goToWebPage(theWebPage)
…
return
end goToWebPage
0
Niel·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Handlers can't be placed in a repeat loop. Move the entire 'to' segment outside it.
(167508)
0
VikingOSX·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Use the note icon (third from right in the editor's bottom toolbar) to post your AppleScript source code. We are not going to type in the code from your images of source code to debug it locally.
Place all of your AppleScript handlers (e.g. goToWebPage) after all of your other AppleScript main body code which you have ended with a return statement:
The AppleScript Commands Guide gives handler examples where the declaration precedes the main code body. My personal preference is trailing AppleScript handlers after the code body. This is the only language where I do this though.
main code
my goToWebPage(homePage)
…
return
-- separate your handlers from all other main code. The final return will do that.
to goToWebPage(theWebPage)
…
return
end goToWebPage
0
FeuerStar·
Imported from the Apple Support Forums via the Wayback Machine 🔗
This is the solution!
Thank you very much!
0
FeuerStar·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Thank you so much for spending time on my post and offering a working solution.
I was trying to post the source code but was turned down by the limit of 5000 characters.