Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 2004
    Posts
    313

    File open And Copy to destination

    Hi Guys,

    I am trying to open a file and copy it to a specific folder.

    Here is what I have

    image1 = Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "Image Files (*.jpg*)|*.jpg*|", "", "jpg", false, false);
    File.Copy(("image1"), "C:\\mydir\\", true, true, false, true, nil);

    Any ideas on th correct syntax.

    Thanks

  2. #2
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Code:
    image1 = Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "Image Files (*.jpg*)|*.jpg*|", "", "jpg", false, false);
    if image1[1] ~= "CANCEL" then
    	tblFileInfo = String.SplitPath(image1[1])
    	File.Copy(image1[1], "C:\\mydir\\"..tblFileInfo.Filename..tblFileInfo.Extension, true, true, false, true, nil);
    end

  3. #3
    Join Date
    Jul 2004
    Posts
    313
    Thanks for that Worm but the image does not seem to be copied.
    I see you have created a string tblFileInfo what does this mean?
    Do I need a table on my page?

    thanks

  4. #4
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    It works here. The only thing is that the folder you are copying the file too, must already exist.

  5. #5
    Join Date
    Jul 2004
    Posts
    313
    Thanks Worm,

    I did not realise it had to exist lol.

    It works great now.

    Thank you.

  6. #6
    Join Date
    Jul 2004
    Posts
    313
    Worm do you know how I could store the image name in a string so that I can write it to a text file?

    Thanks.

  7. #7
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Quote Originally Posted by ianhull
    Worm do you know how I could store the image name in a string so that I can write it to a text file?

    Thanks.
    If you just want the name you can use the String.Split to split the path into parts and then use the Filename or Filename and extension as your string.

    Code:
    image1 = Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "Image Files (*.jpg*)|*.jpg*|", "", "jpg", false, false);
    if image1[1] ~= "CANCEL" then
    	tblFileInfo = String.SplitPath(image1[1])
    	strFilename = tblFileInfo.Filename
    	--or if you want the extension as well
    	--strFilename = tblFileInfo.Filename.. tblFileInfo.Extension
    	File.Copy(image1[1], "C:\\mydir\\"..tblFileInfo.Filename..tblFileInfo.Extension, true, true, false, true, nil);
    end
    Tigg
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  8. #8
    Join Date
    Jul 2004
    Posts
    313
    Thanks TJ Tigger.

    Very much appreciated.

    I will have to start remembering all this instead of asking you guys all the time.

    Thanks again.

Similar Threads

  1. Open dialog copy selected file.
    By ianhull in forum AutoPlay Media Studio 5.0
    Replies: 2
    Last Post: 03-23-2005, 02:49 AM
  2. HOWTO: Create a Project Template
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-28-2002, 01:49 PM
  3. FAQ: AutoPlay Menu Studio 3.0 Frequently Asked Questions
    By Support in forum AutoPlay Menu Studio 3.0
    Replies: 0
    Last Post: 10-10-2002, 01:15 PM
  4. 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
  5. Copy File from CD
    By Matthew Walters in forum AutoPlay Menu Studio 3.0
    Replies: 1
    Last Post: 03-30-2001, 01:57 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