Skip to content

Commit 9eaea8e

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 e11782c commit 9eaea8e

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
@@ -47,6 +47,25 @@ End
4747

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

5271
Function SF_BringBrowserToFront()

0 commit comments

Comments
 (0)