Post by xxgeek on Oct 10, 2021 17:45:19 GMT
I was just playing around with some experimenting and tried a new concept, well new to me anyway.
It seems to be a good way to get right back in the game after a runtime crash. Was wondering if anyone else has done something like this, and or anyone cares to give opinions on Pro's and Con's of such a strategy.
The explanation....
I created a folder, added all the runtime support files (dll's, sll's jbrun2.exe, renamed the jbrun2.exe to the name of my app , created a TKN of my app > (0-NEWTEST.bas) appending the date to it.
Ok, so far?
Oh, and I put the original 0-NEWTEST.bas in the folder too, but edited it with the above code.
With it opened in JB IDE I created a situation to cause an error of type "file not found" when it Run's
The code above closed killed jbasic.exe and my Running app, then opened the EXE of my app, and away I went using that version instead of the original .bas file.
Now, since my app creates some files to read and write to, and and the exe was there to take over on a crash there was no problem continuing on as though nothing happened. The files load as usual, and I can read write to them as usual.
I can see there would be situations where this wouldn't work well.
Pro's? Con's?
Any thoughts, opinions or other ideas welcome.
The code
It seems to be a good way to get right back in the game after a runtime crash. Was wondering if anyone else has done something like this, and or anyone cares to give opinions on Pro's and Con's of such a strategy.
The explanation....
I created a folder, added all the runtime support files (dll's, sll's jbrun2.exe, renamed the jbrun2.exe to the name of my app , created a TKN of my app > (0-NEWTEST.bas) appending the date to it.
Ok, so far?
Oh, and I put the original 0-NEWTEST.bas in the folder too, but edited it with the above code.
With it opened in JB IDE I created a situation to cause an error of type "file not found" when it Run's
The code above closed killed jbasic.exe and my Running app, then opened the EXE of my app, and away I went using that version instead of the original .bas file.
Now, since my app creates some files to read and write to, and and the exe was there to take over on a crash there was no problem continuing on as though nothing happened. The files load as usual, and I can read write to them as usual.
I can see there would be situations where this wouldn't work well.
Pro's? Con's?
Any thoughts, opinions or other ideas welcome.
The code
on error goto [errorReport]
[errorReport]
notice "Some foolish programmer didn't code this right, and we've crashed, AGAIN"+chr$(13)+"Aborting mission, Starting backup app"
run "E:\Just Basic Testing\Projects\HelpLab\savedProjects\0-NEWTEST-2021-10-10\0-NEWTEST-2021-10-10.exe"
'or just DefaultDir$;"\";0-NEWTEST-2021-10-10.exe
run "taskkill /IM jbasic.exe /F", HIDE
run taskkill /IM htmlviewer.exe /F, HIDE ' this closes my opened offline html viewer windows too but it, not necessary