Never mind, I figured it out - one of the functions had Eval() which was evaluating right when script starts.
I am writing a simple GUI prototype:
List of tables in a combo box, button to add\open table and Filter Col Box with column names of the currently selected table.
Everything works on the first run - tables are switched, columns are displayed, combobox reacts to tables being added, closed or renamed.
I'm using subscription to tables for that.
After I close GUI window and start the script AGAIN, I'm getting random errors connected to symbols not being defined (it's a new instance running). As if on start it keeps running pieces of code in random places from previous instance and not finding variables defined in those pieces.
I click OK on error pop-up and run again - script working normally
Here's my window onClose function:
onWindowCloseExpr = Expr(
Write("\!nRunning on window close expression");
For Each({_dt, _index}, (data:tablesListAA << Get Values),
Close(_dt, NoSave);
);
Unsubscribe to Data Table List( aSub );
Clear Symbols();
Stop();
);
I added Clear Symbols() and Stop() while trying to troubleshoot the issue, to make sure script stops and everything cleared.
Any idea what's happening and how to fix?