Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Write Cicode and Create Citect

Name: SCADA 2013-04-12 5:30

Practical 1 : Introduction to SCADA

OBJECTIVES:

1. To understand the concept of SCADA and familiarize with the CITECT SCADA environment

2. To create and manage projects using Citect Explorer


Creating and managing projects with Citect Explorer

The Citect Explorer is the application from which you organise your projects and launch the configuration and run-time applications. Tasks such as creating, deleting, backing up and restoring projects are fundamental to any Citect application.

Creating a new Project

The first thing you need to do when configuring Citect is to create a new project in which to store your project information.

⇨ To create a new project:

1. In the Citect Explorer, select File ǀ New Project or click on the New button

2. The following dialog will appear - fill in the relevant details: e.g : Name : Training, Description : Training Project

Hints & Tips:

To go to the next field, use the mouse cursor or press the TAB key. To go back a field press SHIFT-TAB

3. Click on OK.

Citect will now create the configuration databases that will be the building blocks of your project.

Note the new entry called Training in the Project List- this entry will contain all of the configuration information for your project.

Backing Up & Restoring a Project

⇨ To backup a project:

1. Select Tools ǀ Backup ... from the menus or click on the icon

2. The following dialog will appear- fill in the details as required

To restore a project

1. Select Tools ǀ Restore ... from the menus or click on the icon

2. The following dialog will appear- fill in the details as required.

NOTE: When backing up a project, the project is backed up to a file called ctbackup.ctz. When restoring a project look for the file that you have backep up (with the .ctz extension)

Deleting a Project

⇨ To delete a project:

1. In the Citect Explorer, click on the project that you want to delete from the Project List.

2. Select File ǀ Delete Project from the menus or select Delete Project from the context menu.

See Also:

Delete a Project in the Projects' category in Help Direct.

Exercise

1. In the Citect Explorer, backup your project to the directory C:\Temp.

NOTE: You should do this after every lab session so that you will have a backup copy in case it is accidentally deleted.

2. To simulate an accidental delete, delete your project called Training.

3. To simulate the recovery of your lost project, restore the project from C:\Temp to a new Training project that was lost. Notice that all the component of your 'lost' training project was recovered.

4. To prepare for the next part of the lab, delete your Training project.

Citect can communicate with any control or monitoring 1/0 Device that has a communication port or data highway - including PLCs (Programmable Logic Controllers), loop controllers, bar code readers, scientific analyzers, remote terminal units (RTUs), and distributed control systems (DCS). Citect communicates directly with the 1/0 Devices in your plant or factory.

Express Communications Wizard

The Express Communications Wizard enables you to quickly setup communication with a new or existing 1/0 Device:

⇨ To run the Express Communications Wizard:

1. In the Citect Explorer select the project you are working on.

2. Click on the Communications folder in the Project List.

3. Double click on the Express 110 Device Setup item in the Contents Area:

The following dialog is displayed:

By filling in the relevant information and clicking on the Next button, the Express Communications Wizard will guide you through the setup process.

Exercise

1. First, create a new project and call it TEST. The location should be C:\Temp.

2. Setup communication to an external Omron C200HE PLC using serial communication (accept the default name for the 1/0 Device - i.e. 10Dev1 ). If you are using a different type of PLC then select it instead.

The Communications Dialogs

After running the Express Communications Wizard, a set of communications dialogs are created that can be found in the Communications folder in the Citect Explorer.

The dialogs that would have been created in the previous exercise for Omron C200HS PLC connected serially are shown below:

Boards :

Board Name : BOARD1

Ports :

Board Name : BOARD1

I/O Devices

Port Name : PORT_BOARD1

Exercise

1. Open up each of the dialogs shown above from the Citect Explorer. Do this by highlighting the Communications folder in the Project List and then double clicking on the 1/0 Servers, Boards, Ports and 1/0 Devices items in
the Contents Area.

2. Go to Citect Editor and click on to the Communication menu. Select Port and change the baud rate from 19200 to 9600 (the baud rate for Omron PLC serial comm).

3. Click on the Help button for each of the communications dialogs for more information.


