Skip to content

Commit 4b523fd

Browse files
committed
SF: Add context menu option on SF table to copy formulas to clipboard
The formulas are copied with the "with" keyword if the table consists of multiple formulas.
1 parent 3ce6eb0 commit 4b523fd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Packages/MIES/MIES_SweepFormula.ipf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,25 @@ End
4545

4646
Menu "TablePopup"
4747
"Bring browser to front", /Q, SF_BringBrowserToFront()
48+
"Copy formulas", /Q, SF_PutFormulasToClipboard()
49+
End
50+
51+
Function SF_PutFormulasToClipboard()
52+
53+
string table, txt, jsonTxt, formula
54+
55+
table = GetCurrentWindow()
56+
57+
jsonTxt = GetUserData(table, "", SF_UDATA_TABLEFORMULAS)
58+
if(!IsEmpty(jsonTxt))
59+
WAVE/T formulas = JSONToWave(jsonTxt)
60+
txt = ""
61+
for(formula : formulas)
62+
txt += TrimString(formula) + "\rwith\r"
63+
endfor
64+
txt = RemoveEnding(txt, "\rwith\r")
65+
PutScrapText txt
66+
endif
4867
End
4968

5069
Function SF_BringBrowserToFront()

0 commit comments

Comments
 (0)