Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 13 of 13
  1. #1
    Join Date
    Jan 2008
    Location
    Ukraine, Uzhhorod
    Posts
    5

    Grin Copy.File Destination from registry. Is it possible?

    Hi! I'm trying to combine actions Registry.GetValue & File.Copy to automatise installation process. Is it possible?


    This button On Click script doesn't work. But I can't understand how to solve this problem


    resultINSTL = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Great Oaks\\DNA Compiler", "Install Location", true);
    File.Copy("AutoPlay\\Docs\\dnac.exe", "resultINSTL", true, true, false, true, nil);

    Please help me.

  2. #2
    Join Date
    May 2006
    Posts
    5,380
    when using a variable in a function like that, do not wrap it in double quotes


    Remove the red parts
    Code:
    resultINSTL = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Great Oaks\\DNA Compiler", "Install Location", true);
    File.Copy("AutoPlay\\Docs\\dnac.exe", "resultINSTL", true, true, false, true, nil);
    Open your eyes to Narcissism, Don't let her destroy your life!!

  3. #3
    Join Date
    Jan 2008
    Location
    Ukraine, Uzhhorod
    Posts
    5
    Thank you for your reply. I'll try it.

  4. #4
    Join Date
    Jan 2008
    Location
    Ukraine, Uzhhorod
    Posts
    5

    Huh? It doesn't help

    "" near variable was deleted, but it doesn't help.
    Here is code:

    instl = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Great Oaks\\DNA Compiler", "Install Location", true);
    -- Display the value read from the Registry in a dialog.
    instl = Dialog.Message("Registry Data", "The value read from the Registry is "..instl..".");

    -- This function works great..

    File.Copy("AutoPlay\\Docs\\dnac.exe", instl, true, true, false, true, nil);
    --Check to see if an error occurred.
    error = Application.GetLastError();

    --If an error occurred, display the error message.
    if (error ~= 0) then
    Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
    end

    And error occurs: Destination directory does't exist. But directory exist.
    I can't understand how to use variable in this function? What is the problem?

  5. #5
    Join Date
    Jan 2007
    Posts
    271

    Arrow Hello Nivelir, I think this might help.

    instl = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Great Oaks\\DNA Compiler", "Install Location", true);
    -- Display the value read from the Registry in a dialog.
    message = Dialog.Message("Registry Data", "The value read from the Registry is "..instl..".");

    -- This function works great..
    IFT = Folder.DoesExist(instl);
    if IFT == true then
    File.Copy("AutoPlay\\Docs\\dnac.exe", instl, true, true, false, true, nil);
    else
    Dialog.Message("Hey", "The Folders not there.", MB_OK, MB_ICONNONE, MB_DEFBUTTON1)
    end
    Last edited by AudioSam; 01-28-2008 at 02:53 AM.

  6. #6
    Join Date
    May 2006
    Posts
    5,380
    or if the folder dosent exist then create it so install can proceed

    Code:
    instl= Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Great Oaks\\DNA Compiler", "Install Location", true);
    
    instl = Dialog.Message("Registry Data", "The value read from the Registry is "..instl..".");
    
    if not Folder.DoesExist(instl) then
    	Folder.Create(instl)
    end
    
    File.Copy("AutoPlay\\Docs\\dnac.exe", instl.."\\dnac.exe", true, true, false, true, nil);
    error = Application.GetLastError();
    if (error ~= 0) then
    	Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
    end
    Open your eyes to Narcissism, Don't let her destroy your life!!

  7. #7
    Join Date
    Jan 2007
    Posts
    271

    Arrow

    Quote Originally Posted by RizlaUK View Post
    or if the folder dosent exist then create it so install can proceed

    Code:
    instl= Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Great Oaks\\DNA Compiler", "Install Location", true);
    
    instl = Dialog.Message("Registry Data", "The value read from the Registry is "..instl..".");
    
    if not Folder.DoesExist(instl) then
    	Folder.Create(instl)
    end
    
    File.Copy("AutoPlay\\Docs\\dnac.exe", instl.."\\dnac.exe", true, true, false, true, nil);
    error = Application.GetLastError();
    if (error ~= 0) then
    	Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
    end
    Hey Rizla,

    I think the main problem with this was:

    instl = Dialog.Message("Registry Data", "The value read from the Registry is "..instl..".");

    Should be...
    message = Dialog.Message("Registry Data", "The value read from the Registry is "..instl..".");
    or anything besides instl

    Do you agree?
    AudioSam
    Last edited by AudioSam; 01-28-2008 at 07:21 AM.

  8. #8
    Join Date
    Jan 2007
    Posts
    271
    Code:
    instl = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Great Oaks\\DNA Compiler", "Install Location", true);
    -- Display the value read from the Registry in a dialog.
    message = Dialog.Message("Registry Data", "The value read from the Registry is "..instl..".");
    
    IFT = Folder.DoesExist(instl);
    if IFT == true then
    File.Copy("AutoPlay\\Docs\\dnac.exe", instl, true, true, false, true, nil);
    else
    FLoc = (YOUR FOLDER LOCATION HERE)----<<<<<<<<<<<<<<<<<<<<Change This
    Folder.Create(FLoc)
    File.Copy("AutoPlay\\Docs\\dnac.exe", FLoc, true, true, false, true, nil);
    end
    This would work..
    without instl in the registry there would be no reference to the folder.
    So Nivelir would have to determine where the folder would be...
    Last edited by AudioSam; 01-28-2008 at 07:47 AM.

  9. #9
    Join Date
    May 2006
    Posts
    5,380
    I think the main problem with this was:
    omg, how did i not even see that lol

    Code:
    instl = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Great Oaks\\DNA Compiler", "Install Location", true);
    -- Display the value read from the Registry in a dialog.
    message = Dialog.Message("Registry Data", "The value read from the Registry is "..instl..".");
    
    IFT = Folder.DoesExist(instl);
    if IFT == true then
    File.Copy("AutoPlay\\Docs\\dnac.exe", instl, true, true, false, true, nil);
    else
    FLoc = (YOUR FOLDER LOCATION HERE)----<<<<<<<<<<<<<<<<<<<<Change This
    Folder.Create(FLoc)
    File.Copy("AutoPlay\\Docs\\dnac.exe", FLoc, true, true, false, true, nil);
    end
    i agree that seems the best way, nice call
    Open your eyes to Narcissism, Don't let her destroy your life!!

  10. #10
    Join Date
    Jan 2007
    Posts
    271

    Hi,

    Thanks Riz,

    I had one of the Best help me when I asked.
    That was you my friend. You have helped so
    many that have asked, always having the right answers.
    I had read Nivelir's "It doesn't help" post and
    thought I would throw something in.

    Ok,,,enough of the mushy stuffff
    AudioSam

  11. #11
    Join Date
    Jan 2008
    Location
    Ukraine, Uzhhorod
    Posts
    5
    Thanks a lot fellows. I'll try it. It's realy nice that you helping me.

    ps: sorry for my poor english

  12. #12
    Join Date
    Apr 2007
    Posts
    1
    hi

    I think the problem in instl its content in reg must b like

    c:\folder\
    i did it befor and it works

    how u input instl value in the reg??(input or some thing els)
    is the folder created ??
    if not u must add creat folder using instl before the copy

  13. #13
    Join Date
    Jan 2008
    Location
    Ukraine, Uzhhorod
    Posts
    5

    Wink

    Quote Originally Posted by littlepharaoh5 View Post
    hi

    I think the problem in instl its content in reg must b like

    c:\folder\
    i did it befor and it works

    how u input instl value in the reg??(input or some thing els)
    is the folder created ??
    if not u must add creat folder using instl before the copy

    Script posted by AudioSam works great. The problem was in rewriting instl variable:

    instl= Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Great Oaks\\DNA Compiler", "Install Location", true);

    instl = Dialog.Message("Registry Data", "The value read from the Registry is "..instl..".");

    It was my mistake.
    Registry key is already in system regystry, my target was to read it from there and use like an install path.
    And yes, folder is already created, but its path may vary, thats why I need regystry key which has current path.
    Last edited by Nivelir; 02-04-2008 at 03:08 AM.

Similar Threads

  1. Registry Questions
    By rob14 in forum Setup Factory 7.0
    Replies: 1
    Last Post: 01-23-2008, 03:36 PM
  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. Replies: 2
    Last Post: 02-19-2003, 04:29 AM
  5. 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

Posting Permissions

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