1. Starting Guide

<< Click to Display Table of Contents >>

Navigation:  1. Starting Guides >

1. Starting Guide

1.3. How to Start   

Previous Top Next


Starting Guide

 

The Scripting Process

How Can You Create Your Scripts?

 

clip0506

 

1.Using InstaRec to Record Scripts:

The InstaRec Recorder is like a reliable secretary, dutifully noting down your actions during an installation process.

You simply perform the installation steps as you usually would, and InstaRec does the rest, creating a script that can be replayed with ease.

This is particularly useful when you need to deploy the same installation on multiple systems.

You just need to perform the installation once, and then let the Smart Package Robot replicate it everywhere else.

 

2. Writing Scripts by Hand:

For tasks that can't be recorded—perhaps because they involve complex or non-standard interactions—you can directly write your own scripts using the Smart Package Robot Editor.

This approach gives you the freedom to input the necessary commands manually, offering you total control over every detail of the automation process.

Think of it as a direct conversation between you and Smart Package Robot , where you tell Smart Package Robot  exactly what to do.

 

3. Recording with the Smart Package Robot Editor:

If your task isn't too complex and you don't want to launch InstaRec, the Smart Package Robot Editor has a built-in recording feature that can come in handy.

With a simple press of the 'N' (Normal) or 'P' (Popup) button, you can start recording your actions and creating a script on the fly.

 

4. Utilizing Sample Scripts as Templates:

In the installation directory of the Smart Package Robot, you'll find a treasure trove of resources in the "Sample Scripts Folder".

This is not just a collection of examples, but rather a launching pad for your own scripting journey.

Many of the sample scripts can serve as a template for your own tasks.

You can modify these templates as needed, add your own touch, or even combine different elements from various sample scripts to create a completely new automation process.

These templates are like the scaffolding of a building, providing a solid structure upon which you can construct your own unique scripts.

It's a great starting point for those new to scripting and a time-saver for more experienced users.

Consider these sample scripts as your personal scripting toolkit, helping you to master the art of automation with the Smart Package Robot​.

 

Bit_Toggle

 

 

5. Understanding the Script Execution Process:

You've meticulously written or recorded your script, but what happens when you hit that "PLAY" button?

Let's break it down. As soon as you press "PLAY", the Smart Package Robot springs into action.

It starts by interpreting your script, understanding each command and preparing the necessary actions.

It's like a director reading through a script before the curtain rises on a play. This process ensures that everything is in order and ready to go.

Following this, the Smart Package Robot performs each action sequentially, just as you have instructed.

It moves the cursor, clicks on buttons, types in information, and so on, all while maintaining the flow and timing you've set.

It's like watching a well-rehearsed performance, with each action smoothly transitioning into the next.

With the Smart Package Robot, you can be sure that your tasks will be performed accurately and efficiently​.

 

BBar

Sample Script in the SPR-Editor.

 

Diving Into the Execution Process: 

When you press "PLAY" in the SPR-Editor, it sets off a chain of events.

The first thing it does is to summon our dependable friend, MR01.exe.

This file is the "Robot Executable", the brains of the operation.

Think of MR01.exe as the marionette master who pulls all the strings.

It takes your script commands, interprets them, and brings your Smart Package Robot to life, guiding it to perform the tasks you've outlined.

In this way, your script becomes a set of precise, actionable instructions that MR01.exe uses to orchestrate the Smart Package Robot's actions​​.

 

MR01

The Icon of the MR01.exe

 

Delving Deeper into MR01.exe

This is where the magic happens!

The MR01.exe is the heart and soul of your Smart Package Robot. Once you've hit "PLAY" in the SPR-Editor, the Robot Executable, MR01.exe, takes over.

It's responsible for translating and executing the majority, if not all, of your script commands.

It's as if MR01.exe takes your script and breathes life into it, making it dance to your tunes.

Your Smart Package Robot's actions are orchestrated entirely within the confines of MR01.exe.

This is why we often say that the magic of automation lives within MR01.exe .

 

6. The Art of Preprocessing:

The first pivotal step in executing your script lies in the hands of the "Pre-Processor." This diligent component meticulously prepares your script, making it ready for the ensuing "Speedcode Compiler."

The Pre-Processor's role is multifaceted, focusing on refining your script to be as precise and streamlined as possible, thereby facilitating a smooth execution.

 

Unraveling MACROs:

One of the key tasks of the Pre-Processor involves deciphering MACROs. MACROs are concise code substitutes that represent a more extensive piece of code.

They help keep your script compact and more readable. However, improper definition or usage of MACROs can introduce errors. The Pre-Processor, acting as a vigilant guard, checks and resolves these potential discrepancies, ensuring a seamless run of your script.

 

Integrating #INC Files:

The Pre-Processor also takes on the role of a detective when it comes to #INC files. These files are external entities containing supplementary code or resources, such as libraries or images, which are essential for your script to function.

The Pre-Processor hunts for any missing #INC files and incorporates them into your script, guaranteeing that all necessary elements are in place.

 

Bug Squashing:

Next, the Pre-Processor assumes the persona of a bug exterminator. It scans your script for coding bugs - pesky issues that may arise due to typos, incorrect syntax, or missing punctuation, like semicolons.

The Pre-Processor rectifies these bugs, ensuring your script can perform its dance without stumbling.

 

Syntax Error Checking:

