Forums

Find answers, ask questions, and connect with our
community all around the world.

Home Forum Omnis General Forum Home User path

  • Klaus Schrödl

    Administrator
    April 24, 2019 at 3:24 pm

    Hi Paolo,
    there is a funtion in Omnis Studio called
    getenv(NameofEnvoronmentVar)
    To retrieve the current user’s home directory under windows it would be
    Do getenv(“userprofile”) Returns lcUserProfile
    where “userprofile” is the name of the corresponding environemt variable.
    The function also works on Mac OS but I don’t know the variable name there.
    G… should know.
    Cheers
    Klaus

  • Mark Phillips

    Member
    April 24, 2019 at 4:31 pm

    we use this in Omnis Studio v6.0. “homedirectorypath” is a character variable.
    For Mac,
    ; user home path
    Do $runapplescript(‘path to home folder from user domain as string’,homedirectorypath) Returns errcode`
    Calculate homedirectorypath as replaceall(homedirectorypath,kDq,”)
    For Windows:
    If isunicode()
    Register DLL (“shfolder”,”SHGetFolderPathW”,”CJJJJCN”) Returns lnError
    Call DLL (“shfolder”,”SHGetFolderPathW”,0,pnFolderType,0,0,lcString,lnError) Returns lcPath
    Else
    Register DLL (“shfolder”,”SHGetFolderPathA”,”CJJJJCN”) Returns lnError
    Call DLL (“shfolder”,”SHGetFolderPathA”,0,pnFolderType,0,0,lcString,lnError) Returns lcPath
    End If
    Calculate homedirectorypath as lcPath

  • alishakihnh alishakihnh

    Member
    August 1, 2023 at 1:31 am

    The method for retrieving the path of your home directory may vary depending on the operating system you are using. Here are some examples:

    On macOS and Linux, you can use the echo command with the tilde (~) symbol to retrieve the path of your home directory. Open the terminal and type: Flappy Bird

    </p><p>echo ~ </p><p>

    This should output the path of your home directory, such as /Users/illing on macOS or /home/illing on Linux.

    On Windows, you can use the %HOMEPATH% environment variable to retrieve the path of your home directory. Open the Command Prompt and type:

    </p><p>echo %HOMEPATH%</p><p>

    This should output the path of your home directory, such as \Users\illing on Windows 10.

    Alternatively, you can also use the %USERPROFILE% environment variable to retrieve the path of your user profile directory, which is typically the same as your home directory. For example, on Windows 10, you can type:

    </p><p>echo %USERPROFILE%</p><p>

    This should output the path of your user profile directory, such as C:\Users\illing.

Log in to reply.