RunScript -> Folder must exist to iterate

Mac
Xojo 2202 R 1.1

I created a xojo_script which seemed to run in the past but now I am having a problem. I am trying to get one xojo_script in the Scripts folder to run another xojo_script in that same folder. The command for this is RunScript. I believe in the past I have not had trouble with this.

From the documentation for RunScript:

RunScript(scriptName As String)

Runs the passed script, found in the Scripts folder, either next to the IDE or next to the frontmost project file.

RunScript("CommentScript")

The error I get is at a line of code in the script which is asking another xojo_script in the same folder to run. The error message is:

Unhandled IOException in XojoScript on line 0.
Folder must exist to iterate

For debugging purposes, I have reduced the calling xojo_script to a single line

RunScript(“FormatCode.xojo_script”)

FormatCode.xojo_script is another xojo_script in the same folder with the test code that is trying to get it to run. When I ask the calling xojo_script to run, I get the error. When I call FormatCode directly, I do not get an error.

For debugging, I have reduced my code in the calling xojo_script to just one line. The error persists.

Have you tried to pass the whole path instead of just the name of the file ?

Also, could it be possible that you are using a more recent version of macOS such as Monterey which for security reasons would prevent access to the /Applications folder ?

Thanks for the suggestions.

I have this problem on two machines: old running Mojave and a new one running Monterrey.

The full path name did not alter the situation.

Seeing as there are now multiple places that Xojo Scripts can be placed, this may just be an IDE bug.

In a folder named Scripts in one of these locations:

  • Next to the IDE itself - IDE Specific
  • Next to the project itself - Project Specific
  • In ~/Documents/Xojo/IDE/Scripts/ - User Specific

The last one was added in the last few years and is where I put most of my scripts these days because they just automagically appear when a new version is installed.

FWIW, recent versions of Xojo should also follow Windows shortcuts within the Scripts folders.

1 Like

I very grateful for your pointing me to this solution. This solves a very vexing problem for me. I was unaware of the ability to place the Scripts folder in locations other than IDE Specific. It is in that location that I was having this weird problem of Folder must exist to iterate.

I moved the Scripts to — ~/Documents/Xojo/IDE/Scripts/ — and now things work perfectly. As you point out, this provides the additional advantage of not having to deal with Scripts every time a new version of Xojo is deployed on my machines. Now that you have brought this to my attention, I tried to find the ability to use this alternate location in the Documentation and failed.

Apparently, this was simply a bug.