Testing Communications

To test that the server and 1/0 Device are communicating.

We will first define a variable tag called Green_Lamp and display its value on a graphics page. Here, we will control the green lamp ON or OFF through the Citect system.

⇨ To define a variable tag :

1. In the Citect Explorer click on the Tags folder in the Project List and double click on the Variable Tags item in the Contents Area:

2. The following dialog will be displayed:

Variable Tags

Fill in the fields of the dialog as follows:

Variable Tag Name : Green_Lamp

IO DEVICE NAME : IODev

Data Type : DIGITAL

Address : 301

If you are using a PLC other than a Omron then the Address field will be different. Check the Citect Help Topics for the correct address.

See Also:

Click on the Help button on the Variable Tags dialog to get information about each field.

3. Click Add.

⇨ To display the value of the variable tag on a graphics page:

1. Double click on the Create a new page button in Citect Explorer

or

Click on the New button in the Graphics Builder.

2. If you double clicked Create a new page then go straight to step 3, otherwise, click the Page button when the following dialog is displayed:

3. Make your selection from the Use Template dialog:

For a test page, select :

Style : standard

Linked : tick

Title Bar : tick

Resolution : Default

Template : Normal

4. Click on OK.

5. Draw a button on the page by selecting the Button tool from the toolbox.

6. Move the mouse to where you want the button to start and press (and hold) the mouse button. Drag the mouse to where you want the button to finish and release the mouse button.

 ↘

7. The following dialog will be displayed (if it is not displayed then use the mouse to double click on the button you just drew):

In the Text field type ON Green Lamp as shown above.

8. Click on the Input tab (at the top of the dialog) and the following dialog will be displayed:

In the Action list click the Up check box and in the Up command field type Green_Lamp = 1.

9. Click on OK.

10. Draw another button by repeating steps 5 to 9- for this button type OFF Green Lamp in the Text field and Green_Lamp = 0 in the Up command field.

11. Select the Text tool from the toolbox and move the cursor to a point near the buttons you drew- by doing this we will draw some text to display the value of the Green_lamp tag.

12. Press the space bar once and then click the left mouse button. A dialog will be displayed (if it is not displayed then use the mouse to double click on the object you just drew).

13. Click on the Appearance tab along the top of the dialog and then click on the Display Value tab at the right of the dialog.

In the ON text when field type Green_Lamp (as a defautt the Type should already be set as On / Off), in the OFF text field type OFF and in the ON text field type ON.

14. Click on OK.

15. Click on the Save button on the tool bar to save the page. Select Test from the Project list and then type Test in the Page field.

16. Click on OK. Remember to set to Memory 10 before testing the project

17. Run the Computer Setup Wizard.

18. Click on the Run Project button to run and test the project. Click on the ON and then the OFF buttons to see the effect.

Exercise

1. Now, create a lamp on the graphics editor to monitor the red lamp status from Citect. First, create and add another variable tag (Refer to earlier section To define a variable tag) with the followings:

Variable Tag Name : Red_Lamp I/O Device Name : IODEV1, Data Type : DIGITAL, ADDRESS : 300

2. Select the Symbol Set to create an indicator lamp to represent the physical red lamp. Add Red_Lamp to the dialog box ON symbol when as indicated in the diagram below. Click Apply and OK.

3. Create two buttons : one to turn ON the Red lamp and one to turn OFF the Red lamp.

4. Click on the Save button on the tool bar to save the page.

5. Click on the Run Project button to run and test the project. Clicking on the buttons will activate the Red lamp ON or OFF according to which button is being clicked.

Name: SCADA 2013-05-13 0:27

Citest Directory :

TRENDARC.CI

