Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:57 03 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2 Copy/paste between files and moving files.

Author Message
capsikin
Guru

Joined: 30/06/2020
Location: Australia
Posts: 341
Posted: 04:35am 30 Jul 2020
Copy link to clipboard 
Print this post

Hi, I don't think on the CMM2 you can copy from one file in the editor and paste into another. My workaround has been to take out the SD card and do it on another computer. Have people been using any other workarounds?

(update: possibly using F7 and F8 would help)

Moving files - the copy command in the file manager doesn't show you where the other directories are. I'd like to be able to see some of the directory structure when moving/copying a file into another location. My workaround has been using another computer again, but I'm guessing I could use basic commands including list files and copy.

Has anyone copied/moved things between directories on the CMM2?
Edited 2020-07-30 14:44 by capsikin
 
twofingers

Guru

Joined: 02/06/2014
Location: Germany
Posts: 1593
Posted: 06:24am 30 Jul 2020
Copy link to clipboard 
Print this post

Hi capsikin

my workaround (quick and dirty):
'**************************************************
' *******  Merge for CMM2, combines 2 files *******
'*****************  V 0.01  ***********************
'**************************************************

Const TRUE  =1
Const FALSE =0

Dim F1$,F2$,TF$,YN$,FSize As integer

'Input "file1" F1$
'Input "file2" F2$
'Input "Target file" TF$

F1$="M.txt"
F2$="S.txt"
TF$="New.txt"

'Print FileExists(F1$)
'Print FileExists(F2$)
'Print FileExists(TF$)

Print "Merge for CMM2"
Print
Print "Files to merge: " F1$ " + " F2$
Print "Target file   : " TF$

If Not FileExists(F1$) Then Print F1$ " doesn't exist!":End
If Not FileExists(F2$) Then Print F2$ " doesn't exist!":End
If FileExists(TF$) Then
  Print "Target file: " TF$ " exist! Overwrite? ";
  Input "(Y/N)";YN$
  If YN$<>"Y" And YN$<>"y" Then
    Print :Print "Program terminated!"
    End
  EndIf
EndIf

FSize=Merge(F1$, F2$, TF$)

Print :Print TF$ " created, file size = " FSize

End

Function Merge(FN1$, FN2$, TFN$) As integer
   Open FN1$ For input As #1
   Open TFN$ For output As #3

   Do While Not Eof(#1)
     Print #3, Input$(1,#1);
     Merge=Merge+1
   Loop

   Close #1

   Open FN2$ For input As #2

   Do While Not Eof(#2)
     Print #3, Input$(1,#2);
     Merge=Merge+1
   Loop

   Close #2,#3
End Function


Function FileExists(FileName$) 'NEW untested
 FileExists=not(MM.INFO(FILESIZE file$)=-1)
End Function


'Function FileExists(FileName$)
'  On error skip
'  Open FileName$ For input As #10
' If MM.Errno=0 Then
'   FileExists=TRUE
'   Close #10
' Else
'   FileExists=FALSE
' EndIf
' On error abort
'End Function


Perhaps we should have something similar (but better) in the CMM2 Basic?


Regards
Michael
causality ≠ correlation ≠ coincidence
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10315
Posted: 06:39am 30 Jul 2020
Copy link to clipboard 
Print this post

Open the first file, Select the information required (F$, then F5) and press F8 to save as a file
Open the second file and press F7 to paste the saved selection

To copy files between directories just use the copy command at the prompt
Edited 2020-07-30 16:43 by matherp
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 07:19am 30 Jul 2020
Copy link to clipboard 
Print this post

To copy from the command-line, I like to change to the destination directory and do the copy from there.
mkdir "test"
> cd "test"
> chdir "test"
> copy "a:/temp.bas" to "new.bas"
> files
17:15 30-07-2020       2129  new.bas


Jim
VK7JH
MMedit
 
twofingers

Guru

Joined: 02/06/2014
Location: Germany
Posts: 1593
Posted: 08:20am 30 Jul 2020
Copy link to clipboard 
Print this post

Correction:

Function FileExists(FileName$) 'NEW untested
  FileExists=not(MM.INFO(FILESIZE file$)=-1)
End Function


should be:
Function FileExists(FileName$) 'NEW untested
  FileExists=not(MM.INFO(FILESIZE FileName$)=-1)
End Function


********** EDIT ********************

Uhhh ...    

It seems that MMBasic is better than I thought! I found just out I CAN INSERT files with "F7"(while in the editor). It works exactly as I thought it should.
Perfect!  
Edited 2020-07-31 03:53 by twofingers
causality ≠ correlation ≠ coincidence
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025