Simple Applescript Tutorial
by 101lenny101 in Circuits > Apple
21084 Views, 10 Favorites, 0 Comments
Simple Applescript Tutorial
Hey everyone! Here is a simple Applescript tutorial for making popup dialogs.
***UPDATE***
The 4/13/10 update includes three new scripts, and how to save them. A special thanks to Marble of Doom for the first new one!
***UPDATE***
The 4/13/10 update includes three new scripts, and how to save them. A special thanks to Marble of Doom for the first new one!
You Will Need...
1) A Mac (Sorry PC's... I'll have another tut for you guys later.)
2) Applescript. It should come standard with all Mac's
2) Applescript. It should come standard with all Mac's
Open a New Script
Fire up Applescript and type the following in:
-Display dialog (This tells the computer that it is going to make a popup dialog)
-"Text goes here" (Anything within the quotes is what will appear in the dialog)
-Display dialog (This tells the computer that it is going to make a popup dialog)
-"Text goes here" (Anything within the quotes is what will appear in the dialog)
Adding More Lines
Now do the same just start a new line every time.
This is good for making fake viruses, but is pointless because Mac's don't get viruses!!!
This is good for making fake viruses, but is pointless because Mac's don't get viruses!!!
Now Test
Just click run and it should start.
Make sure it looks like the below:
Make sure it looks like the below:
Applescript Number 2
Here is another applescript brought to my attention by Marble of Doom (www.instructables.com/member/Marble+of+Doom/)
It basically keeps putting more and more folders on the desktop, until you force quit it. And sorry, I will not demonstrate it.
***DISCLAIMER*** If you really mess up your computer, it is not mine, nor Marble of Doom's fault, it is yours
It basically keeps putting more and more folders on the desktop, until you force quit it. And sorry, I will not demonstrate it.
***DISCLAIMER*** If you really mess up your computer, it is not mine, nor Marble of Doom's fault, it is yours
The Repeat
The Repeat command tells Script Editor to keep doing whatever you tell it to, in this case, making folders
The Beep
To be honest, I have NO idea what this does, but after some googleing, I found the beep command just makes the Mac's default error beep (You may not of heard this beep, because you probably haven't had an error)
The Command
Here is when the computer starts making folders. Here is what each of the commands will do.
1. tell application "Finder"
This simply tells Finder to pay attention
2. make new folder at desktop
This tells Finder to start making folders
3. end tell
This tells Finder that it isn't going to get any more commands, but to keep making folders
1. tell application "Finder"
This simply tells Finder to pay attention
2. make new folder at desktop
This tells Finder to start making folders
3. end tell
This tells Finder that it isn't going to get any more commands, but to keep making folders
Finishing Off
Just hit the "Compile" button, and save it, if you dare. THE ONLY WAY TO STOP THIS IS TO FORCE QUIT IT
Simplest of Them All Is...
The Shutdown script!!! This is really simple.
Here Is How to Do It
Simple. Just type in
tell application "Finder" to shut down
This simply shuts down the computer.
tell application "Finder" to shut down
This simply shuts down the computer.
Lastly, Opening Pages in Safari
Lastly, here is how to open a webpage in
Safari.
Type in: tell application "Safari" to open
open location "https://www.instructables.com/"
You can type in as many websites as you want, which can get really annoying
Safari.
Type in: tell application "Safari" to open
open location "https://www.instructables.com/"
You can type in as many websites as you want, which can get really annoying
Saving
So you have read through all of these scripts, but how do you save them?
Well, you can save it as a script, that opens in Script Editor, an Application, or a text file
To save, you go to File> Save or File> Save As... and select what you want to name it and save it as.
Well, you can save it as a script, that opens in Script Editor, an Application, or a text file
To save, you go to File> Save or File> Save As... and select what you want to name it and save it as.