//
//    FILE:    TrendArc.ci
//
//    AUTHOR:    Tom Purcell
//
//    DATE:    December 1993
//
//    REVISION:
//
//    3.00    February 1994.
//
//    4.00    September 1996
//            Added ServerInfo() to get name of current INI file
//            Added Version() to check to see whether to run ctbackup.exe or ctback32.exe
//            Removed Version() to check to see whether to run ctbackup.exe or ctback32.exe
//
//    5.00    November 1998.  Graeme Sutton.
//            Modified to use new CtBack32.exe in v5.10r0, this version is
//            not compatable with earlier versions of Citect.
//            ArchivePath parameter now also accepts any backup
//            file names ending in .CTZ or .ZIP -
//                eg.  C:\Citect\Archive\TestArc.ctz
//            Modified _RemoveHistoryFiles() function to correctly delete files.
//
//    NOTES:    This file contains functions for archiving and restoring trend history.
//


INT    hDev1;        !handle for Trend tags database
INT    hDev2;        !handle for selected Trend tags database
INT    hFormb;        !handle for backup form
INT    hFormc;        !handle for configure form
INT    hField1;    !handle for trend selection combo box
INT    hField2;    !handle for selected trends list box
STRING    sSelect1;    !output buffer for combo box
STRING    sSelect2;    !output buffer for list box
STRING    BackupPath;    !files copied here before archive
STRING    RestorePath;    !files restored here from archive
STRING    ArchivePath;    !Trend archive stored here
STRING    CtBackupPath;    !used to call CtBackup.exe
STRING    Operation;    !Selects between 0=backup and 1=restore
STRING    sCitectINI;    !Name of the Citect.INI file being used
STRING    OperationSave;    !Selects between 0=backup and 1=restore
STRING    FilePathSave;    !Stores the name of the CtBackup archive file for restoration
STRING    ArchivePathSave;!Stores the name of the CtBackup arcihve path for restoration


//    FUNCTION        TrendArchive
//
//    Syntax
//    TrendArchive(Mode)
//    eg TrendArchive() for default or TrendArchive(0) Do not display the configure
//    button.  mode 1 display the configure button.
//    mode 1 is the default, if using mode 1 then the [Trend]BackupPath=,
//    [Trend]RestorePath= and [Trend]ArchivePath= parameters must be set
//    in the Citect.INI file.
//
//    This function allows backup or restore of trend archives, it displays
//    a form with five buttons, "Backup Selected Trends", "Backup All System Trends"
//    "Restore", "Configure", "Cancel".
//
//    To use this function, two devices must be configured in your database
//    the devices should be configured as follows.
//
//    1. Name : TrendTags, Path : [RUN]:TREND.DBF, Type : dBASE_DEV
//    2. Name : TrendBackup, Format : {NAME,16}{FILENAME,64}
//    Path : [RUN]:TrendBK.DBF, Type : dBASE_DEV
//
//    You must also create two directories, a backup directory to which the
//    files will be copies before been backed up eg C:\CITECT\BACKUP\ and a
//    restore directory to which the files will be restored to before been
//    attached to the trend system eg C:\CITECT\RESTORE\ The path to these
//    directories must be specified when you first call the function, this
//    is done through the configure button on the main form. Also note that
//    these directories should be for the exclusive use of the Trend Archive
//    system and you should not specify the directory that contains your live
//    trend history files!.
//
//    CAUTION !! Any files in the restore directory or any sub directories of
//    the restore directory will be deleted by the restore function!
//


PUBLIC
FUNCTION
TrendArchive(INT mode = 1)
   
    hDev1 = Devopen("TrendTags", 0);
    hDev2 = DevOpen("TrendBackup", 0);
    FormNew("Trend Archive System", 32, 5, 4);
    FormButton(0, 0, "     Backup Selected Trends    ", _BackupForm, 0);
    FormButton(0, 2, "    Backup All System Trends   ", _BackupTrends1, 0);
    FormButton(0, 4, " Restore ", _RestoreForm, 0);
    IF mode = 1 THEN
        FormButton(11, 4, "Configure", _ConfigureForm, 0);
    END
    FormButton(22, 4, " Cancel  ", 0, 2);
    _CtBackupEnvSave();
    FormRead(0);
    DevClose(hDev1);
    DevClose(hDev2);
END


//    FUNCTION:        _BackupForm
//
//    This function gives a list of all configured trends on the system
//    and allows the trends to be selected or deselected for archival,
//    the selected tag names are stored in a dBase device "TrendTags".

