Announcement

Collapse
No announcement yet.

ScriptC Help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ScriptC Help

    Dear Support,

    I also would like to transfer files from PC to the SDCARD in the display. (uLCD-43DT)
    My first attempt was the SCRIPTC.EXE with the following script:

    Code:
    #Run(Picaso,Com3,256000,5,Wrap)
    
    $WriteFile(50,Replace,Double,"DIALOG.4FN","SDCARD\DIALOG.4FN");
    but it failed:

    Code:
    No Errors, code size = 32 bytes
    Starting Script autoexec.4dscript
    Writefile DIALOG.4FN(2186B), Hand=50 Command Write failure
    ABORTING Script autoexec.4dscript
    2nd attempt with script:

    Code:
    #Run(Picaso,Com3,256000,5,Wrap)
    
    $4DGLAttn
    $WriteFile(50,Replace,Double,"DIALOG.4FN","SDCARD\DIALOG.4FN");
    $4DGLExit
    It failed also:

    Code:
    No Errors, code size = 36 bytes
    Starting Script autoexec.4dscript
    Opening Com3 Speed=115200 baud4dgl Attn - Diablo - SD-HC Capacity 3รก796,03MB
    Writefile DIALOG.4FN(2186B), Hand=50 Timeout on first ACK
    CommPort Closed
    ABORTING Script autoexec.4dscript
    WriteFile is not capable to do this?

    After some search in the forum I found this thread, and my third attempt is with FileTransfer:

    Code:
    FileTransfer.exe $sdcardlist.txt /b115200 /cCOM3 /s /q /w
    I also got a confirmation dialog, and after I hit the OK button the app crashed in TForm1.sendfile line FTUnit1:3076. (Range check error)

  • #2
    I have moved your question to its own topic in the appropriate area.
    James

    Comment


    • #3
      Hi mris99,

      Good Day.

      In using ScriptC, you can refer to the documentation example from this location to transfer file from PC to uSD on the display

      C:\Users\Public\Documents\4D Labs\SCRIPTS\4DGL.

      In using FileTransfer you can try the code below:

      Code:
      FileTransfer.exe $sdcardlist.txt /b115200 /cCOM3 /s
      or

      Code:
      FileTransfer.exe $sdcardlist.txt /b115200 /cCOM3 /s /e

      This is still under development, you can refer to this post for the update.

      Hope this helps.

      BR,
      Last edited by frsantiago; 18 June 2019, 05:54 PM.

      Comment


      • #4
        I checked C:\Users\Public\Documents\4D Labs\SCRIPTS\4DG, but it contains only example with $WriteSectors but not with $WriteFile.
        I use the SDCARD in FAT mode, so I guess the $WriteSectors cant help me, and unfortunately the $WriteFile does not work.

        $LoadPmmC and $4DGLLoadProgram are working fine, and would be great to update all requred things (PmmC, Flash and SDCARD content) with a single command. I don't care if it takes a while as the SDCARD is now require lot of disassembly of the device at the field, and loading everything with
        a single command would be just a perfect solution for the update.

        Regarding the FileTransfer.exe.
        Your example is not working:
        - I get prompt dialog before each file transfer,
        - and I get Invalid return code from SetDate/Time error after each file.
        - Finally nothing is written to the sdcard

        I understand it is under development.

        Thank,
        Mris
        Last edited by mris99; 19 June 2019, 06:13 AM.

        Comment


        • ESPsupport
          ESPsupport commented
          Editing a comment
          Can you tell me the options you are using for FileTransfer.exe, processor used (picaso, Diablo, etc.) and also the sort of connection used (Type of cable / hardware between the display and the PC). The reason I ask is because it seems that there may be baud rate mismatches occurring. Have you tried transferring a file in GUI mode to see if there are any obvious issues/errors? What if you limit the baud rate to 115200?

      • #5
        I'm note sure where you found $WriteFile 'documented', but, well, it is historical, very historical, and that's why it's not documented.

        It relates to SGC which was discontinued around 10 years ago now.
        Mark

        Comment


        • #6
          It is documented in here:
          https://old.4dsystems.com.au/downloa...S-SIS-rev6.pdf

          Yes, it is old, and historical, but the other historical commands like $LoadPmmC and $4DGLLoadProgram still working.
          And I do not know any other tool than the sciptc to load program into the FLASH from command line.
          Do you have any? So I need to use this piece of the history.

          I do use command line tools (4dcompiler.exe and C_4FN_XE.exe) for compilation all of my screens (14 visi projects) with one batch file,
          and I have another batch file to copy the result to the SDcard, but I need to swap SDcard every time.

          I have about 70k common code for all screens, and when I change something in the common part, I need to recompile all projects.
          Open all project one after another with the workshop and compile it just boring and time consuming like swaping the SDcard.
          Therefore the command line tools are valuable and should be maintained further.
          You just cannot do everything from the workshop.

          Comment


          • #7
            The GUI program loader also works from the command line (LoadProgram.exe), but if ScriptC still works for your purposes there is no reason not to continue using that.


            Mark

            Comment


            • #8
              FileTransfer test:

              I downloaded the 1.03 version and I also setup the higher badrates with AN205SW.
              I use official cable with label "4D Programming Cable", FileTransfer shows it is MB5 but it supports the max baud rate.
              Display is uLCD-43DT-A [v2.0 16/05/16]

              Once I managed to connect to the display with max baud rate and the mount was also successful.
              I managed to remove existing files from the sdcard, and I manages to upload files to sdcard form PC via FileTransfer.exe GUI.

              After that I did some try with command line parameters to remove sdcard files and upload new files:

              FileTransfer.exe $filelist_sdcard.txt /cCOM3 /d
              FileTransfer.exe $filelist_pc.txt /cCOM3 /s /e

              After that it did not work. Neither from command line nor from GUI. Not even with the baudrate 115200.
              I always got the message "Invalid return code from Set Date/Time"

              Unplug and reconnect the USB did not help.

              The SDCARD was empty, I thought it is a problem so I put a file on it with the PC.
              After that the FT shows a file, but the name was not visible and the file size and date are invalid.

              Click image for larger version

