How to Get Client Folder
tramirez
Member Posts: 4
Hye,
Do you know how can I get the Folder where I'm executing the client (fin.exe or finsql.exe)?
If in one computer I have Two installations of Navision with the same version in two diferents folders:
c:\Program Files\Micorosft Business Solutions-Navision\Client 1\
c:\Program Files\Micorosft Business Solutions-Navision\Client 2\
How can I know wich Client has ran mi application?
I need to do this because I have one file saved in BLOB format in a Navision Table, and I need to export it (in runtime) in the Client folder.
So I need to know witch is the client folder, cause is possible that the instalation is not in the default path.
Any suggestions? :roll:
Thanks a lot!!
Do you know how can I get the Folder where I'm executing the client (fin.exe or finsql.exe)?
If in one computer I have Two installations of Navision with the same version in two diferents folders:
c:\Program Files\Micorosft Business Solutions-Navision\Client 1\
c:\Program Files\Micorosft Business Solutions-Navision\Client 2\
How can I know wich Client has ran mi application?
I need to do this because I have one file saved in BLOB format in a Navision Table, and I need to export it (in runtime) in the Client folder.
So I need to know witch is the client folder, cause is possible that the instalation is not in the default path.
Any suggestions? :roll:
Thanks a lot!!
0
Comments
-
I'm afraid this is not possible. In C/SIDE, you dont' have enough process information to do this. I checked the virtual tables an the system methods, but nothing seems useable.
If you had a process ID, it would be possible to find the working folder or path to exe using a custom made Automation control.0 -
Try deleting the folder while Navision is running. If it's in use, it'll give you an error.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
yeah and if it is not in use, you'll only lose your NAV installation folder
0 -
lol. Well he had a good idea, which I'll try to improve.
How about try to copy the executable from that location to a temp location and delete the executable and copy it back if you succeed.
One question I have though is why does he want to move it to Navision directory?0 -
You would search through the virtual file table and search for fin.exe. Or you could put a computer + User setup table.0
-
well Once you find it the first time, you don't need to search again. You would put in the setup table.0
-
My Solution is
Write an programm with vb, c# or wsh (wsh / WMI should be do this) to analyse the processes. Serach in the processes for fin.exe or finsql.exe. When you found the programm, you can get the process properties (like installation folder) and send it back to navision (for example as stream)
see next post.
RegardsDo you make it right, it works too!0 -
OK, so i've enougth time yet (came from an party) and i wrote now this little application:
Code for WMI Script that you must call from NavisionSet wmi = GetObject("winmgmts://./root/cimv2") wql = "select * from win32_process where name='finsql.exe'" Set result = wmi.ExecQuery(wql) For each prozess in result WSHShell.echo "Prozessname " & Prozess.Name WSHShell.echo "ExPath = " & Prozess.ExecutablePath Next
Here the navision codeIF EXISTS('D:\NavZUPs\GetExecuteFolder.vbs') THEN BEGIN IF ISCLEAR(WSHShell) THEN CREATE(WSHShell); //WSHShell.Currentdirectory should also work (not tested) WSHExec := WSHShell.Exec('cscript D:\NavZUPs\GetExecuteFolder.vbs'); WHILE NOT WSHExec.StdOut.AtEndOfStream DO BEGIN ExecFolder := WSHExec.StdOut.ReadALL; ExecFolder := copystr(ExecFolder,Strpos(ExecFolder,'ExPath = '),strlen(ExecFolder)); END; end;
The DOS - Prompt you can prevent when you call the vbs with parameter (no window)
Regards
So, good night. My bed calls.
Oh, my head, some of this beers was bad :-(Do you make it right, it works too!0 -
There is an other way to solved this problem:
Make to Shortcuts on your desktop.
First to Client one
Second to Client two
In first shortcut you insert parameter id=%userprofile%\Client1.zup
and in the second id=%userprofile%\Client2.zup
with commandline you can get the parameters.
If you found client1.zup your application runs from folder
"c:\Program Files\Micorosft Business Solutions-Navision\Client 1\"
if you found client2.zup your application runs from folder
"c:\Program Files\Micorosft Business Solutions-Navision\Client 2\"
RegardsDo you make it right, it works too!0 -
It was the last :!: But the others are delicious

How i going to get which zup file i'm using :?:
I use (F5) System \ Commandline <- gives the start parameter like database, server, company and id (id is the place where i store the zup)
RegardsDo you make it right, it works too!0 -
WsShell: Automation 'Windows Script Host Object Model'.WshShell CREATE(WsShell); MESSAGE('%1',WsShell.CurrentDirectory);
As you can see, if you do not change the current directory, you can get the App folder through this. Because if you create shortcut for the .exe file, the default dir is the app dir.0
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