PRIVATE
INT
FUNCTION
_BackupForm()
   
    sSelect2 = "";
    DevSeek(hDev1, 1);
    DevSeek(hDev2, 1);
    hFormb = FormNew("Trend Backup", 38, 11, 0);
    hField1 = FormComboBox(1, 1, 16, 8, sSelect1);
    WHILE NOT DevEof(hDev1) DO
        FormAddList(DevGetField(hdev1, "NAME"));
        DevNext(hDev1);
    END
    hField2 = FormListBox(20, 1, 16, 8, sSelect2);
    WHILE NOT DevEof(hDev2) DO
        FormAddList(DevGetField(hdev2, "NAME"));
        DevNext(hDev2);
    END
    FormPrompt(3, 0, "All Trends");
    FormPrompt(20,0, "Selected Trends");
    FormButton(1, 10, " Add ", _AddNewTrend, 0);
    FormButton(8, 10, " Remove ", _RemoveTrend, 0);
    FormButton(18, 10, " Backup ", _BackupTrends0, 0);
    FormButton(28, 10, " Cancel ", 0, 2);
    FormRead(0);
    RETURN 0;
END


//    FUNCTION:        _AddNewTrend
//
//    This function is called from the Backup form, it searches the Trend
//    database for the trend which has selected from the Combo box and
//    when it finds it, it gets its name and path and adds these to the
//    dBase device "TrendTags" for use by the _BackupTrends() function,
//
//

PRIVATE
INT
FUNCTION
_AddNewTrend()
    STRING    sName = "";
    STRING    sFile = "";
   
    FormGetData(hFormb);
    DevSeek(hDev1, 1);
    IF NOT DevFind(hDev1, sSelect1, "NAME") THEN
        sName = DevGetField(hDev1, "NAME");
        sFile = DevGetField(hDev1, "FILENAME");
        IF NOT DevAppend(hDev2)    THEN
            DevSetField(hDev2, "NAME", sName);
            DevSetField(hDev2, "FILENAME", sFile);
            FormSetText(hFormb, hField2, sName);
        END
    ELSE
        DspError("Cannot Find " + sSelect1);
    END
    RETURN 0;
END


//    FUNCTION:        _RemoveTrend
//
//    This function is used to remove trends from the selection list box
//    on the backup form, the trend name will also be removed from the
//    dBase device "TrendTags", the device is then packed.

PRIVATE
INT
FUNCTION
_RemoveTrend()
    STRING    sFile;

    FormGetData(hformb);
    DevSeek(hDev2, 1);
    IF NOT DevFind(hDev2, sSelect2, "NAME") THEN
        DevDelete(hDev2);
    ELSE
        DspError("Cannot Find " + sSelect2);
        RETURN 0;
    END
    DevControl(hDev2, 1, "");
    FormDestroy(hFormb);
    _BackupForm();
    RETURN 0;
END

//    FUNCTION:        _BackupTrends
//
//    This function copies all the files listed in the dBase device
//    "TrendBackup" to the "[Trend] BackupPath" directory and then calls
//    CtBackup.exe to do a compressed backup of the files into the archive
//    directory "[Trend] ArchivePath=", both of these directories can be
//    set using the "Configure" form.
//    If you pass a 1 to this function it will read the "TrendTags" device
//    instead of the "TrendBackup" device, this will cause it to archive all
//    trends on the system not just the selected ones.


