'EXPORTS CONTENTS OF A VTAB TO A WINBUGS1.4 COMPATIBLE DATA FILE 'TO BE LAUNCHED FROM THE TABLE DOCUMENT 'LOADING SCRIPTS ' 1. Double-click on an empty area on the bar containing all buttons, The "Customize" dialog appears ' 2. In the "Type" pull-down, select "View" ' 3. In the "Category" pull-down, select "Buttons", The display right below the pull down changes to show an array of buttons ' 4. Slide the scrollbar (below the button display) to the right and select the last button by clicking on it, Now click on "New" ' 5. A new blank button appears. Double-click on the blank area to the right of the entry "Click" (just below the button display) ' 6. The "Script Manager" Dialog appears, Click on "New", Enter any name in the input box that appears (prefix it with "Z_" so that it goes in the last) ' 7. A new blank script document (With the name just specified) appears. Delete whatever is on it... ' 8. Either copy-paste this ENTIRE script on the document, or, click on the button with the open-folder icon (tooltip reads "Load text file") and navigate to this file ' 9. Either done, click on the button with the tick-mark icon ("compile"). If spatial analyst is not loaded, there will be some error message, Load it ' 10. After the script is compiled (the tick-mark buton should be grayed out), close the script window and return to the view ' 11. Click on the new button to run the script theTable=av.GetActiveDoc theVtab=theTable.GetVtab aFN=FileDialog.Put("Name.txt".AsFileName,"*.txt","Select output location") aLF=LineFile.Make(aFN,#FILE_PERM_WRITE) tmpList={} OldFields=TheVtab.GetFields TheFields={} for each f in OldFields if (f.GetName<>"Shape") then TheFields.Add(f) end end aLF.SetPos(0) aLF.WriteELT("list(") ctr=1 Nctr=0 for each f in theFields aLF.SetPos(ctr) for each rec in TheVtab Nctr=Nctr+1 val=TheVtab.ReturnValue(f,rec) tmpList.Add(Val) end ValString="" for each t in tmpList N=tmplist.count ValString=ValString+t.AsString+"," end WriteString=f.GetName++"= c("+ValString+")," NewString=WriteString.Substitute(",)",")") aLF.WriteELT(NewString) ctr=ctr+1 tmpList={} end aLF.WriteELT("N="+(N).AsString+")") aLF.Close