' ********************************************************* ' *** ANALYZE A NON COMPRESSED LOCAL VRML FILE FOR URLs *** ' ********************************************************* ' written in: Just BASIC v1.01 ' free download from: http://www.justbasic.com/ ' download size: 2.4 mb ' author: Simon Wheaton-Smith ' date: Nov 23, 2005 ' ' objective: ' When building vrml worlds with Parallel Graphics program ISB and doing a ' PUBLISH command, sometimes the ISB sayz something like "disk may be full" ' this means that either the disk is full, or, that a url reference was not ' found. Those url references may be TEXTURES and for whatever reason they ' may get screwed up. ' ' So, this reads the entire ISB .wrl file, which must not be compressed, and ' assumes references urls are in the same directory, and assumes the format ' seen in the published file, anamely [url "x.jpg"] or it could be [url "x.jpg"], ' and saves those url references in a list. Then at end of file, the list is ' run and each url tested for existance, if not found then an error message is shown. ' ' vrml: ' Parallel Grahpics ISB builds vrml files which can be viewed by the Cortona plugin ' ISB is located at: http://www.parallelgraphics.com/products/isb/ ' Cortona is located at: http://www.parallelgraphics.com/products/cortona/ ' ' Run time program: ' In Just Basic this program is saved as a TKN file RUN, MAKE *.TKN FILE ' Then ' Copy JBRUN101.EXE to be vrmlcheck.exe ' copy these files also... ' vbas31w.sll vgui31w.sll voflr31w.sll vthk31w.dll ' vtk1631w.dll vtk3231w.dll vvm31w.dll vvmt31w.dll ' run vrmlcheck.exe which looks for vrmlcheck.tkn ' ' ******************************** ' *** BUILD PROGRAM PARAMETERS *** ' ******************************** ' DefaultDir$ = "c:\Illustrating Shadows\WRL - vrml files\VRML world of sundials" ' DefaultDir$ ' is initialized for folder program run in maxurl = 400 ' number of elements in the url table z$ = "url" + " " + chr$(34) ' search string to find urls e$ = "*****" ' end marker for url list f = 900000 ' max records in a file we will search ' ******************************** ' *** STATE PROGRAM PARAMETERS *** ' ******************************** print "===========================" print "default directory is..." ' state the default directory print DefaultDir$ ' state the default directory print "file MUST NOT be condensed" ' criteria for file is simple ascii print "file must be PUBLISHED" ' criteria is so url's will be local print "all referenced files must be in the same directory" ' criteria is localized directory search print "max url references is ",maxurl print "==========================" ' ********************************************** ' *** REQUEST FILE NAME AND SEE IF IT EXISTS *** ' ********************************************** [phase1] print "This program must be in the directory holding the desired file." dim desiredfilenameinfo$(1, 1) ' required format for the "files" command prompt "Please enter desired file name."; desiredfilename$ ' ask for local file name files DefaultDir$, desiredfilename$, desiredfilenameinfo$( ' get file info on this desired file if val(desiredfilenameinfo$(0, 0)) > 0 then ' did the file exist Print "file " + desiredfilename$ + " exists" ' yes it did so normal advisoty else notice "file " + desiredfilename$ + " doesn't exist" ' no say say so with a window and Print "file " + desiredfilename$ + " doesn't exist" ' also with a normal advisory end if if val(desiredfilenameinfo$(0,0)) = 0 then goto [phase1] ' if not found ask again ' ******************************* ' *** FILE EXISTS, SO OPEN IT *** ' ******************************* [phase2] print "===========================" dim urllist$(maxurl) ' allow 400 or whatever local url references for urlno = 0 to maxurl-1 step 1 ' preformat the url list with 5 asterisks or something urllist$(i) = e$ ' for future reference next urlno urlno = 0 ' set url table pointer to start open desiredfilename$ for input as #f ' now open the file ' ***************************** ' *** READ AND DISPLAY FILE *** ' ***************************** [phase3] for i = 1 to f step 1 ' max file size input #f, arec$ ' get one record if eof(#f) = -1 then [endSeries] ' if end of file then close and go to next phase ' print arec$ if left$(arec$, 13) = "# Faces total" then [goodfileend] ' if end of file then close and go to next phase if left$(arec$, 17) = "# Facesets total:" then [goodfileend] ' *** search for keyword url if len(arec$) > len(z$)+6 then ' if record is long enough to hold a url reference ' len(z$) = 5 [url "] and the 6 is [a.jpg"] for j = 1 to len(arec$) step 1 if mid$(arec$, j, len(z$)) = z$ then ' is this a [url "] record? urllist$(urlno) = mid$( arec$, j+5, len(arec$)-(j+5) ) ' if so, add to url list and urlno = urlno + 1 ' bump the pointer end if next j end if next i goto [endseries] [goodfileend] print "ISB end of file marker found" ' ****************** ' *** CLOSE FILE *** ' ****************** [endSeries] print "records searched: ", i close #f ' close the file so windows doesn't get upset print " " ' ************************* ' *** analyze urls list *** ' ************************* print "The following urls were used in the vrml file" if urlno = 0 then goto [shutdown] ' if no urls then exit for i=0 to urlno step 1 ' otherwise print " " + urllist$(i) ' list the urls - yes we don't check for duplicates next i print "===========================" print "The following urls were not located - they may be a problem" for i=0 to urlno step 1 ' then run the list and look for file references if urllist$(i) = e$ then goto [shutdown] ' stop if end of url list marker found ' ******************************************************************************************** if len(urllist$(i)) > 0 then ' skip url table entries of zero if left$(urllist$(i),10) <> "vrmlscript" then files DefaultDir$, urllist$(i), desiredfilenameinfo$( ' otherwise see if the file exists if val (desiredfilenameinfo$(0, 0)) = 0 then ' if file info length is zero print " " + urllist$(i) ' say doesnt exist end if end if end if ' ******************************************************************************************** next i ' ******************* ' *** we are done *** ' ******************* [shutdown] print "*******" print "* end *" print "*******" print "hit enter to close this window" input x$ end