AppleScript Automation.

ShortStory.

A few weeks ago, I was curious about accessing different devices on my network. After a long time researching, I found that it’s accessible simple to ssh into my local machine IP address.

In my subsequent work, I found somethin…


This content originally appeared on DEV Community and was authored by DEV Community

ShortStory.

A few weeks ago, I was curious about accessing different devices on my network. After a long time researching, I found that it's accessible simple to ssh into my local machine IP address.

In my subsequent work, I found something exciting. I was able to control the brightness of my Macbook Pro from my iMac terminal, and one time I left my table to take a quick break for breakfast, and the monitor on my laptop went to sleep. I pressed enter and saw the log-in page, BUT I could still use my laptop via ssh on the terminal.

I thought it would be interesting to access the keyboard via terminal, but it is hard to do with .sh/bs.

Behind a research work, I found that AppleScript is a thing. We can automate and ask it to do something exciting.
The first thing I did was create a "google" function in the terminal that opens google search with the flag as a query input -

google "What's your search?".

Second thing was this code, that opens: Spotlight - type Notepad and prints HelloWorld.

Image description

Code >

tell application "System Events"
    delay 0.5
    keystroke space using command down
    delay 0.5
    keystroke "Text"
    delay 0.5
    keystroke "Edit"
    delay 0.5
    keystroke return
    delay 1
    keystroke "Hello world!"
end tell

Conclusion

Automation!

⚠️ Previous Blog Post Tips And Tricks About Shell & CURL [Link]
This post is the best for short commands.

⚠️ Future Blog Post About Collaborative WhiteBoard with Node.js + React.js + AWS(EC2): [Link]

Links

🖇 Follow me on GitHub

🖇 Follow me on Twitter

_p.s This post was made out of my curiosity


This content originally appeared on DEV Community and was authored by DEV Community


Print Share Comment Cite Upload Translate Updates
APA

DEV Community | Sciencx (2022-02-26T01:26:26+00:00) AppleScript Automation.. Retrieved from https://www.scien.cx/2022/02/26/applescript-automation/

MLA
" » AppleScript Automation.." DEV Community | Sciencx - Saturday February 26, 2022, https://www.scien.cx/2022/02/26/applescript-automation/
HARVARD
DEV Community | Sciencx Saturday February 26, 2022 » AppleScript Automation.., viewed ,<https://www.scien.cx/2022/02/26/applescript-automation/>
VANCOUVER
DEV Community | Sciencx - » AppleScript Automation.. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/02/26/applescript-automation/
CHICAGO
" » AppleScript Automation.." DEV Community | Sciencx - Accessed . https://www.scien.cx/2022/02/26/applescript-automation/
IEEE
" » AppleScript Automation.." DEV Community | Sciencx [Online]. Available: https://www.scien.cx/2022/02/26/applescript-automation/. [Accessed: ]
rf:citation
» AppleScript Automation. | DEV Community | Sciencx | https://www.scien.cx/2022/02/26/applescript-automation/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.