Supress path during file copy

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • pjhiggins
    Forum Member
    • Feb 2004
    • 73

    Supress path during file copy

    Is it possible to supress the path in the status dialog box during a file copy?

    During my copy operation the paths are so long that the status box ends up going beyond the screen border.

    To ither remove it all together or have it show a percentage as the file is copied would be super.

    Thanks!
  • Desmond
    Indigo Rose Staff Member
    • Jul 2003
    • 710

    #2
    Hello PjHiggins,

    I would use a callback function to omit the path info:

    Code:
    --Copy Callback Function
    function CopyCallBack (sSource, sDestination, nCopied, nTotal)
    	--Set the title
    	StatusDlg.SetTitle("Copy");
    	
    	--Set the message
    	StatusDlg.SetMessage("Copying Files . . . Please Wait . . .");
    	
    	--Get the path info
    	tCurrentFile = String.SplitPath(sSource); 
    	
    	--get just the file name and extension (omit drive/folder info)
    	sCurrentFile = tCurrentFile.Filename .. tCurrentFile.Extension;
    	
    	--set the status text
    	StatusDlg.SetStatusText("Current File: " .. sCurrentFile .. "\r\nBytes Copied: " .. nCopied .. " / " .. nTotal);
    end
    	
    
    --Show the status Dialog
    StatusDlg.Show(0, false);
    
    --Perform the copy action, using a callback function
    File.Copy(Source, Destination, false, false, false, false, CopyCallBack);
    
    --Hide the status Dialog
    StatusDlg.Hide();
    You can make the status dialog do whatever you want!

    Hope that helps.

    Comment

    • pjhiggins
      Forum Member
      • Feb 2004
      • 73

      #3
      Thanks! Yes, that's what I was looking for.

      Question...
      I can't find sSource, sDestination, nCopied, nTotal in the documentation.

      Where did they come from and is there a list of them all?

      Thanka again!

      Comment

      • Desmond
        Indigo Rose Staff Member
        • Jul 2003
        • 710

        #4
        Originally posted by pjhiggins
        Thanks! Yes, that's what I was looking for.

        Question...
        I can't find sSource, sDestination, nCopied, nTotal in the documentation.

        Where did they come from and is there a list of them all?

        Thanka again!
        Hey PJ,

        Those variables are required for the callback function. The names I pulled out of my head. The docs for File.Copy (under the callback function section) say something like "the function must be able to accept the following variables", and then there is a table/list. That's where I found them. Sorry for the lack of accuracy with that quote, but i'm running from memory here!

        Lemme know if you have any other questions.

        Desmond.

        Comment

        • pjhiggins
          Forum Member
          • Feb 2004
          • 73

          #5
          Gah! I found them.

          Right where you said and right where I skimmed over them a dozen times.

          Thanks again. Most helpful, you are! (/wave Yoda)

          Comment

          Working...
          X