Name:	ft.png
Views:	264
Size:	73.2 KB
ID:	68743

              I put all my files back to the SDCARD via card reader. After that the the file list was shown.
              I could remove / and upload files again.

              I tried to remove all files with FT again.
              I selected all files, and removed them with Erase files button.
              The file list was almost empty, but there was a line with only the size column filled with 0

              I put the card back to the card reader, and a file left on the card. (last one in alphabetical order)
              I put the card back to the display, and the result is similar than with the picture above.

              Finally I put all my files back to the SDCARD via card reader and check the file list again.
              The first line is with only size = 0 is always there, and my last file with alphabetical order is missing from the list.

              Please fix this error.

              Best regards,
              Mris


              Comment


              • #9
                With that invalid file on the card you will most likely have to reformat the card under Windows.

                As for the "Invalid return code from Set Date/Time" issue, it's not clear to me from the way you are describing it as to where it is occurring.

                Also, since I have no idea what is in the two text files, so I cannot test your scenario. Can you attach them here?
                Mark

                Comment


                • #10
                  The invalid file looks valid from the PC, but anyway I reformatted the SDCARD and after that I was able to transfer files again from the GUI.
                  But once I removed all files with command:

                  FileTransfer.exe $filelist_sdcard.txt /cCOM3 /d /e

                  Where the filelist_sdcard.txt contains the list of all my files on the SDCARD to delete, e.g:

                  DIALOG.4FN
                  DIALOG.dat
                  DIALOG.gci
                  ...

                  The upload from command line does not work:

                  FileTransfer.exe $filelist_pc.txt /cCOM3 /s /e

                  Where the filelist_pc.txt contains the list of my files on the PC, e.g:

                  SDCARD\DIALOG.4FN
                  SDCARD\DIALOG.dat
                  SDCARD\DIALOG.gci
                  ...

                  I got the "Invalid return code from Set Date/Time" issue and the FT hangs:


                  Click image for larger version

Name:	ft2.png
Views:	199
Size:	83.5 KB
ID:	68748

                  Comment


                  • #11
                    I've tried the same scenario (using 3 files with a programming cable) and it works just fine for me.

                    How many files are hidden by the '...', and what is the total size of all the files?

                    In this screen you have shown the baud rate to be 'max', what if you limit it to 115200?

                    Is the programming cable connected directly to the display, or is there some sort of 'extender' involved?
                    Mark

                    Comment


                    • #12
                      Total file count is 43 and total about 12MB
                      I tried the same with 115200, and I got the same result.
                      The cable directly connected to the display and the other end directly connected to the front USB of my desktop PC.
                      The display shows:

                      Code:
                      File Transfer Waiting
                      Set baud rate 115200
                      Mount uSD: FAT
                      Dir *.*
                      Set File Date/Time

                      Comment

                      Working...
                      X