Navigation:  Introducing thinBasic >

Example 1

Previous pageReturn to chapter overviewNext page

 

This script will copy a file into Widows temporary directory. This is a simple 3 line script.

All lines of code are outside any "user defined function" so this code will be executed immediately.

 

'----------------------------------------------------------------------

 

 

USES "FILE"   'Tell thinBasic you need "FILE" module

USES "OS"     'Tell thinBasic you need "OS" module

 

'Define a string variable containing the name of the file to copy FROM.

'Function APP_SourcePath returns the path of the running script

DIM FileSource AS STRING VALUE APP_SOURCEPATH & "Test.txt"

 

'Define a string variable containing the name of the file to copy TO.

'Function OS_GetTempDir returns the path of the Temporary directory

'defined in your OS environment

DIM FileDest AS STRING VALUE OS_GETTEMPDIR & "Test.txt"

 

'Copy the file into the new location with

FILE_COPY ( FileSource, FileDest )