Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

H2SO4

macrumors 603
Original poster
Nov 4, 2008
5,823
7,093
Hi all.
Can anybody help with a problem I have at all?
I borrowed a script from Deesbek on another message board which gives thus;
AppleScript:
set save_location to ¬
    (choose folder with prompt "Choose where to save screenshots")

repeat with shotcount from 1 to 100
    do shell script "screencapture " & ¬
        quoted form of POSIX path of save_location ¬
        & "screen" & (shotcount as string) & ".jpg"
    delay (60 * 1) -- delay one minute
end repeat
and it works really well. But................I'd like to improve it.
Before actually beginning I'd like the script to ask for a few more parameters;
  • 1. The size/position of the screenshot, (for example I'd like a set size starting at x,x coordinates).
  • 2. The frequency.
  • 3. The shotcount.
What I can't seem to do is figure out how to put into the script that it should ask for a shot count value instead of assuming 100, same procedure with the other items.

Thanks.
 

kryten2

macrumors 65816
Mar 17, 2012
1,115
99
Belgium
You can ask for user input by using display dialog.
Ex:
AppleScript:
    set dialogResult to display dialog ¬

        "What is your name?" buttons {"Cancel", "OK"} ¬

        default button "OK" cancel button "Cancel" ¬

        giving up after 15 ¬

        default answer (long user name of (system info))

Info: AppleScript Language Guide
 

H2SO4

macrumors 603
Original poster
Nov 4, 2008
5,823
7,093
You can ask for user input by using display dialog.
Ex:
AppleScript:
    set dialogResult to display dialog ¬

        "What is your name?" buttons {"Cancel", "OK"} ¬

        default button "OK" cancel button "Cancel" ¬

        giving up after 15 ¬

        default answer (long user name of (system info))

Info: AppleScript Language Guide
Apologies, I should have done a little more research before posting my question but your answer is nonetheless more than very useful.
After doing a search on my computer I realised I had previously purchased books on the command line and AppleScript and should have looked at those before posting to forum, but thanks for input.
 

H2SO4

macrumors 603
Original poster
Nov 4, 2008
5,823
7,093
Hi again all.
I’m not using Sonoma yet but can somebody that is please confirm that Script Editor is still a thing in the latest OS?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.