DOWNLOAD function
clembo
Member Posts: 122
I have this code:
IF NOT DOWNLOAD(FileName,'','c:\Temp','',ToFileName) THEN
ERROR('Error..');
Why Nav ask me save or open with dialog window?
How I can to skip and save it without ask me before?
IF NOT DOWNLOAD(FileName,'','c:\Temp','',ToFileName) THEN
ERROR('Error..');
Why Nav ask me save or open with dialog window?
How I can to skip and save it without ask me before?
0
Comments
-
-
But my problem is that I DON'T want common dialog...0
-
Then simply skip that part and give fixed path in FileName2..0
-
You should you functions of the CU 419. There is one that can help you to solve the problem - "Magicpath"
Magicpath() : Text[1024] EXIT('<TEMP>'); // MAGIC PATH makes sure we don't get a promptThe description says it all. Than you can handle with your file as you want (move it/copy it etc.)0 -
koubek, can you write sample?
This is my code:
IF NOT DOWNLOAD(FileName,'','h:','',ToFileName) THEN
ERROR('No');
Where:
Filename (string) = RBMgt.EnvironFileName('','txt');
ToFileName (string) = 'H:\Test.txt'0 -
This is a simple demonstration. Focuse on the function "RunDemo()".
OBJECT Page 50009 Download File Demo { OBJECT-PROPERTIES { Date=18/06/12; Time=22:53:37; Modified=Yes; Version List=JVN,FILE,DOWNLOAD; } PROPERTIES { CaptionML=ENU=Download File Demo; SaveValues=Yes; OnOpenPage=BEGIN IF (SrcFileName = '') THEN SrcFileName := 'C:\Temp\MySourceFile.txt'; IF (DestFileName = '') THEN DestFileName := 'C:\Temp\MyDestinationFile.txt'; END; ActionList=ACTIONS { { 1100225000; ;ActionContainer; CaptionML=ENU=Demo; ActionContainerType=NewDocumentItems } { 1100225001;1 ;Action ; Name=<Action1100225001>; CaptionML=ENU=Run Demo; Promoted=Yes; PromotedIsBig=Yes; PromotedCategory=Process; OnAction=BEGIN RunDemo; END; } } } CONTROLS { { 1100225002;;Container; CaptionML=ENU=Download Demo Data; ContainerType=ContentArea } { 1100225005;1;Group ; CaptionML=ENU=File Names; GroupType=Group } { 1100225003;2;Field ; CaptionML=ENU=Source File; SourceExpr=SrcFileName } { 1100225004;2;Field ; CaptionML=ENU=Target File; SourceExpr=DestFileName } } CODE { VAR FileMgt@1100225002 : Codeunit 419; SrcFileName@1100225000 : Text[1024]; DestFileName@1100225001 : Text[1024]; Text001@1100225003 : TextConst 'ENU=You have not define any of parameters!'; Text002@1100225004 : TextConst 'ENU=The file has been downloaded'; Text003@1100225005 : TextConst 'ENU=Destionation file already exists! Delete it first!'; PROCEDURE RunDemo@1100225001(); VAR LocalTempFile@1100225000 : Text[1024]; BEGIN IF (SrcFileName = '') OR (DestFileName = '') THEN ERROR(Text001); IF (EXISTS(DestFileName)) THEN ERROR(Text003); LocalTempFile := FileMgt.DownloadTempFile(SrcFileName); RENAME(LocalTempFile,DestFileName); IF GUIALLOWED THEN MESSAGE(Text002); END; BEGIN END. } }0 -
Hi Koubek
You will have to use a client base RENAME function. The one in your example is server based.
I use the automation object "'Windows Script Host Object Model'.FileSystemObject"
A codeunit with the automation based filesystem function can be downloaded from my blog http://www.dynamics.is/?p=218________________________________
Gunnar Gestsson
Microsoft Certified IT Professional
Dynamics NAV MVP
http://www.dynamics.is
http://Objects4NAV.com0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 328 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