INT
FUNCTION
_BackupTrends(INT DevSelect = 0)
    INT    error;
    INT     hForm;
    STRING    TrendPath;
    INT    hDevGeneric;
    STRING    TempPath;
   
    IF Devselect = 1 THEN
        hDevGeneric = hDev1;
    ELSE
        hDevGeneric = hDev2;
    END
       
    // This check is to ensure that the path is legal and prevent your drive from been zapped //
    IF _CheckBackupPath() THEN
        ErrSet(1);
        hForm = FormNew("Please Wait !", 26, 1, 0);
        FormPrompt(6, 0, "Copying Files");
        FormRead(1);
        FileDelete(BackupPath + "*.*");
        DevSeek(hDevGeneric, 1);
        WHILE NOT DevEof(hDevGeneric) DO
            TrendPath = DevGetField(hDevGeneric, "FILENAME");
            !The following is so that if the trend path field is blank it will use the default //
            IF TrendPath = "" THEN
                TrendPath = "[Data]:" + StrLeft(DevGetField(hDevGeneric, "Name"),8);
            END
            error = FileCopy(TrendPath + ".*", BackupPath, 0);
            IF error > 0 THEN
                Message("Error Copying Files", "Cicode Error " + IntToStr(error) + "^n Does " + BackupPath + " Exist", 48);
                FormDestroy(hForm);
                RETURN 0;
            END
            DevNext(hDevGeneric);
        END
        FormDestroy(hForm);
        Operation = 0;
        _CtBackupEnvSet();
        error = Exec(CtBackupPath + " -a" + " -xhst" + " -i" + sCitectINI, 1);
        _CtBackupEnvReset();
        IF error > 0 THEN
            Message("Error", "Cannot Run " + CtBackupPath, 48);
        END
        ErrSet(0);
    END
    RETURN 0;
END

//    FUNCTION:        _BackupTrends1()
//               
//    DESCRIPTION:    This function is a stub which is used to pass a "1"
//                to the _BackupTrends()function as this cannot be done
//                from FormButton()in TrendArchive()
//                The function is called from TrendArchive()

PRIVATE
INT
FUNCTION
_BackupTrends1()
    _BackupTrends(1);
    RETURN 0;
END


//    FUNCTION:        _BackupTrends0()
//
//    This function is a stub which is used to pass a "0" to the _BackupTrends()
//    function as this cannot be done from FormButton() in _BackupForm()
//    The function is called from _BackupForm

PRIVATE
INT
FUNCTION
_BackupTrends0()

    _BackupTrends(0);
    RETURN 0;
END

Name: SCADA 2013-05-13 0:30

Citest Directory :

Continue :

TRENDARC.CI


//    FUNCTION:        _RestoreForm
//
//    This function is for restoring trend archives, it displays three
//    buttons, "Restore from Backup", "Add Files to System" and "Cancel".

PRIVATE
INT
FUNCTION
_RestoreForm()

    FormNew("Restore Trend Archives", 29, 7, 4);
    FormButton(0, 0, "    Restore From Archive    ", _RestoreFiles, 0);
    FormButton(0, 2, "   Attach Files to System   ", _AddHistoryFiles, 0);
    FormButton(0, 4, "  Remove Files from System  ", _RemoveHistoryFiles, 0);
    FormButton(0, 6, "           Cancel           ", 0, 2);
    FormRead(0);
    RETURN 0;
END

//    FUNCTION    _RestoreFiles
//
//    This function restores trend archives to a reserved directory so
//    that they can be added the the Trend system, this directory will be
//    set by the Configure dialogue and stored in the Citect.INI as
//    "[Trend] RestorePath="

PRIVATE
INT
FUNCTION
_RestoreFiles()

    IF _CheckRestorePath() THEN
        Operation = 1;
        _CtBackupEnvSet();
        Exec(CtBackupPath + " -a" + " -xhst" + " -i" + sCitectINI, 1);
        !IF FileExist(RestorePath + "project.cit") THEN
        !    FileDelete(RestorePath + "project.cit");
        !END
        _CtBackupEnvReset();
    END
    RETURN 0;
END

//    FUNCTION:        _AddHistoryFiles
//
//    This function adds the files to the trend system using TrnAddHistory()
//    these files must first be restored from archive with the
//    "Restore From Archive" button
//

INT
FUNCTION
_AddHistoryFiles()
    STRING     sPath;
    STRING     buffer;
    INT     hform;
    INT     hField;
   
    hForm = FormNew("Please Wait !", 36, 2, 0);
    sPath = FileFind(RestorePath + "*.*", 0);
    FormPrompt(6, 0, "Adding Trends To System");
    hField = FormField(1, 1, 32, 1, 3, buffer, sPath, 0);
    FormRead(1);
    WHILE StrLength(sPath) > 0 DO
        TrnAddHistory(sPath);
        sPath = FileFind("", 0);
        FormSetText(hForm, hField, sPath);
    END
    FormDestroy(hForm);
    RETURN 0;