Finally, the Pre-Processor morphs into a proofreader, looking out for syntax errors that can't be automatically corrected. Syntax errors occur when the computer cannot comprehend the script due to issues like missing brackets or incorrect variable names.

If such errors are detected, the Pre-Processor not only identifies them but also suggests possible solutions for you to rectify them.

 

Once the Pre-Processor has diligently performed all of these tasks, it passes the refined script onto the Speedcode Compiler. The Compiler then transforms the preprocessed script into machine code, a language that your computer can understand and execute. In this manner, the Pre-Processor plays a critical role in the script creation process, ensuring your script is as optimized and error-free as possible before it faces the Compiler.
 

7. The Speedcode-Compiler

In script creation, a significant hurdle lies in the time it takes to fetch a command.

The Speedcode Compiler, a pivotal component in the script execution process, addresses this by transforming various elements of the script into a format that facilitates quicker execution.

This transformative process is commonly known as "converting to Speedcode."

 

Efficient Label Formatting:

The Speedcode Compiler begins its work by streamlining labels. Labels serve as milestones, marking specific segments in the script for easier navigation and comprehension.

By reformatting these labels into a more efficient format, the Speedcode Compiler significantly reduces the command fetch time.

 

Optimizing Conditional Statements:

Next, the Speedcode Compiler optimizes conditional statements.

These statements play a crucial role in steering the script's flow, determining which commands are executed and which are bypassed.

By reshaping these statements into a more conducive format, the Speedcode Compiler accelerates the command fetch process.

 

Loop Formatting:

Loops, which are employed to repeat a section of the script multiple times, are also a focal point for the Speedcode Compiler.

Improperly formatted loops can cause substantial delays. By remodeling loops into a more efficient format, the Speedcode Compiler curtails the command fetch time.

 

General Command Formatting:

Finally, the Speedcode Compiler reformats all commands into a format that expedites execution.

This includes any other commands not explicitly mentioned above, such as function calls, assignments, and more.

 

After the entire code has been converted to Speedcode, it is ushered to the next phase of the process.

This could involve further compilation, optimization, or direct execution of the script.

The overarching goal of this intricate process is to enhance the script's efficiency, thereby minimizing command fetch time and amplifying the script's overall performance.

 

8. The Script Execution

The Script execution is the grand finale in the script creation process.

It breathes life into your script.

This is the moment where the meticulously prepared script is let loose on a computer, with each command sequentially coming to life.

 

Just like an orchestra performing a symphony, the computer meticulously reads and performs each line of the script, usually from top to bottom.

The maestro, which is the computer in this case, reads the first line of the script, interpreting and executing the command it contains.

Next, it smoothly transitions to the second line, performing the same process.

This sequential performance continues unabated, line by line, until the final note - or in our case, the final line of the script.

 

To ensure a flawless performance, the execution of the script is closely monitored.

If all elements align harmoniously, the script executes without a hitch, each command sequentially springing into action, leading the script to its intended conclusion.

Once the final command has been executed, the task at hand is complete, marking the end of the process.

 

To sum up, script execution is the culminating point in the script creation process, turning lines of code into a symphony of actions.

Like a well-rehearsed ensemble, the script, if well-written, will perform seamlessly from start to finish, bringing your digital masterpiece to life.

 

9. The Script End

In the grand theatre of script execution, the final act is often overlooked, but it's an essential part of the process: the cleanup phase.

This phase ensures a graceful and efficient exit, tying up loose ends by releasing the resources that were employed during the script's grand performance, such as memory, files, and other resources.

 

Picture this phase as the crew that enters the stage after the play has ended, tidying up the props and scenery.

Without them, the theatre would soon fall into disarray.

In the same way, the cleanup phase prevents memory leaks and other potential issues that could turn into major headaches down the line if resources aren't properly managed.

 

Now, if the script is a compiled executable, it doesn't just exit stage left without a word.

Instead, it leaves behind a parting gift: an error code.

This error code acts as a messenger, communicating the final status of the script's performance to the initiating process.

A standing ovation is represented by a value of zero, indicating a flawless execution, while any other number signals that there was a hiccup during the performance.

This error code can be used by the backstage crew (the initiating process) to figure out what went wrong and how to fix it in future performances.

 

In conclusion, the script end, or the cleanup phase, plays a vital but often underappreciated role in the execution process of a script. It ensures a tidy and efficient conclusion, diligently releasing resources, and, if it's a compiled executable, providing valuable feedback through an error code.

 

 

graphic

 

 

 

See also:

1.3. How to Start

1.3.1 The Scripting Process

1.3.2 Commands you should start with

1.3.3 Compiling a Standalone Executable

1.3.4 Compiling a package (SPRE)))

1.3.5 The Script Execution Process

1.4. The Prototype Parameter System

1.5. Speed Considerations

1.5.1 FAQ - How to ...

1.5.2 Using Variables

1.5.3 More about Variables

1.5.5 Global and Local Variables

1.5.6 Using the data stacks

1.5.7 Using Text-Strings

1.5.8 Basic String Operations

1.5.9. Organizing data items in blocks

1.6.1. Program Flow Control

1.6.2. Looping around

1.6.3 Flexible Loops

1.7. Application and PID

1.7.1 Applications and Threads

1.8. Selecting the Application (Topwindow)

1.8.1 The "Client" and the "Non-Client" Parts of a window

1.9. Locating Child-Windows