Site Map   
Home   
 

 

 

Overview - General

 

 

Purpose  
  The main scope of daVinci is to automate manual computer activities, so they can be carried out in a single operation, no matter of how many or how complicated they are, with just a mouse click.

daVinci can work in a wide range of modes and, thanks to all the different executables operating on different platforms, offers an almost unlimited power to the handy user willing to write and test his own scripts.
Even with simple scripts, consisting of just a few lines, you will able to carry out complicated tasks. Then, by adding the power of the built-in programming capabilities, with variables, conditional statements and loops, you will be able to move your scripts to a higher dimension.

While a wide range of program-flow statements are available, the emphasis of the functionality has been put on powerful instructions rather than on the possibility to create complex program flows.
As an example, suppose you need to upload to a server all the recently changed files from a local folder, and then download them from various stationary or mobile computers. This particular task would require only two statements for the uploading operation and one single statement for the downloading operation.
 

 

How it works  
 
Command interpretation
The basic mechanism in daVinci relies in the interpretation of text files (scripts) containing instructions in the form of a series of commands.

The task defined by each single command is carried out directly, before the next command is read and interpreted. When no more commands are found in the script, daVinci terminates.

Commands are typically composed by a command name and a various number of arguments enclosed in-between parenthesis, like for instance the following one:
CopyFile( "C:\Temp\source-file.txt" "C:\Project\source-file.txt" ).
 
 
 
Programming
When things become more complicated, when more intelligence needs to be recorded in your scripts, daVinci's programming capabilities give the scripts the power they need.

By means of a various number of predefined system constants, user defined variables and functions, conditional statements,
arithmetical operations and loops, your script will "think" for you and will do exactly the right job for the current situation, every time!

Thanks to the built-in power of daVinci's commands, very complicated tasks can be expressed in just few lines, rather than a long sequence of instructions as it will be the case in ordinary script languages.

As an example, two simple commands are all you need to upload from your PC to a server all the files that were changed since the last upload:
FtpSetup( <ftp-url> <ftp-account> <ftp-password>)
FtpUploadFiles( <local-folder> <server-folder> Changed )

 
 
 
Inclusion of external scripts
As your script grows and becomes more and more complicated, the introduction of modularity will become a necessity.

That is not a problem, thanks to possibility to include in scripts other scripts defined in external files. When daVinci detects the command Include(<filename>), it reads and interprets at once the contents of the pointed file.

One major benefit of script inclusion is the possibility to define in separate files functions used by many different scripts. When one function is to be corrected or improved, the changes made in one single file will affect all the scripts currently using it.

There is no limit for how many files you can include this way, and you will be able to do it down to ten levels of deep.
 
 

 

Preparation  
  Setting up a PC shortcut

The easiest way to launch daVinci and let it execute a certain script is to do it through a shortcut, as described below:

1. In Windows Explorer, right-click on the name of the executable (daVinci.exe) and select "Create Shortcut" from the popup menu.

2. Right-click on the newly created shortcut (Shortcut to daVinci.exe) and select "Properties" from the popup menu.

3. Type, at the end of the Target field, after the executable name, the name of your script (include the complete path if it is located in a folder different than the one of the executable).
 
 
 
1. Create a daVinci shortcut

2. Edit the shortcut properties

3. Append the script filename

 
 
At this point a good thing to do would be renaming the shortcut using the name of the related script file (which will make it easier for you to identify it among others). For instance, if the script name is "My script.txt", you could rename the shortcut "My script".
Then you can move the shortcut to the destination of your preference, like the desktop, or a dedicated folder or even leave it in the daVinci folder.
 
  Setting up a mobile shortcut

On mobile units it is not so simple to create shortcuts that contain a command line.
We suggest that you use the daVinci's built-in function PdaCreateShortcut() for that purpose.
For instance, you could execute the following script on your PC, with your mobile unit connected through ActiveSync:
PdaCreateShortcut( "TestScript" "/Program Files/daVinciMob/daVinciMob.exe"
                   "/My Documents/daVinci Scripts/Test.txt" "/Windows/Start Menu/Programs" )

The code above will create in the Programs folder (/Windows/Start Menu/Programs) on your mobile a shortcut named TestScript. When you tap with the pen on the shortcut icon, the script Test.txt, found in /My Documents/daVinci Scripts, will be executed.
 
  Alternative way of preparation

Step 1:
Change the extension of your script filename from txt to something else, for instance
dav.

Step 2:
Double-click on the script file. When Windows asks you for the name of the executable to run, browse your File System and select daVinci.exe. Check also the box labeled: Always use the selected program to open this kind of file.

Now your system is ready to launch daVinci every time you double-click on a file with the
dav extension.
 

 

Execution  
  In order to execute your script file, just double-click on the shortcut icon. daVinci will open the script file and execute all the commands found in it. When the last command is carried out, daVinci terminates.

If the execution of a script takes time, it is fully possible to start another script before the first one is terminated. There is no limit (except the amount of RAM in your computer) for how many instances of daVinci that can run contemporaneously.
 

 

Feedback during debugging  
  Once your script is well tested and free of bugs you will probably want to keep it silent (except for error message when things go wrong).
But the way to a perfectly working script can be long and painful, especially when its complexity is considerable.

In order to make the developing work easier, daVinci supplies the following ways of feedback from the execution of your script:

1. Debugger window
A combined Command/Printouts window that can show:
  - All the executed statements. This way, if the execution is stopped for some reason, you will have the possibility to see exactly after
    which statement, and also all the statements executed so far.
  - Diagnostic printouts (generate by you script through Print() statements) and error messages (generated by the application when things
    go wrong). This will give you the possibility concentrate the feedback to certain parts of the script, without the need to browse through a
    large quantity of lines to find the part you need to examine.

2. Log files
One or several log files can be used (with the possibility to switch between them), where all outputs (error messages and printouts) are written. The log files are very versatile, allowing you to use them for a number of different purposes. You can for instance:
  - Open a log file and erase its current contents before anything new is written in it, or keep the old contents intact and append all new
    outputs to it.
  - Open a different log file for each one of your scripts or share the same log file between different scripts.
  - Open, close and open again the log file, how many times you want, during the execution of your script.
  - Switch between different log files during the execution of your script.

3. Special statements
A number of special statements, like Pause and Exit, can be used in the script in order to control its execution during debugging.

All the described options can be freely combined with each other and, since they are started through ordinary commands inside the script, they could be switched on and off at any time through conditional statements inside the script being executed (for instance when certain special conditions occur).
See the examples below:
If( @Error )
   OpenWindow( Printouts )
   Print( "Number of found entities: %Counter%" )
   Pause
   CloseWindow
Endif

IfBigger( @Value 32 ) Exit Endif
 
     
   
Produced by Carso   |  Last update: 2009-04-23