END


//    FUNCTION:        _RemoveHistoryFiles
//
//    This function removes the files that were added using _AddHistoryFiles
//    function. It also deletes the files from the restore directory.

PRIVATE
INT
FUNCTION
_RemoveHistoryFiles()
    INT     hForm;
    INT    hField
    STRING    buffer;
    STRING    sPath;
   
    hForm = FormNew("Please Wait !", 36, 2, 0);
    FormPrompt(6, 0, "Removing Trends From System");
    _RemoveFiles(RestorePath + "*.*");
    FormDestroy(hForm);
    RETURN 0;
END


//    FUNCTION:        _RemoveFiles
//
//    This is necessary beacuse calling FileFind("", 0) in the same loop
//    as calling FileDelete() will not work.  Calling it recursively finds
//    all file first then deletes the files.


PRIVATE
FUNCTION
_RemoveFiles(STRING sDirName)

    INT    hField;
    STRING    sPath;

    sPath = FileFind(sDirName, 0);
    IF sPath <> "" THEN
        _RemoveFiles("");        // Call recursively
        TrnDelHistory(sPath);
        FileDelete(sPath);
    END
END


//    FUNCTION:        _ConfigureForm
//
//    This function displays a dialogue box which allows three directory
//    paths to be set, "BackupPath" : this is where the trend files get
//    copied before they get archived, "RestorePath" : this is where the
//    files get restored to from archive before getting linked into the
//    the trend system, "ArchivePath" : this directory is where the
//    compressed archives of the selected files are created. Optionally
//    any file name ending in .CTZ or .ZIP can also be specified as part
//    of the ArchivePath.

PRIVATE
INT
FUNCTION
_ConfigureForm()

    hFormc = FormNew("Configure Trend Archive", 47, 8, 0);
    FormGroupBox(0, 0, 47, 5);
    FormPrompt(1, 1, "Backup Path");
    FormPrompt(1, 2, "Restore Path");
    FormPrompt(1, 5, "Archive Path");
    FormEdit(14, 1, BackupPath, 32);
    FormEdit(14, 2, RestorePath, 32);
    FormEdit(14, 5, ArchivePath, 32);
    FormButton(15, 7, "   OK   ", _ConfigSave, 1);
    FormButton(25, 7, " Cancel ", 0, 2);
    FormRead(0);
    RETURN 0;
END


//    FUNCTION:        _ConfigSave
//
//    This function is called from the "OK" button on the Config form and
//    it saves the configuration to the Citect.INI file.

PRIVATE
INT
FUNCTION
_ConfigSave()

    INT    Length1;
    INT    Length2;
   
    FormGetData(hFormc);
    SleepMS(500);        /* this is required to allow time for _ConfigureForm
                 to write to its variables when it closes, other wise
                 it will clobber the new values when it closes */
    _UpdatePath();
    ParameterPut("Trend", "BackupPath", BackupPath);
    ParameterPut("Trend", "RestorePath", RestorePath);
    ParameterPut("Trend", "ArchivePath", ArchivePath);
    RETURN 0;
END

//    FUNCTION:        _UpDatePath
//
//    This function is called from the TrendArchive function and from the _ConfigSave function,
//    it gets the parameter data from the Citect.INI file. The Sleep(1) in the _ConfigSave
//    function will ensure that _ConfigureForm has closed and written to its variables before this
//    function is called.

PRIVATE
INT
FUNCTION
_UpdatePath()

    // This checks to ensure that the path has a "/" on the end //
    IF StrRight(BackupPath, 1) <> "\" THEN
        BackupPath = BackupPath + "\";
    END
    IF StrRight(RestorePath, 1) <> "\" THEN
        RestorePath = RestorePath + "\";
    END

    CtBackupPath = ParameterGet("CtEdit", "Bin", "") + "\CtBack32.exe";

    IF StrRight(ArchivePath, 4) <> ".CTZ" AND StrRight(ArchivePath, 4) <> ".ZIP" THEN
        IF StrRight(ArchivePath, 1) = "\" THEN
            ArchivePath = ArchivePath + "CtBackup.ctz";
        ELSE
            ArchivePath = ArchivePath + "\CtBackup.ctz";
        END
    END

    // This check is to ensure that the path is legal and prevent your drive from getting zapped //
    _CheckRestorePath();
    _CheckBackupPath();
      RETURN 0;
