I exported my macros from the pc connected to the Long Mill to a usb stick. The .json file does reside on the usb stick. I took that usb stick to a test pc also running gSender 1.4.10. In gSender, I used the “import macros” function. I pointed to the usb stick, gSender saw the .json file. I clicked to import that file. The macro window in gSender still showed no macros. I disconnected gSender from the test Uno, shut down gSender and opened it. It still shows no macros.
I opened the .sender_rc file and the macros are not in that file either.
Can someone please tell me what I am doing wrong? Tks.
I just tested this, minus the USB drive, and it worked fine. Both PC’s are Windows 10 with gSender 1.4.10. I have a shared folder between the two PC’s. I exported from machine A, saving to a folder on machine B, and then imported on machine B and the macros showed up immediately.
I would try copying the file from the USB stick onto the main drive and then import it from there if it’s not corrupted. That might help to isolate the problem.
@_Michael Funny you should advise that. I was thinking the same thing.
I just tried putting the .json file in the same folder as the .sender_rc file. No luck. Then I put it into the program files\gsender folder. No luck there either.
The strange part about this is that I started all this because of another glitch that I found yesterday. On my “main” pc, I exported the .json file containing the macros. I edited one macro in notepad and re-imported the file. The edit didn’t seem to take. On further examination, I found that both the .json file and .sender_rc contain 12 copies of my macros. It seems that every time I have edited the macros over the years, when I import the changed file, it does not replace the macros. It appends the new ones onto the old ones.
The exercise that I am trying now is to find a way to clean this mess up. I figured that if I could rename .sender_rc, close gSender and re-start it, it would create a new .sender_rc. (This is what we tell people to do when they want to revert to a previous gSender version.) The new version would contain no macros. Then, I would import the .json macros file, and I would have a clean macros list. Unfortunately, so far, that has not worked.
You know what they say about great minds, or in our case maybe equally not so great!
@gwilki
I was able to edit the sender_rc file directly to remove a macro. When I opened the file in notepad it was all in one line which is not good. So I used Visual Studio Code to edit it. After making a backup, sender_rc.old I opened sender_rc with VS Code. I then used Alt + Shift + F to format the document. That makes it easier to work with.
I’m not sure how familiar you are with JSON but it’s not too hard to edit and you said you edited some already. Just remove sections from open brace { to close brace } in the macro section. Make sure each macro block is separated by a comma except the last one.
"macros": [
{
macro one ...
},
{
macro two ...
},
{
last macro block has no comma
}
]
The was no comma after the closing square bracket ] as macros was the last entry in my sender_rc.
After deleting blocks the macro was gone from gSender and the file was back to being all on one line. I guess that’s how gSender likes it.
I only had two macros and I deleted the first which left my remaining macro in “column2”. I’m assuming you could edit the “culumn” and “rowIndex” fields in the sender_rc file to arrange them or just drag them in gSender later maybe? I haven’t had enough macros to try rearranging them in gSender.
@_Michael I’m going to try that. I just exported the file again from the “live” pc. I saved it to the usb stick. I imported the file into the test machine and it worked.
It would seem that the issue stems from editing the file in notepad. I was careful about punctuation, but maybe I missed something.
Now, of course, the test machine is a mess, too. There are 12 copies of each macro on it. Thankfully, I remembere to copy the .sender_rc file, so I can delete the current one and copy back the old one.
Tks for your help. I’ll let you know how I make out.
Okay, VS Code is a good editor if you don’t have it. I’m not a Microsoft fan but credit where it’s due, it’s a nice free product. It’s my second favorite editor after NeoVim. Vim can be hard to get used to but after learning modal text editing I can’t live without it.
Tip: If you rename sender_rc to sender_rc.json VS Code will put error squggles if you make a mistake. Remember to name it back so gSender finds it.
@_Michael I just installed vscode. When I open the .json file, I see that all the macros are in one line, just like in Notepad. Both VSCode and notepad have inserted an “n” where the line break would be. You’ve said that this is not good, but how to I avoid it.
Keep in mind that I am opening the exported .json macro file, not .sender_rc.
Do you think that I should forget about trying to edit the macro file and simply edit the _rc file?
Hold alt + shift then hit F to format the document. Sorry had to step away for a bit. I think it’s just as easy to edit the sender_rc file especially if you rename it with .json for the error squiggles then you can ctrl + shift + S for save as to save it as sender_rc. Just ctrl + S will save with the current name.
Another tip is ctrl + shift + P, it opens the command palette and you can search for editor commands. For instance ctrl + shift + P opens the palette, then type format and it gives a list that you can use to select the Format command and shows the alt + shift + F shortcut. Might be a good idea to use the palette to get to Format in case my keybinds have been changed.
And my saying it’s not good on one line was just because it makes it harder to read the code. After it is formatted, the json should be much more readable with proper line breaks and indentation.
@_Michael I did use the ctrl-shift-f command on the .json macro file and the macros were still shown on one line with “n” to show the line break.
Here is an example
“name”: “Offset - laser first”,
“content”: “G91\nG21\nG0 X-2 Y-85.67\nG90\nG20”
In the .sender_rc file, the macros are shown as multi-line.
So, there seems to be no way to edit the .json file that gsender exports that will be acceptable to gsender to import it. That seems strange to me.
Oh, I gotcha. It only formats the json structure but the actual macro is on one line. Probably easier to edit the actual macro in gSender. I thought you were just editing outside of gSender to remove whole macros.
EDIT: the \n means line break, it’s called an escape code the ‘\n’ is treated as one ASCII code for a new line. It dates back at least to C in early 1970’s.
@_Michael I am trying to remove whole macros. The problem is that, as soon as I edit the .json file, gSender will not import it back.
When I wrote the macros, there were on multi-lines. It’s when gSender exports them as a .json file that gSender seems to “format” them as single line with an “n” where the line should break.
If I were only editing a macro, I would do as you suggest and edit it in gSender.
So we are back to here? And the answer is yes and if you name it sender_rc.json then VS Code will know it’s JSON and help with syntax errors if you forget a comma etc.
The code snippet that I entered a couple posts back was from my sender_rc not exported macro file.
@_Michael Tks for that. Interesting in reading this .sender_rc file, it seems to have info on all the jobs that I have done, or at least many of them. Again, not being a programmer or computer expert, that seems to be inefficient tome. That file is going to keep getting larger with information that seems to be of no use - at least to me.
Take care, Michael
I’m guessing that the job info is for the new job history or whatever it’s called in gSender. Not sure if you can clean that part up in gSender. I haven’t played with that part much and it’s fairly new. I think they added that when the added the stuff about keeping track of machine use to remind for maintenance.
Your welcome Grant and Happy Holidays if you celebrate such things, gotta be PC nowadays.
@_Michael To close this off, I edited the .sender_rc file to remove all the duplicate macros. I replaced the file on my live pc, and opened gSender. The list of macros under the macro tab now contains only one of each macro.
The list of macros in the keyboard shortcut list still contains all the duplicates. I reported this back in the Summer of 2023, so it’s been a known bug since then. No big deal.