michaelk Posted June 5, 2017 Share Posted June 5, 2017 OK. I'm hoping someone can help me with this. I'm having a problem where some scripts start misbehaving after a while. @PatStanfordhelped me track it down a few months ago. He showed my how to fix it, but it's a bit of a draconian fix. I have many scripts like the one below: Procedure FontSizePlus1; {Badly scripted by Michael Klaers} VAR WSHand : Handle; {Handle to Worksheet} topRow,leftColumn,bottomRow,rightColumn,fontIndex,fontSize,fontStyle :INTEGER; currentCellRow,currentCellColumn,topRangeRow,leftRangeColumn,topRangeSubrow,bottomRangeRow,rightRangeColumn,bottomRangeSubrow :INTEGER; newFontSize :INTEGER; LoopColumn,LoopRow :INTEGER; BEGIN WSHand:=GetTopVisibleWS; GetWSSelection(WSHand,currentCellRow,currentCellColumn,topRangeRow,leftRangeColumn,topRangeSubrow,bottomRangeRow,rightRangeColumn,bottomRangeSubrow); For LoopColumn := leftRangeColumn TO rightRangeColumn DO BEGIN FOR LoopRow := topRangeRow TO bottomRangeRow DO BEGIN GetWSCellTextFormat(WSHand,LoopRow,LoopColumn,fontIndex,fontSize,fontStyle); newFontSize := fontSize+1; SetWSCellTextFormat(WSHand,LoopRow,LoopColumn,LoopRow,LoopColumn,fontIndex,newFontSize,fontStyle); Message('Font Size ', newFontSize); END; END; END; RUN(FontSizePlus1); It's super simple (the only kind I write :-). It has served me well from 2011 to 2016. After a while in 2016 or 2017 it will start throwing this error every time I run it: Here's the weird thing. The script still works. If I dismiss the error message, it just goes on and does its job. Other users don't get this error message. It seems like it's getting a zero value for a row or column? This solution - thanks Pat - is to delete my user file. /Users/MK/Library/Application Support/Vectorworks/2017. That works for a while until it doesn't. Obviously, this is no fun. Any ideas? What can this script be doing to the user file? Or, what is stored in the user file that changes over time that could interact with this script? Thanks in advance. mk Quote Link to comment
Pat Stanford Posted June 5, 2017 Share Posted June 5, 2017 Michael, Does your worksheet have any extra rows or columns or are they hard up against the edges? I had to modify my PIOFields script for 2017 to add some extra rows/columns to get it to run right. I was getting the same errors/warnings. When I paste your script into the ScriptEditor, Row 19 is the GetWSSelection line. I think there may be a bug. Try adding some space around your margins and see what happens. Quote Link to comment
michaelk Posted June 5, 2017 Author Share Posted June 5, 2017 Pat Not quite following. Add space around the margins of what? Quote Link to comment
Pat Stanford Posted June 5, 2017 Share Posted June 5, 2017 Make sure you have a couple of extra "blank" rows at the bottom after your data and a couple of extra columns at the right of the cells where you actually have data. Quote Link to comment
michaelk Posted June 5, 2017 Author Share Posted June 5, 2017 I get the error even if I only have one cell selected in the middle of the worksheet. Quote Link to comment
michaelk Posted June 5, 2017 Author Share Posted June 5, 2017 And why does is go away if I nuke my user folder? Quote Link to comment
Pat Stanford Posted June 5, 2017 Share Posted June 5, 2017 I don't know why it goes away. For me on VW2017 it errors immediately in a spreadsheet row. Runs properly on a database row. That tells me it has something to do with the SubRow returns an invalid value in the GetWSSelection call. Actually, I think I do know. It is a warning not an error. Therefore when you are running in Vectorscript Developer Mode (VW Preferenced, Session tab), it stops and displays the dialog. When you nuke the user folder, it turns off developer mode. You can either turn off developer mode when you are not actually developing, or you can be patient for a few months and see what happens. ;-) Quote Link to comment
michaelk Posted June 5, 2017 Author Share Posted June 5, 2017 Ach. Du hast rechts. Patiently being patient… Thanks, Pat! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.