END

//    FUNCTION:        _CheckRestorePath()
//
//    This function is checks the path which is configured by the user, without this check it is
//    possible that CtBackup.exe would wipe out then entire contents of the harddrive.

INT
FUNCTION
_CheckRestorePath()

    IF RestorePath = "C:\" OR RestorePath = "C:" OR RestorePath = "\" OR RestorePath = ""
       OR RestorePath = "C:\CITECT\BIN\" OR RestorePath = "C:\CITECT\USER\" THEN
        Message("Illegal Restore Path " + RestorePath, "Please Select Configure", 48);
        RETURN 0;
    ELSE
        RETURN 1;
    END
END

//    FUNCTION:        _CheckBackupPath()
//
//    This function is checks the path which is configured by the user, without this check it is
//    possible that CtBackup.exe would wipe out then entire contents of the harddrive.

PRIVATE
INT
FUNCTION
_CheckBackupPath()

    IF BackupPath = "C:\" OR BackupPath = "C:" OR BackupPath = "\" OR BackupPath = ""
       OR BackupPath = "C:\CITECT\BIN\" OR BackupPath = "C:\CITECT\USER\" THEN
        Message("Illegal Backup Path " + BackupPath, "Please Select Configure", 48);
        RETURN 0;
    ELSE
        RETURN 1;
    END
END

//    FUNCTION:        _CtBackupEnvSet()
//
//    This Function is used to set the Citect.ini backup parameters to suitable
//    values for restore or backup operations.

PRIVATE
FUNCTION
_CtBackupEnvSet()

    ParameterPut("Backup", "BackupPath", ArchivePath);
    IF Operation = "0" THEN
        ParameterPut("Backup", "Operation", "0");
        ParameterPut("Backup", "FilePath", BackupPath);
    ELSE
        ParameterPut("Backup", "Operation", "1");
        ParameterPut("Backup", "FilePath", RestorePath);
    END
END


//    FUNCTION:        _CtBackupEnvSave()
//
//    This Function is used to backup the Enviroment parameters for CtBackup.exe
//    to be restored later and to initialise all parameters to be used.


PRIVATE
FUNCTION
_CtBackupEnvSave()
    OperationSave = ParameterGet("Backup", "Operation", "");
    FilePathSave = ParameterGet("Backup", "FilePath", "");
    ArchivePathSave = ParameterGet("Backup", "BackupPath", "");

    BackupPath = ParameterGet("Trend", "BackupPath", "");
    RestorePath = ParameterGet("Trend", "RestorePath", "");
    ArchivePath = ParameterGet("Trend", "ArchivePath", "");
    CtBackupPath = ParameterGet("CtEdit", "Bin", "") + "\CtBack32.exe";
    sCitectINI = ServerInfo("Client", 3);    !Get the name of the INI file beig used.

END


//    FUNCTION:        _CtBackupEnvReset()
//
//    This Function is used to reset the Enviroment parameters for CtBackup.exe.
//    The parameters will be reset to what they were before the TrendArchive()
//    function was called.

PRIVATE
FUNCTION
_CtBackupEnvReset()
    ParameterPut("Backup", "Operation", OperationSave);
    ParameterPut("Backup", "FilePath", FilePathSave);
    ParameterPut("Backup", "BackupPath", ArchivePathSave);
END

Name: Anonymous 2013-05-13 7:39

UVB-76, UVB-76, 93, 882, NAIMINA, 74, 14, 35, 74, 9, 3, 8, 8, 2, Nikolai, Anna, Ivan, Mikhail, Ivan, Nikolai, Anna, 7, 4, 1, 4, 3, 5, 7, 4.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List