0

I spent 3 days and still have trouble using Automator in my obsolete 2nd hand iMac iOS 10.13. My aim is simple, to achieve this:

  1. take a screenshot of part of a webpage (I will customize size of screen)
  2. name the screenshot file ( i will name 1,2,3,4 myself)
  3. save in a folder
  4. continue the above repetitive actions 3000 times

Very frustrated...please help...really do not know how to use the Automator... i tried Take a Screenshot, save to pdf, rename, xxx folder action...

Alternatively i tried other options ...such as reconfigure my right-click mouse, create a floatbutton, change my menu bar...

3
  • You might have better luck by dividing your project into parts, perhaps as you described above, and progress as you complete each part. You may also get help from the questions asked before and similar to yours in this forum. Just type automator screenshot in the search box above, hit enter and check the posts coming up.
    – Alper
    Commented Nov 2, 2021 at 3:24
  • You can change the default name and save location of screenshots with a defaults write command. Would that be sufficient? Subsequent files would be incrementally numbered.
    – benwiggy
    Commented Nov 2, 2021 at 7:39
  • It would be better to execute shell command "mv screenshot newScreenshotLocation" to move to another directory, instead of changing default screenshot behaviour.
    – Gintaras
    Commented Nov 2, 2021 at 9:22

1 Answer 1

0

Personally i would use ObjC/Swift to achieve this. The upside of doing this is that the program doesn't interrupt your browser and you can still browse or do other things with the computer while the script is running

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"www.example.com]];
[_WebView loadRequest:request];


- (void)capture
{
    WKSnapshotConfiguration *conf = [[WKSnapshotConfiguration alloc] init];
    conf.rect = NSRectFromString([_CaptureCoordinatesField stringValue]);
    [_WebView takeSnapshotWithConfiguration:conf completionHandler:
     (^(NSImage *snapshotImage, NSError *error) {
        dispatch_async(dispatch_get_main_queue(), ^{
            NSData *imageData = [snapshotImage TIFFRepresentation];
            [imageData writeToFile:@"YOUR FILE" atomically:YES];
        });
    })];
}

To do it in Automator you could do something like this (This was tested on MacOS 12.0.1, may or may not have problems with previous MacOS version): Automator

4
  • 1
    The title of the question starts off saying "Use macOS Automator to screenshot" and continues talking about using Automator to accomplish the task. I'm all for alternate solutions if when presented they provide a working solution. Your answer as currently written is probably useless to the OP as it is essentially a code only answer and gives absolutely no instructions whatsoever how to utilize it to achieve the stated goal of the OP! (Apologies if the OP understands what to do with the code.) Commented Nov 2, 2021 at 16:53
  • thanks for correcting my questions. I state my obsolete operation system clearly because it is a constraint. may Gintaras Kindly tells me what is objectC/swift...can't find this script in automator. appreciated if you can answer.
    – pmp calvin
    Commented Nov 3, 2021 at 6:36
  • Objc/Swift is the programming language that developers use to make programs, not scripts. I edited my previous answer with Automator actions in it.
    – Gintaras
    Commented Nov 3, 2021 at 8:30
  • 1
    Needless use of the first Run Shell Script action to open the URL as that could have been done in the Run AppleScript action. However, even the Run AppleScript action is needless as this all could have been done in a single Run Shell Script action by using osascript to run the AppleScript code, as shown in this screen shot clipping: https://i.imgur.com/5mBPa8p.png Commented Nov 3, 2021 at 16:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .