Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2008
    Location
    UK
    Posts
    1

    Loading Software when drive letter is not always static

    im building an AIO suite for work which contains the most frequent apps we install and lots of stand alone diagnostic tools and various others.

    One page is called organizer which has a calender, a link to our phone extension database, a stand alone calculator for working out clock cards and finally and this is my problem - a password manager application that stores all of our passwords and door codes we use ..ect under one password, A wallet if you like. Here is an example below:

    http://www.softpedia.com/get/Securit...y-Wallet.shtml

    But, ive tried 3 different types of software which sits in the AutoPlay\\Docs directory, but each one seems to need a home directory if that is the right term in order to store its database. So for example "C:\Documents and Settings\username\My Documents" directory. I cant put it in AutoPlay\\Docs because to the application it is not valid. This is important as my AIO suite will be running off all our engineers portable usb hard drives. Which when hooked up to a pc that we are repairing, doesn't necessarily use the same drive letter because of network drive mappings. The network drives are specific to the department. So basically i need to figure out a way of storing the password database in the AutoPlay\\Docs directory, without the assigned drive letter being a problem.

    If anyone is following me is there a feature in APMS that has a solution for this, or know of an alternative piece of software.

    thank you

  2. #2
    Join Date
    Dec 2007
    Location
    Missouri, United States
    Posts
    476
    if the autoplay application you made is in the same directory you could use _SourceFolder which grabs the full path to the directory where the application was ran from, as outlined in the AMS helpfile

    so if my app was in C:\Program Files\MyApp

    and I put this piece of code in my on startup event for my app.

    AppDir = _SourceFolder

    it would set the variable AppDir to the full path of the directory where the app was ran from. which is C:\Program Files\MyApp
    Last edited by TimeSurfer; 01-24-2008 at 07:11 PM.

  3. #3
    Join Date
    May 2006
    Posts
    5,380
    look at "_SourceDrive" as well

    EDIT:

    if you are publishing as web exe neither "_SourceFolder" or "_SourceDrive" will return the path to the usb drive and in fact will return the path or drive of the users system temp folder

    if you are useing a web exe you will need to grab the "REAL" path at runtime, the below function will do that for you
    Code:
    function GetRealPath()
    	if _CommandLineArgs[1]
    		RealPath = String.Replace(_CommandLineArgs[Table.Count(_CommandLineArgs)], "SFXSOURCE:", "", true);
    		return RealPath
    	end
    end
    Last edited by RizlaUK; 01-25-2008 at 05:02 AM.
    Open your eyes to Narcissism, Don't let her destroy your life!!

  4. #4
    Join Date
    Dec 2007
    Posts
    16
    Quick couple of questions regarding Rizlauk's answer (showing my ignorance here!), specifically

    if you are publishing as web exe neither "_SourceFolder" or "_SourceDrive" will return the path to the usb drive and in fact will return the path or drive of the users system temp folder

    if you are useing a web exe you will need to grab the "REAL" path at runtime, the below function will do that for you
    Code:

    function GetRealPath()
    if _CommandLineArgs[1]
    RealPath = String.Replace(_CommandLineArgs[Table.Count(_CommandLineArgs)], "SFXSOURCE:", "", true);
    return RealPath
    end
    end

    A. If you use this doesn't it negate the others? For clarity: By using the above method in all apps means they will always find the "REAL" path, no matter where they are run from i.e. My system, users system, USB, CD, DVD etc..

    B. Where exactly in a code would I place it, Global, preload...? (I'm guessing Global!)

    Appreciate the info guys, no rush, not expecting to make use of this kind of knowledge yet but purely for reference.

    Sorry for the hijack willdav!

  5. #5
    Join Date
    Aug 2003
    Posts
    2,427
    Assuming your exe is in the root of a drive then something like this would work for you -

    Code:
    result = Drive.Enumerate();
    for index in result do
    	found_it = File.DoesExist(result[index].."\\Sourcedrive.exe");
    	if found_it then 
    	actual_drive = result[index]
    	else
    	actual_drive = "File not found in root of any drive."
    	end
    end
    - Sorry I'm answering a question I thought I saw rather than reading carefully and answering the real question
    Last edited by longedge; 01-27-2008 at 04:11 AM. Reason: SHould've read the post first !!

  6. #6
    Join Date
    May 2006
    Posts
    5,380
    A. If you use this doesn't it negate the others? For clarity: By using the above method in all apps means they will always find the "REAL" path, no matter where they are run from i.e. My system, users system, USB, CD, DVD etc..
    The way it works is:

    Web EXE: the project files are packed in to a executable sfx when you build the project so no matter where the sfx is run from it will always unpack and run from the users temp folder, so _SourceFolder will always return the path to the users temp folder in this case

    Publish To Folder: this just makes a copy of the project folder structure so in this case _SourceFolder will return the correct path, and the "GetRealPath()" function is not needed.


    Here is a edit of the above function which will work in both cases (handy for testing a project that will be in web exe format)

    Either way it will return the correct path to the root of the project
    Code:
    function GetRealPath()
    	if _CommandLineArgs[1] then
    		RealPath = String.Replace(_CommandLineArgs[Table.Count(_CommandLineArgs)], "SFXSOURCE:", "", true);
    		RealPathParts=String.SplitPath(RealPath)
    		return RealPathParts.Drive..RealPathParts.Folder
    	else
    		return _SourceFolder
    	end
    end
    
    
    Example
    result = Dialog.Message("Notice", "The Real Path is:\r\n\r\n"..GetRealPath(), MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    Open your eyes to Narcissism, Don't let her destroy your life!!

Similar Threads

  1. ANSI To UNICODE Is Finished!
    By coderanger in forum AutoPlay Media Studio 6.0
    Replies: 7
    Last Post: 08-13-2007, 09:27 AM
  2. Visual Patch 3.0 Simplifies Software Patch Packaging
    By Ted Sullivan in forum Announcements & News
    Replies: 0
    Last Post: 08-07-2007, 01:38 PM
  3. Passing CD drive letter to command line argument
    By Metatron in forum AutoPlay Media Studio 5.0
    Replies: 15
    Last Post: 01-24-2005, 02:38 PM
  4. Determining the Drive Letter of the Primary Hard Drive
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 10-03-2003, 09:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts