Execution of Export Script in Windows

Hi, I have the impression that my topic is a bug, but not 100% sure.
I’m trying to implement an Export Script in Windows 10, but it isn’t executed and an error.log file is generated.

First I had the impression that the error was because a space character in Path (“C:\BSS\Test Project\ExportScript.bat”). Error stating:

'C:\BSS' not recognized as internal or external command,
a executable program or an bat file.

As I changed the path exactly as in DOS (without spaces and wit 8 character name) and saved in Advanced as “C:\BSS\ExScript.bat”, the error changed
The error.log file states:

The system could not find the specified file.

Then I saved in Advanced as “ExScript.bat” (without complete path; only bat file), the error changed
The error.log file states:

Script ExScript.bat couldn't be run

The content of ExScript.bat for this test was only an @echo:

C:\BSS>type ExScript.bat
REM Teste de Script BSS
@echo Passo 1

C:\BSS>

I hope I have as much detail as possible in my attempts to help

Best regards

1 Like

If you happen to need a BSS to Django export script, I have an EXE available now from here:

It works AFAIK. I’m the maintainer now for the code and on the lookout for bugs / features (post to Issues forum on the code page on github).

Anyway, I also couldn’t get the shell script to run (a .sh from Windows 10) from the old export script repo that I forked. It’s very strange, perhaps you do need an EXE.

For converting Python to EXE I use auto-py-to-exe which comes with a GUI to set up the conversion. That’s how the above EXE is generated.

Sorry to be tangential to your problem, but there is a slight chance you’re also exporting to Django. If you feel like rewriting or need help rewriting your batch file in Python (regardless of whether you’re going to Django or not), I would be happy to help further, just ping me here or on Discussions on my github code page.

2 Likes

Hi fruitfulapproach,
thanks for you response.
I already saw your Django project, but I’m trying to use BSS with PHP. Django is not my objective.
Congratulations for your work.
I would like to make a comment to your response:
You wrote “I also couldn’t get the shell script to run (a .sh from Windows 10)”. In reality, bash files like sh extensions, will not work on Windows. This extension is not natural to Windows, although it seems to be possible by installing something. But it’s not the default for Windows.
On Windows the scripting language uses BAT files (originated from DOS) and also PowerShell.
My bug report is to report that the BAT scriptings do not execute. I used the samples given in Docs, who renames html to php. The BAT script runs perfect on Command Prompt, but gives errors when executed by BSS.
Best

1 Like

@carliedu yes, everything you said is true. However, I’m still not certain whether you know Python (enough for this task i.e.). If you recoded in a “real programming language” (not to say that Batch files are not, but that Python is much nicer for programming than batch files), then you could simultaneously target all platforms (for this simple task of file renaming), your coded can be extended or re-used by the community (or other coders in your work group), because for example, I could code this by heart in Python (without stackoverflow / googling) but for Batch I would have to look up how to do each thing, then there’s no natural Batch file debugger. I’m just so used to Python. Well, if you ever decide to switch it to Python, I can show you how to easily convert it to EXE (or other platform executables).

Anyway, my point is just that this is a good use case for Python and it’s natural (by now in the Python ecosystem) to target the executables on each platform. And also, I’m here to help with that if you do decide to go down that path. E.g. setting up Python environment, installing required libs, a good IDE, and finally coding the script and converting it to EXE.

:wink:

1 Like

I recreated your issue, but then tried things slightly differently and then it worked…

  1. Right-click your explorer window and click “New > Text Document” and rename it to Test1.bat.
  2. Right-click > Edit the file with a text editor and paste in:
@echo off
echo This is a test> test.txt
echo 123>> test.txt
echo 245.67>> test.txt
  1. Delete the old error.log in your BSS export destination.
  2. Select “Browse” (this might be needed instead of pasting in location) on the Advanced > Export Script field. Browse to Test1.bat and click OK.
  3. Save your settings, and make sure the BSS design is saved.
  4. Click export.

I find that error.log is not even generated, and the output directory for test1.txt would be for me:
“C:\Users\FruitfulApproach\AppData\Local\Programs\bstudio\test1.txt”

which I got to by right-clicking the BSS app’s taskbar icon, then Properties > Open File Location.

So I did reproduce your error, but then I didn’t. I would say keep trying and you might make it work just by some random thing we did that we can’t pinpoint right now. :slight_smile:

1 Like

fruitfulapproach, thanks for your tip.
Really I have heard a lot about Python, but never interested me for it.
I promise, as soon as I have a break, I’ll study Phyton. Time, in development, is always short for everything. It is difficult to prioritize what most needs to be known.
I’m already retired and my hobby is programming. Amazingly, my day is busier today than when I was working. Today I’m free, I don’t depend on a boss telling me to do something I don’t care about. Since I retired, I’ve learned more than when I was working. But even so there is no time for everything.
For this thread, I hope to help resolve an “apparent” bug, which will definitely hinder other developers.
I think the biggest problem is not the script, but finding a way to allow the integration of BSS with code in any language. The examples in the BSS, which call themselves fully functional, are far from functional. I haven’t seen an example with database integration. This cannot be called functional.
Iwill try try to find a way to help BSS developers be able to actually provide fully functional examples.
Best

1 Like

I cannot do it now, but I noticed that the path you used (“C:\Users\FruitfulApproach\AppData\Local\Programs\bstudio\test1.txt”) has no space characters, as is normal in Windows.

1 Like

So I was having the same issue with BSS 6.01 and Windows 10.

No amount of escaping the spaces in the filename path would work. Not sure if this is due to spaces or windows long filenames.

What I did find worked was to convert the full path into DOS 8.3 format. When I do this, a regular windows .bat file runs properly.

In the original example above of C:\BSS\Test Project\ExportScript.bat - this fails. Long filenames and a space in it.

Instead in BSS Export script, put the dos path of C:\BSS\TESTPR~1\ExportScript.bat - this works.

I found online an easy way to get DOS path is

  • from Windows Explorer, navigate to the folder with your bat file in it & copy the address of the folder
  • Open Command Prompt (press start and type in cmd)
  • Issue command - cd Ctrl+V to paste your copied folder address
  • Copy & paste this into command prompt - cmd /c for %A in ("%cd%") do @echo %~sA
  • The DOS path is displayed.
  • Right Click, select all, then with mouse highlight the DOS URL only and Ctrl+C to copy
  • Paste that into BSS Export Script with your bat file appended to the end of it.

The script should run when you export. Shame it doesn’t run the script when you publish instead of just exporting.

I hope this helps someone else as it was frustrating me too.