Wesley Burrows Posted August 21, 2017 Share Posted August 21, 2017 (edited) I'm trying to write a script that will update the P_Revision Number field on my custom title block + 1 of the current value. I have the below, but everytime I try to read the record it only returns 0. The default value of the revision field is 1. Procedure Update_Rev; VAR current_rev :INTEGER; new_rev :INTEGER; hd: HANDLE; Begin current_rev:=Str2Num(GetRField(hd,'Vista Title Block','P_Revision Number')); new_rev:=current_rev + 1; SetRField(FSActLayer,'Vista Title Block','P_Revision Number',Num2Str(0,new_rev)); End; {---------------------------------------------------------------------------------------} Run(Update_Rev); What am I missing? Record format for Title Block attached. Edited August 21, 2017 by Wes Burrows spelling and clarification. Quote Link to comment
Wesley Burrows Posted August 21, 2017 Author Share Posted August 21, 2017 (edited) Ok, well i fixed it by changing the GetRField Handle to FsActLayer. Now I just need to figure out how to get the script to select anything with the title block "Vista Title Block" record. So I don't have to select the sheet border or anything for it to work. I also want to get it to update it across all sheets. Even though I'm updating "P_Revision Number" It only updates on the currently selected sheet. Thoughts? Procedure Update_Rev; VAR current_rev :INTEGER; new_rev :INTEGER; hd: HANDLE; Begin current_rev:=Str2Num(GetRField(FSActLayer,'Vista Title Block','P_Revision Number')); new_rev:=current_rev + 1; SetRField(FSActLayer,'Vista Title Block','P_Revision Number',Num2Str(0,new_rev)); End; {---------------------------------------------------------------------------------------} Run(Update_Rev); Edited August 21, 2017 by Wes Burrows spelling Quote Link to comment
JBenghiat Posted August 21, 2017 Share Posted August 21, 2017 Look at ForEachObject(). You specify a search criteria and a function to act on each found handle. -Josh Quote Link to comment
Wesley Burrows Posted August 22, 2017 Author Share Posted August 22, 2017 Thanks Josh! Got it working! Had to figure how to use the search criteria. Couldn't find any Doc's, but I did find the "Custom Selection" tool in VW and used that to generate it. Worked fine, didn't know if that was the "right" way or just a way. -Wes Quote Link to comment
JBenghiat Posted August 22, 2017 Share Posted August 22, 2017 The VectorScript editor has a button at the top-left for creating and inserting criteria, but there's nothing wrong with your menthod. You can find find documentation in the VectorScript Language Guide, which you can access through the help system. -Josh 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.