Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2009
    Posts
    4

    Huh? Newbie file.copy problem

    AutoPlay Media Studio 7.5

    I am trying to copy a file from "AutoPlay\\Docs\\testmsg1.txt to a folder in C:\Program Files\Application X\TestFolder.

    Wow! What I thought would be trivial is driving me crazy.

    I wrote this script:
    File.Copy("AutoPlay\\Docs\\testmsg1.txt", _ProgramFilesFolder .. "\\Application X\TestFolder");
    error = Application.GetLastError();
    if )error ~= 0) then
    Dialog.Message("Error", _tbleErrorMeesages [error], MB_OKCANCEL, MB_ICONEXCLAMATION);
    else
    File.ExploreFolder(_ProgramFilesFolder .. "\\Application X\TestFolder");
    end

    I can create a folder in C: but not anthing in the Program Files especially in a nested subdirector within Program Files.

    I am running Windows Vista.

    All help is sincerely appreciated.

  2. #2
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Code:
    File.Copy("AutoPlay\\Docs\\testmsg1.txt", _ProgramFilesFolder .. "\\Application X\\TestFolder");
    error = Application.GetLastError();
    if )error ~= 0) then
    Dialog.Message("Error", _tbleErrorMeesages [error], MB_OKCANCEL, MB_ICONEXCLAMATION);
    else
    File.ExploreFolder(_ProgramFilesFolder .. "\\Application X\\TestFolder");
    end
    You forgot to escape the last folder path's part. (See red highlighted slashes) add those and it should work (If those folders exist)
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  3. #3
    Join Date
    Mar 2009
    Posts
    4
    Thank you for the speedy reply.

    It was my error in copying the script. I did have the \\ in the correct places and am getting an error message "Failed to copy one or more files.

    Again, all help is greatly appreciated.

  4. #4
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Ah i remember, File.Copy somehow doesn't accept "Autoplay\\Docs\\bla.txt" so try:

    Code:
    File.Copy(_SourceFolder.."\\".."AutoPlay\\Docs\\testmsg1.txt", _ProgramFilesFolder .. "\\Application X\\TestFolder");
    error = Application.GetLastError();
    if (error ~= 0) then
    Dialog.Message("Error", _tbleErrorMeesages [error], MB_OKCANCEL, MB_ICONEXCLAMATION);
    else
    File.ExploreFolder(_ProgramFilesFolder .. "\\Application X\\TestFolder");
    end
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  5. #5
    Join Date
    Aug 2004
    Location
    Somewhere in Texas, USA
    Posts
    417
    How do you manage to mess up the code with copy and paste?

    MISTAKES EVERYWHERE

    Try this...

    Code:
    File.Copy("AutoPlay\\Docs\\testmsg1.txt", _ProgramFilesFolder .. "\\Application X\\TestFolder");
    error = Application.GetLastError();
    
    if (error ~= 0) then
        Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
    else
        File.ExploreFolder(_ProgramFilesFolder .. "\\Application X\\TestFolder");
    end

    Remember, if the folder doesn't exist it will not copy the file but you will get the "_tblErrorMessages" message explaining such.
    Last edited by mwreyf1; 03-22-2009 at 05:32 PM.

  6. #6
    Join Date
    Mar 2009
    Posts
    4
    Again, thank you for your suggestion. Unfortunately it didn't work either.

    My belief is that this may be a permission's problem as I can write to other directories but not Program Files.

    Strange. I'm really stumped as I have to copy a file to a specific directory or the application I developed will not work properly.

  7. #7
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    If you are using Vista, you can't copy files to Program Files like that.
    Dermot

    I am so out of here

  8. #8
    Join Date
    Nov 2006
    Posts
    233
    Autoplay Menu > Project > Settings > Advanced > Requested User Privilege Level (Vista) > Require Administrator > Click Ok

  9. #9
    Join Date
    Mar 2009
    Posts
    4

    Thanks So Much

    It definitely was a permissions problem. Thanks for pointing me in the correct direction. Although in my case I was not able to change the settings in the Requested User Privilege Level as it was greyed out.

    I solved the problem by turning off the User Account Control.

    Although it worked, I was wondering why my options are greyed out (not available).

Similar Threads

  1. Problem installing fonts
    By ByronFS in forum Setup Factory 7.0
    Replies: 5
    Last Post: 05-08-2006, 12:23 PM
  2. Another File.Copy problem
    By scotland42 in forum AutoPlay Media Studio 5.0
    Replies: 13
    Last Post: 05-16-2005, 09:00 AM
  3. problem with file.copy
    By RoSmecher in forum Setup Factory 7.0
    Replies: 1
    Last Post: 02-28-2005, 02:06 PM
  4. Strange File.copy problem
    By BillEBob in forum AutoPlay Media Studio 5.0
    Replies: 0
    Last Post: 01-16-2004, 09:53 AM
  5. INFO: Tips for Debugging Action Lists in AutoPlay Media Studio 4.0
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-03-2002, 08:38 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