Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP forum
Unanswered

[Solved]How to get a file path

Posted on by 1,022

Hi,

Is there any way to get file path using file name in dexterity?

In my case I have to find the path of a dll file registerd in my local machine at run time and have to use this path. Please guide.

Thanks,

Sri

 

  • Sridhar Narayanan Profile Picture
    Sridhar Narayanan 1,022 on at
    Re: Re: Re: Re: Re: How to get a file path

    Hi Mariano Gomez,

    Your solution (editing Dex.ini during installation)is very good and it worked.  

    Thanks

    Sri

  • Sridhar Narayanan Profile Picture
    Sridhar Narayanan 1,022 on at
    Re: Re: Re: Re: How to get a file path

    Thank You.

    To make it simple I am using Great Plains application path itself and creating our log file.

  • Mariano Gomez Profile Picture
    Mariano Gomez 26,225 on at
    Re: Re: Re: How to get a file path

    The easiest way to accomplish what you are looking for is to create a key in the Dex.ini that stores the path selected by the user, something like this:

    XMLLogPath= D:\Work

    Then you can use the Defaults_Read() function to get the value stored for that key, for example:

    local string xmllogpath;

    xmllogpath = Defaults_Read("XMLLogPath");

     

    Hope this helps.

  • Sridhar Narayanan Profile Picture
    Sridhar Narayanan 1,022 on at
    Re: Re: How to get a file path

    Thanks for the reply.

    I tried using extern statement but I am getting compile error. I even tried compling sample script given in GP help file but still getting compile error. I think Iam missing something in using extern statement.

    Let me explain in detail what I am looking for.

    We use COM dll (which intern call our service) as a part of our connector. Our connector is tightly integrated with GP tax engine. Initially we register the dll in C:\Program Files\Our Product Name\Bin folder and generate xml log file in the same path.

    But now, during our product installation we haven given an option to user to select the path. Now I donot know how can I get the dll path during runtime.

    For Eg:- if the user select D:\Work during our product installation the dll gets registerd in that path. I have to find this path to generate xml logfile.

    Kindly guide me.

    Thanks,
    Sri

  • Mariano Gomez Profile Picture
    Mariano Gomez 26,225 on at
    Re: How to get a file path

    You can use Dexterity's extern function to call the GetModuleFileName function available in the Kernel32.dll.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,513 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,862 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans