This commit is contained in:
Rodrigo Rodriguez 2024-08-31 13:49:41 -03:00
parent 73ea2dd864
commit 3d458c4170

View file

@ -12,7 +12,6 @@ It is like creating a conversation Node.js application just using BASIC. All cod
![image](https://user-images.githubusercontent.com/14840374/200206510-9f5bd788-e710-4932-9ed8-a09599656cea.png) ![image](https://user-images.githubusercontent.com/14840374/200206510-9f5bd788-e710-4932-9ed8-a09599656cea.png)
## Using Conversational BASIC ## Using Conversational BASIC
The following file types are loaded from a .gbdialog package: `.vbs`, `.vb`, `.basic` and `.bas`. The following file types are loaded from a .gbdialog package: `.vbs`, `.vb`, `.basic` and `.bas`.
@ -21,11 +20,10 @@ The following file types are loaded from a .gbdialog package: `.vbs`, `.vb`, `.b
To organize the instructions functionally, I'll group them into five categories: **Basic Interaction**, **Data Handling**, **Web Automation**, **File Management**, and **Advanced Operations**. Each group will include relevant instructions with examples. To organize the instructions functionally, I'll group them into five categories: **Basic Interaction**, **Data Handling**, **Web Automation**, **File Management**, and **Advanced Operations**. Each group will include relevant instructions with examples.
## Basic Interaction ## Basic Interaction
| Instruction / Usage | Description | Example | | Instruction / Usage | Description | Example |
| ------------------------------------------------------------- | --------------------------------------------------------------------------- | ------- | | ----------------------------------------------- | ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| HEAR _variable_ | Hears something from the person into a _variable_ for later use. | <pre>HEAR name <br/>TALK "Your name is " + name.<br/></pre> | | HEAR _variable_ | Hears something from the person into a _variable_ for later use. | <pre>HEAR name <br/>TALK "Your name is " + name.<br/></pre> |
| TALK _message_ | Talk the specified _message_ to the person. | <pre>TALK "Hello world."</pre> | | TALK _message_ | Talk the specified _message_ to the person. | <pre>TALK "Hello world."</pre> |
| WAIT _seconds_ | Wait a number of seconds before continuing the conversation. | <pre>WAIT 10 <br/> TALK "Waited for 10 seconds."</pre> | | WAIT _seconds_ | Wait a number of seconds before continuing the conversation. | <pre>WAIT 10 <br/> TALK "Waited for 10 seconds."</pre> |
@ -46,7 +44,7 @@ To organize the instructions functionally, I'll group them into five categories:
## Data Handling ## Data Handling
| Instruction / Usage | Description | Example | | Instruction / Usage | Description | Example |
| ------------------------------------------------------------- | --------------------------------------------------------------------------- | ------- | | ------------------------------------------------- | -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| _variable_ = GET "_file_.xlsx", "_A1:A1_" | Gets the value of the cell specified in range address | <pre>name = GET "data.xlsx", "A1:A1" <br/> TALK "The value is " + name.</pre> | | _variable_ = GET "_file_.xlsx", "_A1:A1_" | Gets the value of the cell specified in range address | <pre>name = GET "data.xlsx", "A1:A1" <br/> TALK "The value is " + name.</pre> |
| SET "_file_.xlsx", "_A1:A1_", 42 | Sets the value of the cell specified in range address | <pre>SET "data.xlsx", "A1:A1", 42 <br/> TALK "Value set in Excel."</pre> | | SET "_file_.xlsx", "_A1:A1_", 42 | Sets the value of the cell specified in range address | <pre>SET "data.xlsx", "A1:A1", 42 <br/> TALK "Value set in Excel."</pre> |
| _variable_ = GET "https://server/query" | Gets the value from the specified web service | <pre>result = GET "https://api.example.com/data" <br/> TALK "Data received: " + result.</pre> | | _variable_ = GET "https://server/query" | Gets the value from the specified web service | <pre>result = GET "https://api.example.com/data" <br/> TALK "Data received: " + result.</pre> |
@ -64,21 +62,21 @@ To organize the instructions functionally, I'll group them into five categories:
## Web Automation ## Web Automation
| Instruction / Usage | Description | Example | | Instruction / Usage | Description | Example |
| ------------------------------------------------------------- | --------------------------------------------------------------------------- | ------- | | --------------------------------------------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| page = OPEN _url_ [AS #namedSession] | Web automation retrieval of a web page, saving the session for reuse. | <pre>page = OPEN "https://example.com" AS #session1 <br/> TALK "Page opened and session saved."</pre> | | page = OPEN _url_ [AS #namedSession] | Web automation retrieval of a web page, saving the session for reuse. | <pre>page = OPEN "https://example.com" AS #session1 <br/> TALK "Page opened and session saved."</pre> |
| * _variable_ = GET page, cssSelector, "body > img" | Retrieves an element within an IFRAME specified by selector. | <pre>image = GET page, "#profile-picture" <br/> TALK "Profile picture retrieved."</pre> | | \* _variable_ = GET page, cssSelector, "body > img" | Retrieves an element within an IFRAME specified by selector. | <pre>image = GET page, "#profile-picture" <br/> TALK "Profile picture retrieved."</pre> |
| * SET page, cssSelector, value | Defines a field to a value on the webpage specified by selector. | <pre>SET page, "#username", "user123" <br/> TALK "Username set."</pre> | | \* SET page, cssSelector, value | Defines a field to a value on the webpage specified by selector. | <pre>SET page, "#username", "user123" <br/> TALK "Username set."</pre> |
| * CLICK page, cssSelector | Clicks on an element inside the web page being automated. | <pre>CLICK page, "#submit-button" <br/> TALK "Submit button clicked."</pre> | | \* CLICK page, cssSelector | Clicks on an element inside the web page being automated. | <pre>CLICK page, "#submit-button" <br/> TALK "Submit button clicked."</pre> |
| * file = DOWNLOAD _url_ | Downloads a file from the specified URL. | <pre>file = DOWNLOAD "https://example.com/file.zip" <br/> SAVE file AS "downloads/file.zip" <br/> TALK "File downloaded."</pre> | | \* file = DOWNLOAD _url_ | Downloads a file from the specified URL. | <pre>file = DOWNLOAD "https://example.com/file.zip" <br/> SAVE file AS "downloads/file.zip" <br/> TALK "File downloaded."</pre> |
## File Management ## File Management
| Instruction / Usage | Description | Example | | Instruction / Usage | Description | Example |
| ------------------------------------------------------------- | --------------------------------------------------------------------------- | ------- | | ------------------------ | ------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| HEAR _variable_ AS FILE | Returns a file uploaded by the user to be saved. | <pre>HEAR file AS FILE <br/> SAVE file AS "uploads/myfile.pdf" <br/> TALK "File uploaded and saved."</pre> | | HEAR _variable_ AS FILE | Returns a file uploaded by the user to be saved. | <pre>HEAR file AS FILE <br/> SAVE file AS "uploads/myfile.pdf" <br/> TALK "File uploaded and saved."</pre> |
| HEAR _variable_ AS AUDIO | Returns an audio file uploaded by the user to be saved. | <pre>HEAR audio AS AUDIO <br/> SAVE audio AS "recordings/audiofile.mp3" <br/> TALK "Audio received and saved."</pre> | | HEAR _variable_ AS AUDIO | Returns an audio file uploaded by the user to be saved. | <pre>HEAR audio AS AUDIO <br/> SAVE audio AS "recordings/audiofile.mp3" <br/> TALK "Audio received and saved."</pre> |
| INCLUDE file | Includes a file into .gbdialog. | <pre>INCLUDE "script.gbdialog" <br/> TALK "File included."</pre> | | INCLUDE file | Includes a file into .gbdialog. | <pre>INCLUDE "script.gbdialog" <br/> TALK "File included."</pre> |
| UPLOAD file | Uploads a file to a storage blob, like Azure Storage. | <pre>UPLOAD " | UPLOAD file | Uploads a file to a storage blob, like Azure Storage. | <pre>UPLOAD " |
path/to/file.pdf" <br/> TALK "File uploaded to cloud storage."</pre> | path/to/file.pdf" <br/> TALK "File uploaded to cloud storage."</pre> |
| DIR path | Returns a list of files in the specified directory. | <pre>files = DIR "uploads/" <br/> TALK "Files in directory: " + files.</pre> | | DIR path | Returns a list of files in the specified directory. | <pre>files = DIR "uploads/" <br/> TALK "Files in directory: " + files.</pre> |
@ -88,12 +86,13 @@ path/to/file.pdf" <br/> TALK "File uploaded to cloud storage."</pre> |
## Advanced Operations ## Advanced Operations
| Instruction / Usage | Description | Example | | Instruction / Usage | Description | Example |
| ------------------------------------------------------------- | --------------------------------------------------------------------------- | ------- | | ------------------------ | ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| TABLE name ON connection | Defines a TABLE on the specified storage (database) connection. | <pre>TABLE "Sales" ON "DBConnection" <br/> TALK "Table defined."</pre> | | TABLE name ON connection | Defines a TABLE on the specified storage (database) connection. | <pre>TABLE "Sales" ON "DBConnection" <br/> TALK "Table defined."</pre> |
| field AS dataType | Defines a field in TABLE. Eg.: name string(50). | <pre>field = "price" AS number(10,2) <br/> TALK "Field defined as number."</pre> | | field AS dataType | Defines a field in TABLE. Eg.: name string(50). | <pre>field = "price" AS number(10,2) <br/> TALK "Field defined as number."</pre> |
| CONTINUATION TOKEN | Returns the value of the continuation token associated with the current dialog. | <pre>token = CONTINUATION TOKEN <br/> TALK "Continuation token: " + token.</pre> | | CONTINUATION TOKEN | Returns the value of the continuation token associated with the current dialog. | <pre>token = CONTINUATION TOKEN <br/> TALK "Continuation token: " + token.</pre> |
| NEW OBJECT | Creates a new object to be used with REST calls. | <pre>data = NEW OBJECT <br/> data.color = "blue" <br/> TALK "New object created."</pre> | | NEW OBJECT | Creates a new object to be used with REST calls. | <pre>data = NEW OBJECT <br/> data.color = "blue" <br/> TALK "New object created."</pre> |
| NEW ARRAY | Creates a new array. | <pre>data = NEW ARRAY <br/> data[0] = "red" <br/> TALK "New array created."</pre> | | NEW ARRAY | Creates a new array. | <pre>data = NEW ARRAY <br/> data[0] = "red" <br/> TALK "New array created."</pre> |
``` ```
@ -139,9 +138,11 @@ All values from .gbot Config.xlsx are also provided as variables, so it can be a
To reply as code in Excel, start the cell value with /basic followed by the code itself. Eg.: To reply as code in Excel, start the cell value with /basic followed by the code itself. Eg.:
``` ```
/basic /basic
TALK "Hello." TALK "Hello."
```
````
### Use General Bots computer vision ### Use General Bots computer vision
@ -173,7 +174,8 @@ SET page, "#captcha", captcha
CLICK page, "#bt-login" CLICK page, "#bt-login"
TALK TO mobile, "Login done, thanks." TALK TO mobile, "Login done, thanks."
``` ````
### Using General Bots SQL and dynamic image and chart generation ### Using General Bots SQL and dynamic image and chart generation
On the fly table as images. On the fly table as images.
@ -250,7 +252,6 @@ SEND FILE img
![image](https://user-images.githubusercontent.com/14840374/178154826-8188029e-b4f4-48aa-bc0d-126307ce5121.png) ![image](https://user-images.githubusercontent.com/14840374/178154826-8188029e-b4f4-48aa-bc0d-126307ce5121.png)
### Using General Bots Office templates ### Using General Bots Office templates
``` ```
@ -295,8 +296,6 @@ LOOP
EXIT EXIT
``` ```
### Using POST data ### Using POST data
You can use POST passing a variable as the second param in the POST call. The example You can use POST passing a variable as the second param in the POST call. The example
@ -311,14 +310,14 @@ Given the Excel file with the following contents and saved to the standard .gbdi
The Word bellow will invoke POST call by using line contents as object attributes: The Word bellow will invoke POST call by using line contents as object attributes:
``` BASIC ```BASIC
obj = FIND "dados.xlsx", "tokenId=29187" obj = FIND "dados.xlsx", "tokenId=29187"
POST "https://server/query", obj POST "https://server/query", obj
' obj here is {tokenId: 29187, token: "AAMkAGEzMWIxMmI5", comment: "Prod1"} ' obj here is {tokenId: 29187, token: "AAMkAGEzMWIxMmI5", comment: "Prod1"}
``` ```
* OAuth2 is being implemented and no modification to previous calls will be necessary - OAuth2 is being implemented and no modification to previous calls will be necessary
as this configuration will be an administrative conversation to get the token setup. as this configuration will be an administrative conversation to get the token setup.
### Generate a password for the person ### Generate a password for the person
@ -340,7 +339,6 @@ hear one of subscriptions with email, password into subscriptionId
talk "The subscription selected was: " + subscriptionId talk "The subscription selected was: " + subscriptionId
``` ```
# General Bots Simple and Complex Programs # General Bots Simple and Complex Programs
These are sample programs in General Bots BASIC, each presented with a modern and engaging approach. The first 20 examples are simple, while the next 20 delve into more advanced concepts. Check the list These are sample programs in General Bots BASIC, each presented with a modern and engaging approach. The first 20 examples are simple, while the next 20 delve into more advanced concepts. Check the list
@ -348,8 +346,8 @@ of [templates](https://github.com/GeneralBots/BotServer/tree/main/templates)
The set of 20 advanced General Bots BASIC programs that integrate web services, web automation, file handling, and dynamic interactions. These samples are designed to showcase the full potential of General Bots BASIC for advanced users. These advanced samples illustrate a range of functionalities that can be implemented with General Bots BASIC, from data manipulation and web automation to dynamic content generation and complex file handling. The set of 20 advanced General Bots BASIC programs that integrate web services, web automation, file handling, and dynamic interactions. These samples are designed to showcase the full potential of General Bots BASIC for advanced users. These advanced samples illustrate a range of functionalities that can be implemented with General Bots BASIC, from data manipulation and web automation to dynamic content generation and complex file handling.
## 1. **Retrieve and Save Web Data to Excel** ## 1. **Retrieve and Save Web Data to Excel**
```basic ```basic
GET "https://api.example.com/data" GET "https://api.example.com/data"
data = result.data data = result.data
@ -358,6 +356,7 @@ TALK "Data retrieved and saved to data.xlsx successfully!"
``` ```
## 2. **Automated Web Form Submission** ## 2. **Automated Web Form Submission**
```basic ```basic
OPEN "https://example.com/form" OPEN "https://example.com/form"
SET page, "#name", "John Doe" SET page, "#name", "John Doe"
@ -368,6 +367,7 @@ TALK "Form submitted successfully!"
``` ```
## 3. **Generate and Save Dynamic Report as PDF** ## 3. **Generate and Save Dynamic Report as PDF**
```basic ```basic
data = FIND "report_data.xlsx", "A1:C10" data = FIND "report_data.xlsx", "A1:C10"
pdf = data AS PDF pdf = data AS PDF
@ -376,6 +376,7 @@ TALK "Dynamic report generated and saved as report.pdf!"
``` ```
## 4. **Create and Upload Image from Data** ## 4. **Create and Upload Image from Data**
```basic ```basic
data = [10, 20, 30, 40] data = [10, 20, 30, 40]
labels = "Q1;Q2;Q3;Q4" labels = "Q1;Q2;Q3;Q4"
@ -385,6 +386,7 @@ TALK "Chart image generated and uploaded!"
``` ```
## 5. **Automate GitHub Issue Creation from Spreadsheet** ## 5. **Automate GitHub Issue Creation from Spreadsheet**
```basic ```basic
list = FIND "issues.xlsx" list = FIND "issues.xlsx"
index = 1 index = 1
@ -401,6 +403,7 @@ LOOP
``` ```
## 6. **Extract and Save Web Page Content** ## 6. **Extract and Save Web Page Content**
```basic ```basic
OPEN "https://example.com/page" OPEN "https://example.com/page"
content = GET page, "body" content = GET page, "body"
@ -409,6 +412,7 @@ TALK "Page content saved as page_content.txt!"
``` ```
## 7. **Interactive Poll Results Analysis** ## 7. **Interactive Poll Results Analysis**
```basic ```basic
HEAR poll_data AS FILE HEAR poll_data AS FILE
data = LOAD poll_data data = LOAD poll_data
@ -418,6 +422,7 @@ TALK "Poll results analyzed and saved to poll_analysis.xlsx!"
``` ```
## 8. **Send User-Specific Notifications** ## 8. **Send User-Specific Notifications**
```basic ```basic
list = FIND "users.xlsx", "Notify=Y" list = FIND "users.xlsx", "Notify=Y"
index = 1 index = 1
@ -430,6 +435,7 @@ TALK "Notifications sent to all users."
``` ```
## 9. **Automate Data Entry into Web Application** ## 9. **Automate Data Entry into Web Application**
```basic ```basic
OPEN "https://example.com/data-entry" OPEN "https://example.com/data-entry"
SET page, "#field1", "Value1" SET page, "#field1", "Value1"
@ -440,6 +446,7 @@ TALK "Data entry completed successfully!"
``` ```
## 10. **Generate and Save QR Codes for Multiple URLs** ## 10. **Generate and Save QR Codes for Multiple URLs**
```basic ```basic
urls = ["https://example1.com", "https://example2.com", "https://example3.com"] urls = ["https://example1.com", "https://example2.com", "https://example3.com"]
index = 1 index = 1
@ -452,6 +459,7 @@ TALK "QR codes generated and saved!"
``` ```
## 11. **Automate Google Calendar Event Creation** ## 11. **Automate Google Calendar Event Creation**
```basic ```basic
OPEN "https://calendar.google.com/calendar/u/0/r?tab=mc&pli=1" OPEN "https://calendar.google.com/calendar/u/0/r?tab=mc&pli=1"
HEAR event_date AS DATE HEAR event_date AS DATE
@ -464,6 +472,7 @@ TALK "Event created on Google Calendar for " + event_date
``` ```
## 12. **Send Customized Reports to a List of Recipients** ## 12. **Send Customized Reports to a List of Recipients**
```basic ```basic
data = FIND "reports.xlsx" data = FIND "reports.xlsx"
index = 1 index = 1
@ -477,6 +486,7 @@ TALK "Reports sent to all recipients."
``` ```
## 13. **Create and Save Dynamic Chart with User Input** ## 13. **Create and Save Dynamic Chart with User Input**
```basic ```basic
HEAR user_data AS "10,20,30,40" HEAR user_data AS "10,20,30,40"
data = SPLIT(user_data, ",") data = SPLIT(user_data, ",")
@ -486,6 +496,7 @@ TALK "Dynamic chart created and saved as dynamic_chart.png!"
``` ```
## 14. **Extract and Save Image Metadata** ## 14. **Extract and Save Image Metadata**
```basic ```basic
SEE TEXT OF "https://example.com/image.jpg" AS metadata SEE TEXT OF "https://example.com/image.jpg" AS metadata
SAVE "image_metadata.txt", metadata SAVE "image_metadata.txt", metadata
@ -493,6 +504,7 @@ TALK "Image metadata extracted and saved as image_metadata.txt!"
``` ```
## 15. **Automate Form Filling Based on Data from Excel** ## 15. **Automate Form Filling Based on Data from Excel**
```basic ```basic
data = FIND "form_data.xlsx", "A1:C1" data = FIND "form_data.xlsx", "A1:C1"
OPEN "https://example.com/form" OPEN "https://example.com/form"
@ -504,6 +516,7 @@ TALK "Form filled and submitted based on Excel data!"
``` ```
## 16. **Generate PDF from Dynamic SQL Query Results** ## 16. **Generate PDF from Dynamic SQL Query Results**
```basic ```basic
data = FIND "database.xlsx", "A1:C100" data = FIND "database.xlsx", "A1:C100"
query = SELECT name, age, city FROM data WHERE age > 30 query = SELECT name, age, city FROM data WHERE age > 30
@ -513,6 +526,7 @@ TALK "PDF report generated and saved!"
``` ```
## 17. **Capture and Save Web Page Screenshot with Timestamp** ## 17. **Capture and Save Web Page Screenshot with Timestamp**
```basic ```basic
timestamp = FORMAT NOW(), "YYYY-MM-DD_HH-MM-SS" timestamp = FORMAT NOW(), "YYYY-MM-DD_HH-MM-SS"
OPEN "https://example.com" OPEN "https://example.com"
@ -522,6 +536,7 @@ TALK "Screenshot captured and saved with timestamp!"
``` ```
## 18. **Handle and Save User-Uploaded Files** ## 18. **Handle and Save User-Uploaded Files**
```basic ```basic
HEAR user_file AS FILE HEAR user_file AS FILE
SAVE user_file AS "uploads/user_file_" + FORMAT NOW(), "YYYY-MM-DD_HH-MM-SS" + ".pdf" SAVE user_file AS "uploads/user_file_" + FORMAT NOW(), "YYYY-MM-DD_HH-MM-SS" + ".pdf"
@ -529,6 +544,7 @@ TALK "File uploaded and saved successfully!"
``` ```
## 19. **Extract Data from Web Page and Save to Excel** ## 19. **Extract Data from Web Page and Save to Excel**
```basic ```basic
OPEN "https://example.com/data-page" OPEN "https://example.com/data-page"
data = GET page, "#data-table" data = GET page, "#data-table"
@ -537,6 +553,7 @@ TALK "Data extracted from web page and saved to web_data.xlsx!"
``` ```
## 20. **Perform Complex Data Analysis and Save Results** ## 20. **Perform Complex Data Analysis and Save Results**
```basic ```basic
data = FIND "complex_data.xlsx", "A1:D100" data = FIND "complex_data.xlsx", "A1:D100"
analysis = SELECT category, SUM(amount) AS total FROM data GROUP BY category analysis = SELECT category, SUM(amount) AS total FROM data GROUP BY category
@ -544,35 +561,39 @@ SAVE "data_analysis.xlsx", "A1:B" + UBOUND(analysis), analysis
TALK "Data analysis completed and saved to data_analysis.xlsx!" TALK "Data analysis completed and saved to data_analysis.xlsx!"
``` ```
And even more simple examples can be seen in this list as begginers use BASIC And even more simple examples can be seen in this list as begginers use BASIC
to understand code: to understand code:
## 1. Welcome Message ## 1. Welcome Message
```basic ```basic
HEAR name AS NAME HEAR name AS NAME
TALK "Hey " + name + ", welcome to our awesome service! 🎉" TALK "Hey " + name + ", welcome to our awesome service! 🎉"
``` ```
## 2. Simple Password Generator ## 2. Simple Password Generator
```basic ```basic
GENERATE A PASSWORD GENERATE A PASSWORD
TALK "Your new password is: " + password TALK "Your new password is: " + password
``` ```
## 3. Remind User to Take a Break ## 3. Remind User to Take a Break
```basic ```basic
WAIT 3600 WAIT 3600
TALK "You've been working for an hour! Remember to take a break and stretch! 💪" TALK "You've been working for an hour! Remember to take a break and stretch! 💪"
``` ```
## 4. Get User's Favorite Fruit ## 4. Get User's Favorite Fruit
```basic ```basic
HEAR fruit AS "Apple", "Banana", "Cherry" HEAR fruit AS "Apple", "Banana", "Cherry"
TALK "Nice choice! " + fruit + " is a great fruit! 🍓" TALK "Nice choice! " + fruit + " is a great fruit! 🍓"
``` ```
## 5. Send a Calendar Invite ## 5. Send a Calendar Invite
```basic ```basic
HEAR email AS EMAIL HEAR email AS EMAIL
HEAR date AS DATE HEAR date AS DATE
@ -581,6 +602,7 @@ SEND MAIL email, "Calendar Invite", "You are invited to an event on " + date
``` ```
## 6. Generate and Send QR Code ## 6. Generate and Send QR Code
```basic ```basic
HEAR url AS "https://example.com" HEAR url AS "https://example.com"
file = QRCODE url file = QRCODE url
@ -589,6 +611,7 @@ TALK "Here is your QR code for the URL: " + url
``` ```
## 7. Weather Update ## 7. Weather Update
```basic ```basic
GET "https://api.weatherapi.com/v1/current.json?key=YOUR_API_KEY&q=YOUR_LOCATION" GET "https://api.weatherapi.com/v1/current.json?key=YOUR_API_KEY&q=YOUR_LOCATION"
data = result.current data = result.current
@ -596,12 +619,14 @@ TALK "The current temperature is " + data.temp_c + "°C with " + data.condition.
``` ```
## 8. Todo List Reminder ## 8. Todo List Reminder
```basic ```basic
HEAR task AS STRING HEAR task AS STRING
TALK "Got it! I'll remind you about: " + task TALK "Got it! I'll remind you about: " + task
``` ```
## 9. Send Motivational Quote ## 9. Send Motivational Quote
```basic ```basic
quotes = ["Keep going!", "You got this!", "Believe in yourself!"] quotes = ["Keep going!", "You got this!", "Believe in yourself!"]
index = RANDOM(0, 2) index = RANDOM(0, 2)
@ -609,6 +634,7 @@ TALK quotes[index]
``` ```
## 10. Capture and Send Screenshot ## 10. Capture and Send Screenshot
```basic ```basic
OPEN "https://example.com" OPEN "https://example.com"
file = SCREENSHOT "body" file = SCREENSHOT "body"
@ -617,12 +643,14 @@ TALK "Here's a screenshot of the page."
``` ```
## 11. Daily Affirmation ## 11. Daily Affirmation
```basic ```basic
HEAR user AS NAME HEAR user AS NAME
TALK "Good morning " + user + "! Remember, today is going to be amazing! 🌟" TALK "Good morning " + user + "! Remember, today is going to be amazing! 🌟"
``` ```
## 12. Send a Joke ## 12. Send a Joke
```basic ```basic
jokes = ["Why dont scientists trust atoms? Because they make up everything!", "Why did the scarecrow win an award? Because he was outstanding in his field!"] jokes = ["Why dont scientists trust atoms? Because they make up everything!", "Why did the scarecrow win an award? Because he was outstanding in his field!"]
index = RANDOM(0, 1) index = RANDOM(0, 1)
@ -630,18 +658,21 @@ TALK jokes[index]
``` ```
## 13. User Poll ## 13. User Poll
```basic ```basic
HEAR choice AS "Option 1", "Option 2", "Option 3" HEAR choice AS "Option 1", "Option 2", "Option 3"
TALK "You selected " + choice + ". Thanks for your input! 🗳️" TALK "You selected " + choice + ". Thanks for your input! 🗳️"
``` ```
## 14. Image Caption Extraction ## 14. Image Caption Extraction
```basic ```basic
SEE CAPTION OF "https://example.com/image.jpg" AS caption SEE CAPTION OF "https://example.com/image.jpg" AS caption
TALK "The caption of the image is: " + caption TALK "The caption of the image is: " + caption
``` ```
## 15. Send Reminder Email ## 15. Send Reminder Email
```basic ```basic
HEAR email AS EMAIL HEAR email AS EMAIL
HEAR reminder AS STRING HEAR reminder AS STRING
@ -649,12 +680,14 @@ SEND MAIL email, "Reminder", "Just a friendly reminder: " + reminder
``` ```
## 16. Capture Text from Image ## 16. Capture Text from Image
```basic ```basic
SEE TEXT OF "https://example.com/image-with-text.jpg" AS text SEE TEXT OF "https://example.com/image-with-text.jpg" AS text
TALK "The text from the image is: " + text TALK "The text from the image is: " + text
``` ```
## 17. Add a Note ## 17. Add a Note
```basic ```basic
HEAR note AS STRING HEAR note AS STRING
ADD NOTE note ADD NOTE note
@ -662,6 +695,7 @@ TALK "Note added: " + note
``` ```
## 18. Generate Dynamic Chart ## 18. Generate Dynamic Chart
```basic ```basic
data = [5, 15, 25] data = [5, 15, 25]
labels = "Red;Green;Blue" labels = "Red;Green;Blue"
@ -671,6 +705,7 @@ TALK "Heres your dynamic chart!"
``` ```
## 19. Create and Send PDF Report ## 19. Create and Send PDF Report
```basic ```basic
data = FIND "data.xlsx", "A1:B10" data = FIND "data.xlsx", "A1:B10"
pdf = data AS PDF pdf = data AS PDF
@ -679,6 +714,7 @@ TALK "Here's your report in PDF format."
``` ```
## 20. Interactive Game ## 20. Interactive Game
```basic ```basic
TALK "Guess a number between 1 and 10." TALK "Guess a number between 1 and 10."
HEAR guess AS INTEGER HEAR guess AS INTEGER
@ -687,4 +723,5 @@ IF guess == 7
ELSE ELSE
TALK "Oops! Try again next time!" TALK "Oops! Try again next time!"
``` ```
These examples demonstrate various capabilities of the language, from simple text manipulation to more complex tasks like image processing. These examples demonstrate various capabilities of the language, from simple text manipulation to more complex tasks like image processing.