Upload on Service Layer without User Input

Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
edited 2011-09-08 in NAV Three Tier
Hi guys! I'm upgrading a codeunit from 4.0 to NAV 2009 R2 (This codeunit work with files).
Since we're running RTC we can see and work only with files located on the Service Layer.
So we could use the upload function. :-k Thus far I think ok!
But I crashed against 2 problems:

1. Files I have to upload are located in a directory on the client machine (I always know which is because it's specified in the Inventory Setup), but I don't know how many they are. I thought to do something like this:
ok := false;
repeat 
  upload(...);  
  ok := dialog.confirm('Finished?',false);
until not(ok);
but I find it not very nice for the end user, in particular if number of files is high.
2. My second problem is this codeunit must be run through Job Scheduler and with the upload function, in which user specify files with Dialog, JS, I think, will die...
(Edit: I could jump the code checking if I'm on 3 tier #-o )
My question is there a way to upload all files located in a (known) directory placed on the client machine without user input?
~Rik~
It works as expected... More or Less...

Comments

  • Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    We are not far I think... , we haven't been able to find a solution yet... a colleague of mine suggested this code:
    FileSystem              Automation                 'Windows Script Host Object Model'.FileSystemObject
    Folder                    Automation                 'Windows Script Host Object Model'.Folder
    GroupFiles               Automation                 'Windows Script Host Object Model'.Files
    
    IF ISCLEAR(FileSystem) THEN
      CREATE(FileSystem,TRUE,TRUE);
    
    Folder := FileSystem.GetFolder('C:\Users\user\Desktop\folder');
    GroupFiles := Folder.Files;
    MESSAGE(FORMAT(GroupFiles.Count));
    

    With this code we obtain only the number of files in the folder... it would be great if I got the name of files...
    Any ideas?
    ~Rik~
    It works as expected... More or Less...
  • Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    Tried also with this but in RTC it doesn't work... ](*,)
    viewtopic.php?f=5&t=7855&view=unread#unread
    ~Rik~
    It works as expected... More or Less...
Sign In or Register to comment.