Code to "wake up" a mapped HDD on a server

Votuc
Member Posts: 206
I am trying to display a PDF file on a client computer through the RTC from a mapped drive on the server computer.
I am using HYPERLINK() which works sometimes and other times does not. I believe this is because the mapped folder is not ready to be accessed fast enough.
What could I do to force the mapped hard drive to be ready (perhaps save over a file each time?) then perhaps a <timer> function to wait 5 seconds or so to make sure it is ready before the HYPERLINK function? :-k
I am using HYPERLINK() which works sometimes and other times does not. I believe this is because the mapped folder is not ready to be accessed fast enough.
What could I do to force the mapped hard drive to be ready (perhaps save over a file each time?) then perhaps a <timer> function to wait 5 seconds or so to make sure it is ready before the HYPERLINK function? :-k
0
Comments
-
Votuc wrote:I am using HYPERLINK() which works sometimes and other times does not. I believe this is because the mapped folder is not ready to be accessed fast enough.
I don't believe it has to do with it accessing it fast enough.
Do you receive an error message?
If it doesn't open - go to My Computer & see if it says "Network Drive" or "Discontected Network Drive".
If it's disconnected you need to double click on it to reconnect.
I believe on your server, does it have file server role?, that you can set a setting on shared drives that does or does not disconnect login users depending on what you want. Or you can set a time limit.0 -
Can't you use UNC paths? Which eliminate the whole mapped drive problem.There are no bugs - only undocumented features.0
-
bbrown wrote:Can't you use UNC paths? Which eliminate the whole mapped drive problem.
I am not sure how to do that. I see an example of FILE.OPEN in the Help files:
Variable: TestFile
Data type: File
TestFile.TEXTMODE(TRUE);
TestFile.WRITEMODE(FALSE);
TestFile.OPEN('C:\temp\simple.xml');
How do I alter this to display a PDF? I tried simply changing the file path to my PDF file and I got an I/O error.0 -
UNC (Universal Naming Convention) paths are presented in the format \\sharename\folder. An example might be \\fileshare\datafolder.
In your example you would define a text variable, assign the UNC path to it, and pass it to the create call.
Variable: TestFile
Data type: File
Variable: FilePath
Data Type: Text (100)
FilePath := '\\fileshare\datafolder\simple.xml'
TestFile.TEXTMODE(TRUE);
TestFile.WRITEMODE(FALSE);
TestFile.OPEN(FilePath);
of course you need to specify a valid UNC path for your network. You can use Network Neighborhood to browse and then copy and paste the pathThere are no bugs - only undocumented features.0 -
Votuc wrote:bbrown wrote:How do I alter this to display a PDF? I tried simply changing the file path to my PDF file and I got an I/O error.
HYPERLINK('\\fileshare\datafolder\simple.pdf');
No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 320 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