Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 13 of 13

Thread: Registry

  1. #1
    Join Date
    Jun 2006
    Location
    Middle of Nowhere Missouri
    Posts
    19

    Registry

    I am having issues trying to copy files to a cd burner

    when I try this on my laptop with one user it works great, but i try to run it
    on an xp machine with multiple user accounts it gets lost.

    Code:
    test = (Shell.GetFolder(SHF_APPLICATIONDATA).."Microsoft\\CD Burning");
    sFolder = (Shell.GetFolder(SHF_MYDOCUMENTS).."\\New Folder");
    
    --CurrentUser = Registry.GetValue(USERPROFILE,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "CD Burning", true);
    
    StatusDlg.Show(MB_ICONNONE, false);
    
    File.Copy(sFolder, test, true, true, false, true, nil);
    
    error = Application.GetLastError();
    StatusDlg.Hide();
    
    if error ~= 0 then
        result = Dialog.Message("Error", "There was an error copying the files to your system. Please try again."
        , MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    else    
    	File.Open(Shell.GetFolder(SHF_APPLICATIONDATA_COMMON).."\\Microsoft\CD Burning", "", "", SW_SHOWNORMAL, false);	
    end
    Attached Files

  2. #2
    Join Date
    May 2006
    Posts
    5,380
    try it with "SHF_APPLICATIONDATA" rather than "SHF_APPLICATIONDATA_COMMON"

    SHF_APPLICATIONDATA

    The path to the Application Data folder on the user's system. On Windows NT/2000/XP, this is the path from the per-user profile. Typically, this is something like "C:\Documents and Settings\YourName\Application Data." On Windows Vista, this is something like "C:\Users\YourName\AppData\Roaming."
    SHF_APPLICATIONDATA_COMMON

    The path to the Application Data folder on the user's system. On Windows NT/2000/XP/Vista, this is the path from the All Users profile. On a non-Windows NT system, this will be the path to the user's Application Data folder (same as SHF_APPLICATIONDATA)
    Open your eyes to Narcissism, Don't let her destroy your life!!

  3. #3
    Join Date
    Jun 2006
    Location
    Middle of Nowhere Missouri
    Posts
    19

    Still running in to an issue

    RizlaUK,
    Thank you for the quick response! I had already tried to use the SHF_APPLICATION and didn't have any luck. the problem might be in the
    way I am referencing the location.

    here is the file location, but I don't want to hard code the user considering there
    are other people that could use it.


    C:\Documents and Settings\user\Local Settings\Application Data\Microsoft\CD Burning


    Thanks again
    Mark

  4. #4
    Join Date
    Mar 2004
    Location
    Toronto, ON CANADA
    Posts
    696
    Maybe add this?

    Code:
    test = (Shell.GetFolder(SHF_APPLICATIONDATA).."\\Microsoft\\CD Burning");

  5. #5
    Join Date
    May 2006
    Posts
    5,380
    OMG.....

    how did i miss that, guess iv been staring at code for to long and need a break

    i spot another fault see tek's on first line and also look at last line

    Code:
    test = (Shell.GetFolder(SHF_APPLICATIONDATA).."\\Microsoft\\CD Burning");
    sFolder = (Shell.GetFolder(SHF_MYDOCUMENTS).."\\New Folder");
    
    --CurrentUser = Registry.GetValue(USERPROFILE,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "CD Burning", true);
    
    StatusDlg.Show(MB_ICONNONE, false);
    
    File.Copy(sFolder, test, true, true, false, true, nil);
    
    error = Application.GetLastError();
    StatusDlg.Hide();
    
    if error ~= 0 then
        result = Dialog.Message("Error", "There was an error copying the files to your system. Please try again."
        , MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    else    
    	File.Open(Shell.GetFolder(SHF_APPLICATIONDATA_COMMON).."\\Microsoft\\CD Burning", "", "", SW_SHOWNORMAL, false);	
    end
    Open your eyes to Narcissism, Don't let her destroy your life!!

  6. #6
    Join Date
    Jun 2006
    Location
    Middle of Nowhere Missouri
    Posts
    19
    I fixed the (SHF_APPLICATIONDATA).."\\Microsoft

    still nothing.

    Correct me if I am wrong please I am a newbie, but the

    SHF_APPLICATIONDATA only access the folders that are located in the app data folder

    Application Data\Microsoft\CD Burning

    I think that the code is stopping when it hits this part

    C:\Documents and Settings\user\Local Settings\

    and never makes it to the app data\cd burn folder.

    Is there a way to pull the user out of the registry and use that value to fill in the user so that the application gets the info on its own?

    Thanks All!

  7. #7
    Join Date
    May 2006
    Posts
    5,380
    right, its because "SHF_APPLICATIONDATA" is returning the wrong path

    C:\Documents and Settings\User\Application Data

    the path to the "CD Burning" folder is

    C:\Documents and Settings\User\Local Settings\Application Data\Microsoft\CD Burning

    so try this:

    Code:
    test = (Shell.GetFolder(SHF_APPLICATIONDATA)); 
    result = String.Replace(test, "Application Data", "Local Settings\\Application Data\\Microsoft\\CD Burning", false);
    output enhanced with AMS Code Pretty
    Open your eyes to Narcissism, Don't let her destroy your life!!

  8. #8
    Join Date
    Jun 2006
    Location
    Middle of Nowhere Missouri
    Posts
    19

    Will this apply in AMS?

    I tried that also and no luck, I do appreciate all of the help with this!

    If anyone has time to take a look at this thread and let me know it this will
    apply to AMS also.
    ________________________________________________

    INFO: Finding Shell Folders in the Registry
    Document ID: IR02021The information in this article applies to:

    * Setup Factory 6.0

    http://www.indigorose.com/forums/showthread.php?t=5012
    __________________________________________________

    I am going to play with it for a while to see what I get.

  9. #9
    Join Date
    May 2006
    Posts
    5,380
    ok, now im fully awake i might see things a bit clearer


    File.Copy(sFolder, test, true, true, false, true, nil);

    should be

    File.Copy(sFolder.."\\*.*", test, true, true, false, true, nil);

    i just ran a test and the below code copy's the files to the cd burning folder of the current user, i even get the balloon tip asking if i want to burn the files now

    Code:
    test = (Shell.GetFolder(SHF_APPLICATIONDATA)); 
    test = String.Replace(test, "Application Data", "Local Settings\\Application Data\\Microsoft\\CD Burning", false); 
    
    sFolder = (Shell.GetFolder(SHF_MYDOCUMENTS).. "\\New Folder"); 
    StatusDlg.Show(MB_ICONNONE, false); 
    
    File.Copy(sFolder.. "\\*.*", test, true, true, false, true, nil); 
    error = Application.GetLastError(); 
    StatusDlg.Hide(); 
    
    if error ~= 0 then 
        result = Dialog.Message( "Error", "There was an error copying the files to your system. Please try again.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1); 
    else    
    	File.Run( "Explorer", test, "", SW_SHOWNORMAL, false);	 
    end
    output enhanced with AMS Code Pretty
    Open your eyes to Narcissism, Don't let her destroy your life!!

  10. #10
    Join Date
    Jun 2006
    Location
    Middle of Nowhere Missouri
    Posts
    19

    I am still having issues

    RizlaUK,

    If and when you have time I think this thread explains my problem the best, I am not sure if there was ever a solution found or not. I submitted a post to see.

    http://www.indigorose.com/forums/sho...t=current+user

    I attached a .jpg showing the exact file loaction if it helps?

    I am at work so I will probebly have to try more this afternoon.

    Thanks!
    Mark
    Attached Images

  11. #11
    Join Date
    Oct 2006
    Posts
    345
    i could be wrong here (and probably am).... but doesnt the SHF_APPLICATIONDATA returned path only have single "\" in it, so where you have altered it to "\\" in your hard coding, i "think" that you have to also alter the returned path.

    easiest way i found to do this was to get the whole path sorted first with single \ then convert it to \\ using
    Code:
    AMS_compatible_format = String.Replace(YOUR PATH VARIABLE HERE, "\\", "\\\\", false);

  12. #12
    Join Date
    Apr 2007
    Location
    Mar Sara
    Posts
    292
    Do not replace \ with \\ in variables unless you are creating them, as that WILL be rendered as \\. If you are creating a string then use \\, eg:

    This is correct:
    Code:
    CallFunction("C:\\My Folder");
    This is wrong:
    Code:
    CallFunction(String.Replace(strMyPath, "\\", "\\\\", false));

  13. #13
    Join Date
    Oct 2006
    Posts
    345
    ok, i stand corrected (not an uncommon event!) i just remember having trouble with using paths as strings once and that solved the issue i was having.

Similar Threads

  1. Using registry for bookmarking
    By AXXESS in forum AutoPlay Media Studio 5.0
    Replies: 12
    Last Post: 11-01-2004, 09:22 AM
  2. HOWTO: Merge Registry Keys
    By Desmond in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 10-17-2003, 09:31 AM
  3. Registry Features
    By Dwayne in forum Setup Factory 6.0
    Replies: 1
    Last Post: 02-21-2003, 03:30 AM
  4. INFO: Finding Shell Folders in the Registry
    By Support in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 10-10-2002, 03:52 PM
  5. HOWTO: Merge REG Files with the Registry
    By Support in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 09-23-2002, 02:48 PM

Posting Permissions

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