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.

Had the same problem. Using BBS for the first time, and does not allow spaces in the directory name. In Windows 10 OS, spaces are allowed in the directory name. To reference these I tried putting these in “C:\Server\websites\Workspace Cloud Backup\WebSites\mysite”. This also failed, as it does not recognise the “” for a directory.

I solved this by create a temporary directory “c:\webtemp\proj1” and using this to export too. I added a batch file in this directory that:
a) renames all my .html to .php
b) copies these to the correct publication directory

Help: Does anyone know how to run a batch command to find and replace the links within each .html document to correct the directory, and also change the link name from .html to .php?

If I find some way, I will let you know…I have to fix this to be able to edit multiple PHP based projects.

Solved the php rename challenge:
I created two batch files, the first called by BBS, and the second called by the first batch file.
First batch files copies all my .html files to .php, and then deletes all my .html
Batch_export.bat
@echo off
cd %1
xcopy *.html *.php /y
del .html /S /Q
FOR %%v in (
.php) DO (call replace.bat “%%v”)

The second batch scans the contents of each file and replaces any .html to .php.
replace.bat
powershell -Command “(gc %1) -replace ‘.html’, ‘.php’ | Out-File -encoding ASCII %1”

Please note that the -encoding may need to be changed to support the accent characters to any of the following:

  • ascii: Uses the encoding for the ASCII (7-bit) character set.
  • bigendianunicode: Encodes in UTF-16 format using the big-endian byte order.
  • bigendianutf32: Encodes in UTF-32 format using the big-endian byte order.
  • oem: Uses the default encoding for MS-DOS and console programs.
  • unicode: Encodes in UTF-16 format using the little-endian byte order.
  • utf7: Encodes in UTF-7 format.
  • utf8: Encodes in UTF-8 format.
  • utf8BOM: Encodes in UTF-8 format with Byte Order Mark (BOM)
  • utf8NoBOM: Encodes in UTF-8 format without Byte Order Mark (BOM)
  • utf32: Encodes in UTF-32 format.

Hope this help.

Additional Change to script - Sorry:
powershell -Command “(gc %1) -replace ‘****.html’, ‘.php’ | Out-File -encoding ASCII %1”

You have to include add a “” as “.” for the replace function as “.”/Dot means any character.