79632469

Date: 2025-05-21 17:16:31
Score: 0.5
Natty:
Report link

here is a short script to save your params in a side text file. Enjoy !
The big part is error handling in file writes. If an error occurs, you won't have to quit the script editor to get rid of it.

set gcodeFile to (choose file with prompt "Source File" of type "gcode") -- get file path
set commentFile to (gcodeFile as text) & "_params.txt" --set destination file name ... roughly
set fileContent to read gcodeFile using delimiter {linefeed, return} -- read file content and split it to every paragraph
set comments to "" -- prepare to collect comments
repeat with thisLine in fileContent
    if (thisLine as text) starts with ";" then set comments to comments & linefeed & (thisLine as text)
end repeat
try
    set fileHandler to open for access file commentFile with write permission -- open 
    write comments to fileHandler -- write content
    close access fileHandler -- close
on error err
    close access fileHandler -- important !!
    display dialog err
end try
Reasons:
  • Blacklisted phrase (1): to comment
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Chino22