Sub Main not found

After some troubles in saving the project it stopped working.
Trying to trace what’s happening i found that the index.html is not pointing to the real Sub Main


in fact instead of going to the code.js containing my Main(), the program is going to appstudioFunctions.js, and the execution stops there


How to fix it?

There is a default Main() function in appstudioFunctions.js. It’s there for those who don’t define a Main() in their app.

Since chrome/browsers look at your app in sequence, the Main() defined in your app by you under project properties CODE, will always be after the above reference, and therefore executed, rather than the do nothing default. If you have such a Main(), then I’d would look at chrome inspector and see if your code.js file is there, is as expected, etc.

yes when the Main(); in the index.html is executed, the code.js is already loaded.
I 've also tried to remove the Main() in the appstudioFunctions.js and I get “Main is not defined” like my Main doesn’t exist

Are you sure you don’t have a Main() defined somewhere else that is after your intended Main(). Add a line in your intended main as 1st line that does a console.log or alert, and then from inspector console execute Main() and see if it logs/alerts. If not, you know you need to dig some more.

Actually, I missed the end of your post. Sounds like some malformed HTML or javascript. Do you have any files included? I strip them out first. Check the project properties CODE for any bad scripts before your main() definition. And check the CSS definitions to be sure they won’t cause a bad script tag. Lots of reasons this could happen.

a lot of files are included, but now i made other tests:

  • I have changed the name of my Main() to MainF() and I have edited the file index.html changing also there Main to MainF and the error is the same: MainF is not defined.
  • i moved < script src =“code.js” > before < / head> but same results

Definitely sounds like some bad HTML or javascript somewhere. It may be easier to create a new project and add your stuff one by one to see where it dies.

yes I’m hunting it…
there is an error in code.js (so in the program) because leaving in code.js only the sub Main it can be seen from index.html
If it is something interesting i will report the result soon.

i found the error: i wrote
If a=0 Then b=1
End If

i mean i put “b=1” on the same line of “if a=0 then” and for this i have lost half a day and disturbed you ;(
i found it by cutting pieces of code.js without touching the program till when i found the reason.

Glad you found it.