Better Export Functionality [added in 2.4.2]

I gave Bash as an example, as this is the most basic way of scripting things on Linux and macOS. Windows doesn't have bash installed, so you will need to write scripts using a different language. You can write scripts using CMD.exe (called Batch files). Here is an example. They have different commands and syntax than the code I wrote above. Another built-in alternative is PowerShell, but I don't have experience with it.

Ok so after several attempts on figuring out some powershell and or .bat usage, I find that I am limited based on security being able to run scripts on my work system. I tried running a .bat file that would execute a .ps1 file and would get security errors.

So I'm not going to go into how to subvert your windows OS security just to allow running these scripts as the potential danger and risk to making a very powerful tool automated and leaving your PC vulnerable.

So I have come away with doing this for me in win10 and using powershell. For now I won't use the Advanced part of the export function of the BSS app.

Click start and for win10 just start typing in powershell, select "Windows Powershell" from the list. I right clicked it and pinned it to the task bar so I can launch it from there.

In powershell I'm going to use the following command (I haven't figured out the method to change directories and execute this in a single process)

Get-ChildItem -Filter "*.html" -Recurse | Rename-Item -NewName {$_.name -replace 'html','shtml'}

This command generally does the following based on how I understand it.

  1. Get all child elements with the file name .html [the asterisks is a wildcard character meaning any/all files with the ".html" extension]
  2. Recurse - find all files from with in the root AND sub folders, root is the current folder that powershell has as the command line
  3. Rename some items with a new name
  4. Replacing the [first value] with the [second value]

So you will need to use DOS/batch style commands to get to the appropriate directory in order to execute it.

If you are exporting to a network drive, it will be easiest to MAP the network drive first. Preferably the folder that is the root for your export. I will use "T:\bss_export" for example.

Once you start Powershell it most likely starts with the command line of PS C:\Users\[your username]

Using the networked drive example

  1. type in cd "T:" (hit enter) (I mapped my network drive to T)
  2. if it's a subfolder type in cd "bss_export" (hit enter) (I had a subfolder for test)

The Powershell commandline would look something like this for me PS T:\bss_export

If like me I need to change all the .html exported extension to .shtml then copy/paste in this command and hit enter

Get-ChildItem -Filter "*.html" -Recurse | Rename-Item -NewName {$_.name -replace 'html','shtml'}

For people that need to switch some of your files to .php then I think this would do for you. Before you export, rename the files you want to be php files by including "_php" in the file name before the .extension

So that you could then use these 2 commands.

Get-ChildItem -Filter "*_php*" -Recurse | Rename-Item -NewName {$_.name -replace 'html','php'}

Get-ChildItem -Filter "*.php" -Recurse | Rename-Item -NewName {$_.name -replace '_php',''}

First command will rename files that contain _php in the name it will rename it to a .php file then the second command will find those .php files and rename the file by removing the _php wording in the file name.

A Big thing here is that this does not replace/overwrite existing files.

I haven't figured out a way for that.

You could try the following below but I think I will export to a holding area rename the files like above and then move them where I need them.

<hr />

I could use these 2 commands to work around that BUT I would have to be sure that any editing is done in the BSS app not after because this will delete the old file.

Make my edits in the BSS app not outside it then export then run powershell etc and run this command to remove all files.

Get-ChildItem *.shtml -Recurse | Remove-Item

Then I could run this to get back to the correct file .extension

Get-ChildItem -Filter "*.html" -Recurse | Rename-Item -NewName {$_.name -replace 'html','shtml'}

I'll look into .bat file commands and see what I can up with for that.

Saj

Hi Saj,

take Linux... then you will have less problems. (e.g. www.linuxmint.com (its an Ubuntu and Debian System and easy to use))

I quit with MS at the point of Windows 8. With Windows 10 and all its System integrated Spyware my hole company stops any MS-Support.

Take Linuxmint, with an VirtualBox (www.virtualbox.org) running Window7 and Comodo Internetsecurity on it. Then you can run some special Windows-Software if this not available in Linux.

I am trying to make an Linux-Script for the things you need, because I need them, too, but I need some time before its ready to share

Thanks Frank,

Unfortunately it's a work PC and totally out of my control for most things like that. It's not a problem for me to export in a staging area of sorts because I still need to do a bunch of post editing as it is anyways with all the snippets I need to make and putting in programming tags etc...

I do appreciate all the info though :)

Saj

+1 to Franks comment. This is biting me often as I have numerous projects and they each have their own export location.

My post didn't show up where I thought it would. I was also voting for the ability to have the export destination be a project-level setting rather than a a global setting across all projects.

Hiya Jeff0401,

Project specific export settings have already been added to the app. Click the button and if you do not have a location set up it will ask you for one. That will happen for each project. Enjoy! :)

For those having difficulty in running .bat files as export script in windows I would recommend (as an alternative among other possible solutions) to write a simple python script like this:

import os import sys nwd=sys.argv[1] os.chdir(nwd) os.system('copy index.html index.php')

and make this python script an executable (.exe) file with py2exe as explained here py to exe in windows It worked quite fine in my system (win 7).

windows: create new file : ren.bat xcopy *.html *.php /y

To execute python script via Windows just put this line in BATCH file (*.bat) C:\path_to_python_directory\python.exe \full_path_to_your_script\

And it works, i don`t know why, but it do.

@eczo86

You can just put your python script in the same folder as your export folder and then create a batch file to run it.

Set export script link in Bootstrap Studio to the batch file in the same folder that has:

@echo off cd %1 pythonscript.py

This lets you edit the python script and not have to make a ".exe".

Beautiful Soup Html Parsing on the way...Nice