Nathan, are you basing this on Technote 08? the section: CopyTo Copies the entire file or portion of it to the target File.
Syntax: variable = File.CopyTo( file, cbBytes) Parameters: file - the Target File. cbBytes - Bytes to copy to the target File. returned value: The actual number of bytes copied. Examples: AddObject "newObjects.utilctls.SFMain", "FS" Set File1 = FS.OpenFile("C:\MyFile1.txt") Set File2 = FS.OpenFile("C:\MyFile2.txt") File1.Pos = 100 n = File1.CopyTo(File2,100) ' Copies 100 bytes beginning from the 100-th byte in the ' source File. Remarks: This method can be used for fast transfer of data between different files. Used to copy files from different storages - for example file to a file in an OLE file etc. Your example does not match the syntax of Technote 08. The unit I work with does not have a Drive named "C:" The main storage Volume is called "Flash Drive" When I insert an SD card, I get a Volume folder called "\Storage Card\ When I insert an USB stick, I get a Volume folder called "\Hard Disk\ My source path file is "\Storage Card\SIDData\STID-012009.Txt" My destination path file is "\Hard Disk\SIDData\STID-012009.Txt" Full path names, In your case what Volumes or Folders listed by Activesync when you explore you device? Use Full path names Ben --- In nsbasic-ce@yahoogroups.com, "bigp...@..." <bigp...@...> wrote: > > The files are on the handheld, I believe it is called "My Device" > I'm guessing its equivalent to the "My Computer" destination on a computer > > --- In nsbasic-ce@yahoogroups.com, "bwolodko" <ben.wolodko@> wrote: > > > > Nathan, these objects require you to specify the file Path. > > > > Where does "ABC.txt" reside? > > > > Ben > > > > --- In nsbasic-ce@yahoogroups.com, "George Henne" <gh@> wrote: > > > > > > You need to make sure the NewObjects control is on the device. > > > > > > What version of NS Basic/CE are you using? > > > > > > >I would like some help on this as well. > > > >When i modify the code from Tech Note 3 > > > > > > > >AddObject "newObjects.utilctls.SFMain", "FS" > > > >FS.CopyFile("ABC.txt","\Program\DEF.txt") > > > > > > > >I get an error message saying > > > >"Microsoft VBScript runtime error.....char 0 File name or class name not > > > >found during automation operation" > > > > > > > >I thought copying it from the tech note would be pretty straight > > > >forward. though I was wrong. > > > > > > > > > > > >--- In nsbasic-ce@yahoogroups.com, "bwolodko" <ben.wolodko@> wrote: > > > >> > > > >> Nathan, > > > >> here is a Code Snippet for copying files from an SD card on the > > > >CuWin3500 device to a USB stick plugged into the CuWin3500. > > > >> > > > >> This code was written using NSBasic 7.0.5 and Uses the old Windows > > > >File and filesystem Dll's > > > >> > > > >> I left out some Dim statements for the variables > > > >> and Addobject picture elements. > > > >> > > > >> This is just to show you the flow. This will not run as is > > > >> > > > >> Code Start > > > >> > > > >> Option Explicit > > > >> ShowOKButton True 'Set minimize button URHC to close app > > > >> > > > >> ' make full screen hide taskbar and top menu > > > >> ' Screen is 800 x 480 > > > >> Dim hWnd > > > >> Dim nWidth > > > >> Dim nHeight > > > >> Dim bRepaint > > > >> Declare "Function GetForegroundWindow Lib ""Coredll"" () As Long" > > > >> Declare "Function MoveWindow Lib ""Coredll"" (ByVal hWnd As Long, > > > >ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As > > > >Long, ByVal bRepaint As Long) As Long" > > > >> hWnd = GetForegroundWindow > > > >> MoveWindow hWnd, 0, -26, Output.Width, 506, True ' 26 and 506 > > > >> ' need To hide the taskbar On Cuwin using a mouse in the USB port > > > >> Output.BackColor = &H00000000& ' Black background > > > >> > > > >> > > > >> Dim SrcePath ' "\Storage Card\SIDData\" > > > >> Dim SrceFName' "STID*.Txt" > > > >> > > > >> Dim DestPath ' "\Hard Disk\SIDData\"' Subdirectory on the USB Drive, > > > >must be there to prevent an error > > > >> Dim DestFName '= DestPath & FLName > > > >> Dim FileCount ' Count number of Station ID Data Files > > > >> Dim Source ' "\Storage Card\SIDData\STID*.Txt" > > > >> Dim DataDir ' filesystem.dir(Source) > > > >> Dim FLLen ' Len(DataDir) ' is this the length of the file only? > > > >> Dim FLName ' Mid(DataDir,28,FLLen - 28)) > > > >> Dim DestFileTest > > > >> > > > >> > > > >> > > > >> ' File System object to Copy Data Files to USB Hard Drive > > > >> AddObject "FileSystem", "FileSystem", 0, 0, 0, 0 > > > >> AddObject "FileSystem", "FileSystem1", 0, 0, 0, 0 > > > >> > > > >> ' File object to open/read/write Default and Station ID Data Files > > > >> AddObject "file" > > > >> > > > >> ' ------------------------------------------------------ > > > >> Sub USBTransferScreen > > > >> > > > >> ' Called in Dpic1_Click to transfer data to USB Stick > > > >> ScreenHeader.Picture = PathDeflt & DfVHdr ' Gaea ... Powder Counter > > > >Default Values > > > >> > > > >> ' Subdirectory on the SD Card > > > >> SrcePath = "\Storage Card\SIDData\" > > > >> SrceFName = "STID*.Txt" > > > >> ' Subdirectory on the USB Drive, must be there to prevent an error > > > >> DestPath = "\Hard Disk\SIDData\" > > > >> > > > >> 'filesystem.FileCopy PathName, NewPathName > > > >> > > > >> FileCount = 1 > > > >> Source = "\Storage Card\SIDData\STID*.Txt" > > > >> > > > >> DataDir = filesystem.dir(Source) > > > >> SrceFName = SrcePath & DataDir > > > >> DestFName = DestPath & DataDir > > > >> Call USBFileCopy > > > >> > > > >> If DestFileTest = "" Then ' check to see if USB Drive is plugged in > > > >> Exit Sub > > > >> End If > > > >> > > > >> While (DataDir <> "") > > > >> DataDir = fileSystem.Dir() ' each time envoked brings up a new > > > >> file > > > >> If DataDir <> "" Then > > > >> SrceFName = SrcePath & DataDir > > > >> DestFName = DestPath & DataDir > > > >> FileCount = FileCount +1 > > > >> Call USBFileCopy > > > >> End If > > > >> WEnd > > > >> > > > >> Dpic1.picture = PathDeflt & DefPicR(1) ' TURN "Upload to USB Drive" > > > >Button background red > > > >> USBOperatorDone.show ' show the Done Button "Sub USBOperatorDone_click" > > > >> > > > >> End Sub > > > >> > > > >> ' --------- Copy files from the SD Card to the USB Stick > > > >-------------------- > > > >> Sub USBFileCopy > > > >> ' Test if the USB Hard Disk is plugged in > > > >> > > > >> DestFileTest = FileSystem1.Dir("\Hard Disk\USBCheck.dat") > > > >> If DestFileTest = "" Then > > > >> Mpic6.DrawText " " > > > >> Mpic6.DrawText "USB Drive Error" > > > >> Mpic6.DrawText "No USB Device" > > > >> Mpic6.DrawText "Insert USB Drive " > > > >> Mpic6.DrawText "and Try Again... " > > > >> USBOperatorDone.show > > > >> UpdateScreen > > > >> Exit Sub > > > >> End If > > > >> > > > >> Mpic6.move 360,75,420,275 ' no next of back buttons > > > >> Mpic6.TransparentColor = -1 > > > >> Mpic6.BackColor = BlueBackColor > > > >> Mpic6.Cls > > > >> Mpic6.FontBold = True > > > >> Mpic6.FontSize = 30 > > > >> Mpic6.ForeColor = &H0000FFFF& > > > >> Mpic6.show > > > >> Mpic6.DrawText FileCount & " Data Files" > > > >> Mpic6.DrawText "Copying ..." > > > >> Mpic6.DrawText SrcePath > > > >> Mpic6.DrawText DataDir > > > >> Mpic6.DrawText "to USB Drive" > > > >> Mpic6.DrawText DestPath > > > >> > > > >> UpdateScreen > > > >> > > > >> 'Test If the file does Not exist yet > > > >> If (FileSystem1.Dir(DestFName) = "") Then > > > >> ' Then we can copy the file > > > >> FileSystem.FileCopy (SrceFName), (DestFName) > > > >> ElseIf (FileSystem1.Dir(DestFName) <> "") Then > > > >> Mpic6.DrawText " " > > > >> Mpic6.DrawText "File Exists on Destination" > > > >> UpdateScreen > > > >> End If > > > >> > > > >> End Sub > > > >> Code Stop > > > >> > > > >> This project was Formless, and 95 elemets were picture elements > > > >> i.e. > > > >> AddObject "NSCEPictureBox.NSCEPictureBoxCtrl.1","GeoL",60,40,400,150 > > > >> > > > >> Then use GeoL.hide and GeoL.show to hide and show specific elements at > > > >specific times and events. Use _Click events to move through the program > > > >> > > > >> All objects were created using AddObject, no toolbox objects were > > > >used, because this was Formless. > > > >> All variables Dim'ed first, then all objects created and hidden, then > > > >specific objects shown, then using Click events, to run the program. > > > >> > > > >> Program contained 4550 lines, > > > >> > > > >> NSBasic ultimately worked well, but not without it's frustrations. > > > >> > > > >> There is a learning curve, as with any programming language. > > > >> > > > >> Hope this helps. > > > >> > > > >> Ben > > > >> > > > >> > > > >> --- In nsbasic-ce@yahoogroups.com, "rmrsoft" <alan@> wrote: > > > >> > > > > >> > Yes, that is what I meant. I am not aware of the boolean operator > > > >but you could be right. > > > >> > > > > >> > --- In nsbasic-ce@yahoogroups.com, epankoke@ wrote: > > > >> > > > > > >> > > The tech note may not specifically show code for copy, but if you > > > >look at the Methods list for the file object, there is a method called > > > >FileCopy. If I had to guess, the parameters would be FileToCopyFrom, > > > >FileToCopyTo, and possibly an optional boolean to specify whether to > > > >fail or overwrite if the destination already exists. > > > >> > > > > > >> > > > > > >> > > ----- Original Message ----- > > > >> > > From: "Nathan" <eeepc904@> > > > >> > > To: nsbasic-ce@yahoogroups.com > > > >> > > Sent: Friday, March 5, 2010 4:42:17 AM GMT -05:00 US/Canada > > > >> > > Eastern > > > >> > > Subject: [nsbasic-ce] Re: Copy Files > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > The third Tech Note doesn't cover Copy, only append, ... :( > > > >> > > > > > >> > > --- In nsbasic-ce@yahoogroups.com , "rmrsoft" <alan@> wrote: > > > >> > > > > > > >> > > > It's all covered in Tech Note 3e > > > >> > > > > > > >> > > > > > > >> > > > --- In nsbasic-ce@yahoogroups.com , "Nathan" <eeepc904@> wrote: > > > >> > > > > > > > >> > > > > I don't like to be..., but someone can help me? > > > >> > > > > > > > >> > > > > --- In nsbasic-ce@yahoogroups.com , "Nathan" <eeepc904@> > > > >> > > > > wrote: > > > >> > > > > > > > > >> > > > > > Hello, > > > >> > > > > > I want to know how to copy files with NSBasic/CE 7.0 > > > >> > > > > > > > > >> > > > > > Best Regards, > > > >> > > > > > Nathan Paulino Campos > > > >> > > > > > > > > >> > > > > > > > >> > > > > > > >> > > > > > >> > > > > >> > > > > > > > > > > > > > > > > > > > >------------------------------------ > > > > > > > >Yahoo! Groups Links > > > > > > > > > > > > > > > > > > -- You received this message because you are subscribed to the Google Groups "nsb-ce" group. To post to this group, send email to nsb...@googlegroups.com. To unsubscribe from this group, send email to nsb-ce+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/nsb-ce?hl=en.