This section is designed to help you get started with the BAMC Language even if you have little or no prior coding experience. We'll focus on simple, practical tasks and walk you through them step-by-step.
Here, you'll find:
Let's begin with some fundamental commands. Each command below shows you what to type and explains it in simple terms. Remember, you'll put these lines into your BAMC script file!
This is how you tell your script to open a web browser and go to a specific internet address.
browser "chrome"
visit "https://www.google.com"
wait-for-seconds 5
browser "chrome"
: This line tells your script to use
the Chrome browser to perform the actions. (You could also use
"firefox"
for the Firefox browser).
visit "https://www.google.com"
: This command opens
your chosen browser and takes it to the Google website. You can
change "https://www.google.com"
to any website
address you want to open!
wait-for-seconds 5
: This tells the script to pause
for 5 seconds. This is useful to give websites time to fully load
or for you to see what's happening.
Try it yourself: Copy these lines into a .BAMC file and run it. Your browser should open, go to Google, and wait for 5 seconds before closing (or moving to the next command if you add more).
Sometimes you want to save a picture of what's on the screen. This script shows you how to do just that.
browser "chrome"
visit "https://www.wikipedia.org"
wait-for-seconds 2
take-screenshot "wikipedia.png"
browser "chrome"
: Starts Chrome.visit "https://www.wikipedia.org"
: Goes to the
Wikipedia website.
wait-for-seconds 2
: Waits for 2 seconds to ensure the
page loads.
take-screenshot "wikipedia.png"
: This command takes a
picture (a "screenshot") of your browser screen and saves it as an
image file named wikipedia.png
on your computer. You
can open this image file later to see what was on the screen.
Try it yourself: Run this script and check the folder where your BAMC script is saved for the "wikipedia.png" image file!
This script shows you how to open eBay, type something into the search bar, click the search button, and then save the results page to your computer.
browser "chrome"
visit "https://www.ebay.com/"
wait-for-seconds 1.5
fill-text "#gh-ac" "Awesome deals"
wait-for-seconds 1
click "#gh-search-btn"
wait-for-seconds 10
save-as-html "ebay-search.html"
browser "chrome"
: This line tells your script to use
the Chrome browser.
visit "https://www.ebay.com/"
: This command opens the
eBay website in the browser.
wait-for-seconds 1.5
: A short pause to help the page
load.
fill-text "#gh-ac" "Awesome deals"
: This is how your
script "types" into a box on a website.
"#gh-ac"
is what's called a
selector (Don't
worry too much about how these work for now, just know they
point to specific parts of a webpage!)
"Awesome deals"
is the text your script will type
into that search box.
wait-for-seconds 1
: A single second pause after
typing.
click "#gh-search-btn"
: This command "clicks" on
something.
"#gh-search-btn"
is the
selector for eBay's
search button.
wait-for-seconds 10
: We wait a bit longer here to
make sure the search results page loads completely after clicking
the button.
save-as-html "ebay-search.html"
: After the search,
this command saves the entire webpage you're currently looking at
as an HTML file named ebay-search.html
on your
computer. You can open this file later in your web browser to see
the results.
Try it yourself: Copy this script into a BAMC file, run it, and see if you get an "ebay-search.html" file with your search results!
You've now seen some foundational things your BAMC scripts can do!