|
Forum Index : Microcontroller and PC projects : Copying code from other programs with inbuilt editor?
| Page 1 of 2 |
|||||
| Author | Message | ||||
| DigitalDreams Regular Member Joined: 03/05/2025 Location: United KingdomPosts: 47 |
I often find myself wanting to copy or move sections of code from one program to another while using the built in editor. Is there a way of doing this as exiting clears the paste buffer ?. Maybe a way of inserting another .bas file at the cursor position ? Would save me having to use a PC via the sd card saves, not feasible when travelling. Thanks in advance... |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10896 |
Working from a PC, I use autosave append for this |
||||
| twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1718 |
I use the HDMI version of the FileManager for this (old F8=Cut, old F9=Merge). Regards Michael causality ≠ correlation ≠ coincidence |
||||
| Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1339 |
This is how I do it. Transfer the source files to the PC via xmodem, then edit them in Notepad++ and copy them back to the Pico via xmodem. You can then store frequently used routines (subs/fonts/functions) on the PC and simply add them to the source code. For minor changes, testing and error corrections, I use the built-in editor. Cheers Martin Edited 2026-01-25 02:39 by Martin H. 'no comment |
||||
| DigitalDreams Regular Member Joined: 03/05/2025 Location: United KingdomPosts: 47 |
Think I'll have to say again NO PC, only using the inbuilt file manager and editor... there must be a way. LCD Picomite 6.01 on a Pico2 btw... A command such as 'INSERT' would be great for this, or preserving the copy buffer on exiting the editor so the section could be pasted into another .bas |
||||
| twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1718 |
Where did you say it for the first time? causality ≠ correlation ≠ coincidence |
||||
| DigitalDreams Regular Member Joined: 03/05/2025 Location: United KingdomPosts: 47 |
"while using the built in editor", "would save me having to use a PC" |
||||
| stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2718 |
I'm not an inbuilt editor user but can't the lcd sdcard reader be used? |
||||
| phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2955 |
Until someone comes up with a better way, here is a convoluted method that may (eventually) do what you want. 1) Save your current program (the one you want to add a block of code to) to A: or B: 2) Load and edit the program that has the routine you want from A: or B: 3) Delete everything except the routine you want and save it with a new name to A: or B: 4) Write a short program to open that file and append each of its lines to the target program. 4) Edit that program (the one in step 1, if I have confused you) and move that new block of code from the end to where it is needed. That should keep you out of mischief for a while. ;) Option 2 (the one you don't want) Always take a laptop/notebook computer when travelling. |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 8467 |
The Picomite has no OS or windows-type clipboard. You can list a second program to the console while editing one, but you can't copy from it as it's merely being listed from flash or SD card - it's not in the editor. You can only have one program there. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
| disco4now Guru Joined: 18/12/2014 Location: AustraliaPosts: 1084 |
An extension of Phils idea. Use the REM command to create some directives that a third program understands. e.g. --- In the target file REM SOURCE A:/file1.bas REM INSERT FILE 'insert whole file here REM INSERT AA 'insert section bounded by REM AA ... REM AA REM INSERT BB etc --- In the source file REM AA code to insert ..... REM AA REM BB other code REM BB 1. Added the required directives and save the file. 2. Load the source file and mark the sections and save if not already done. 3. Run your third program , a utility that understands the above syntax that will modify your file as specified and reload it. F4 H7FotSF4xGT |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5632 |
Use include for the section you need to add Volhout PicomiteVGA PETSCII ROBOTS |
||||
| DigitalDreams Regular Member Joined: 03/05/2025 Location: United KingdomPosts: 47 |
Include ?? |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 8467 |
No idea. Does the Picomite support INCLUDE now? I don't think so. That's only on the CMM2, I think, as that runs a pre-processor. There is no way to insert text midway through a file unless it is records in a random access file. Phil's idea will work fine, but as he points out you have to append the text then move it into position. I like the idea of creating directives but I think it might rapidly get clunky for a program of any size, with a read_line-test_line-write_line for every line in the program. Maybe Volhout was suggesting using the word INCLUDE rather than INSERT? That would make sense. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
| IanT Senior Member Joined: 29/11/2016 Location: United KingdomPosts: 123 |
No, all too complicated for me. I'll stick to using a PC. IanT |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 8467 |
Me too. :) Unfortunately I can't think of any other way on a self-contained LCD display system. The Picomite isn't a computer and, amazing though it is, asking it to do things like cut and paste between separate files via a clipboard is probably asking a bit much of it. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
| Arne Regular Member Joined: 05/01/2025 Location: GermanyPosts: 47 |
I often use the built in editor. Best for me would be following: Marking with F4 : F5 generates then a „Clipboard-file“ on the active drive (instead of storing data in RAM). Advantage: Big data amount could be transferred, permanent storage, transferable to other programs Disadvantage: Slower, more flash write cycles Maybe implementation with „OPTION CLIPBOARD…“ selectable. Arne |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5632 |
Never tried it. But... ![]() I always use MMEdit. Volhout PicomiteVGA PETSCII ROBOTS |
||||
| lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3569 |
I tried it, it didn't work, and I posted a question about it quoting that CMM2 LOAD text from the Picomite manual. Peter explained that it did only work with CMM2 LOAD, which (as the manual says), strips out comments and white space. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10896 |
Watch this space |
||||
| Page 1 of 2 |
|||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |