|
Post by Psycho on Mar 31, 2009 21:43:29 GMT -5
When using a subroutine to open a file preceded by ResourcesRoot$, the program works the first time the sub is called but the second time it forgets what the ResourcesRoot$ is.
Example: sub opentestfile open ResourcesRoot$+"\folder\test.txt" for input as #test line input #test, somevariable$ close #test end sub
When including a debug line to print ResourcesRoot$+"\folder\test.txt" during execution I get the following results:
1st pass - c:\rbp101\public\folder\test.txt
2nd pass - \folder\test.txt
and the program errors out with a "Specified pathname does not exist" error.
John "Psycho" Siejkowski
|
|
|
Post by Psycho on Apr 1, 2009 19:46:03 GMT -5
To clarify the problem better, I've discovered this affects several of the global variables. In trying to re-create it with a small piece of code, I've found it only occurs when the sub being called runs an external program (although the global variables are lost in the parent program). If you publish the "counter" program that comes with RB, you can duplicate the problem with the following program. Note that all the global variables display correctly the first time you press a link but most are lost the next time you invoke the sub. call setCSS dim globaltest$(0,2) globaltest$(0,0)="1" globaltest$(0,1)="2" globaltest$(0,2)="3" table #test,globaltest$() #test columnnames(" Number ") #test caption("Test") #test link("Number","testglobal") render #test wait
sub testglobal key$ print key$ print DefaultDir$ + key$ print Platform$ + key$ print UserInfo$ + key$ print UrlKeys$ + key$ print UserAddress$ + key$ print ProjectsRoot$ + key$ print ResourcesRoot$ + key$ print Err$ + key$ print EventKey$ print run "counter", #displaydies render #displaydies end sub
sub setCSS cssclass "caption","{ color: white; background:#0000FF; font-family:times; font-size:12pt; Font-Weight: Bold }" cssclass "columnnames","{ color:black; background:white; font-family:times; font-size:12pt }" cssclass "table","{ border: 3px ridge #DDF; border-spacing: 4px}" cssclass "tr","{ background: #FFCC66; Color: Blue}" cssclass "td", "{ Text-Align: Center; font-family:times; font-size:12pt; Font-Weight: Bold }" cssclass "span.row-odd tr", "{ font-weight: bold; background: #FF9933; Color: Black }" cssclass "span.row-even tr", "{font-weight: bold; background: #EEE8AA }" end sub John "Psycho" Siejkowski
|
|