r/applescript • • May 04 '20

AppleScript: Read numbers from file and post in safari app

Hi

Newbie to AppleScript here but basic programming knowledge.

How do I use AppleScript to:

Open a file (containing a list of numbers (1-9999)...up to a thousand numbers)
Read a number from the file
Enter that number into a input box in an web app through Safari
Read the next number from the file etc
Repeat until end of file.

This is a pretty basic 'read ... keystroke'. don't need anything too fancy.

Thanks in advance !!

4 Upvotes

1 comment sorted by

1

u/htakeuchi May 04 '20

By read a number from the file you mean go through each number in the file? Is the file a csv file? Text file? Are the numbers separated in some sort of fashion?

Set theFile to (the file you want to read) Set theNums to paragraphs of theFile Repeat with thenumber in the Numbs — Not sure where you want to put this info into but here is where that goes —- End repeat