I have a datagrid table, and this script extracts the data to a variable pepList.
All well and good, but the problem I have is that this code works from a button, but doesn't work from a menu item, in the same application. I have pasted, verbatim, the code from a button to another button (works) or to the menu item (fails)
I can't find an issue with, say, a global vs local variable, and even the temporary answer at the end delivers an empty, tab delimited, pepList file.
What am I missing, please?
Many thanks
Rob
Code: Select all
-- now recover the data from the data grid
put the dgData of group "peptideTable" into theDataA
-- Get indices of table in proper order
put the dgIndexes of group "peptideTable" into theIndexes
-- clear variable
put empty into pepList
-- Loop through data, putting into a variable in tab delim format
REPEAT for each item theIndex in theIndexes
put theDataA[theIndex]["pep"] & tab after pepList -- first word
put theDataA[theIndex]["M"] & tab after pepList
put theDataA[theIndex]["[M+H]+"] & tab after pepList
put theDataA[theIndex]["[M+2H]++"] & tab after pepList
put theDataA[theIndex]["Sequence"] & tab after pepList
put theDataA[theIndex]["Annotation"] & tab after pepList --sixth word
put theDataA[theIndex]["Unused"] & return after pepList -- seventh word
END REPEAT-- now have a tab delim variable (pepList) containing all info
answer pepList