I could be over complicating this but I'm pretty new to Applescript so I wanted to reach out here.
Essentially I'm trying to loop a program login for 10 people. The accounts were handed to me in a list, and I figured the best thing to do was to make it an array. I used this script for the array making:
set stringofitems to "jim
pam
oscar
stanley
michael
dwight
creed
angela
kevin
andy"
set text item delimiters to "
"
set listofitems to text items of stringofitems
repeat with theitem in listofitems
# stuff to do with each item
end repeat
If I want to display an entry from that new array it works:
Here's my script for the looping of the login process:
tell application "System Events"
tell process "MyApp"
set frontmost to true
click menu item "Sign In" of menu "Account" of menu bar 1
end tell
end tell
delay 2
set appName to "jim"
set appPass to "hunter2"
tell application "System Events"
tell process "MyApp"
set value of text field 1 of window 1 to appName
set value of text field 2 of window 1 to appPass
delay 0.4
key code 36
end tell
end tell
That works on its own but the main goal here is to maybe, somehow, combine the two so that I can just run the applescript and it runs through each user of the newly created array "listofitems" from the first part.
As a side note, I need create and use the variables "appName" and "appPass" to bypass the Secure Input automation protection stuff.
If there's a way better way of doing it please let me know.
Thank you!
set userList to the paragraphs of stringOfItems