Compare commits

...

3 Commits

Author SHA1 Message Date
Javier Quinones
c5d6c645c4 Added parameters to __addBindings.jq__ 2026-08-25 17:30:30 -05:00
Javier Quinones
24f5e143dd Added a filtering step on __addBindings.jq__ 2026-08-17 15:27:03 -05:00
Javier Quinones
f2e0d00d03 Script to create the folder structure used in broadband 2026-08-17 10:57:55 -05:00
3 changed files with 93 additions and 17 deletions

56
Make-FolderStruct.ps1 Normal file
View File

@@ -0,0 +1,56 @@
<#
.SYNOPSIS
This script creates a folder structure under $FolderName
.DESCRIPTION
This script creates a folder with a set of different sub-folders in it.
The parent folder is created under the $Path defined.
.PARAMETER $Path
The path where the main folder will be created.
.PARAMETER $FolderName
The name of the parent folder. Default is "New Folder"
.EXAMPLE
The example below creates the folder "Example" in the main drive.
PS C:\> dir-maker -Path C:\
.NOTES
Author: JQQ
Last Edit: 2022-11-22
Version 1.0 - initial release
#>
# Parameters
[CmdletBinding()]
param(
#Root Path
[Parameter(Mandatory=$True)]
[string]$Path,
#Parent Folder Name
[string]$FolderName = "New Folder"
);
# Variables
[string]$ParentFolder = $Path + $FolderName;
[string[]]$FolderList = @("\Alarms"
,"\GFX"
,"\Historian"
,"\PLC"
,"\Simulation"
);
# Main
Write-Verbose("Creating parent folder " + $ParentFolder);
ForEach ($Folder in $FolderList) {
New-Item -Path ($ParentFolder + $Folder) -ItemType Directory;
};
<#
.NAME
Make-Structure
#>

View File

@@ -1,23 +1,30 @@
# Filter first
.
| debug("Filtering...")
| .tags[]
|= select(.typeId == $typeId)
# Sort first
| walk(
if type == "object" and has("tags") then
.tags |= sort_by(.name)
end
)
| debug("Sorting...")
| walk( if type == "object" and has("tags") then .tags |= sort_by(.name) end )
# so object positions are predictable
| .tags[3].tags[1].tags as $baseData
| walk(
# Removes .Tags.Controller Tags from the plcName parameter
if type == "object" and has("plcName") then
.plcName.value |= rtrimstr(".Tags.Controller Tags")
elif type == "object" and has("plcname") then
.plcname.value |= rtrimstr(".Tags.Controller Tags")
end
)
# and can be used as the base line to setup the other objects
| walk(
if type == "object" and .name? == "Data" then
.tags = $baseData
# | 2 as $pos
| .tags[0].tags[$pos].tags as $baseData
| debug("Modifying tags...")
| .tags
|= map(
.
| if .parameters.plcName.value then
.parameters.plcName.value |= rtrimstr(".Tags.Controller Tags")
elif .parameters.plcname.value then
.parameters.plcname.value |= rtrimstr(".Tags.Controller Tags")
end
| if .tags
and .tags[$pos].name == "Data"
and .tags[$pos].tagType == "Folder"
then
.tags[$pos].tags |= $baseData
else
.
| debug("Data folder not found")
end
)

13
dirmaker.bat Normal file
View File

@@ -0,0 +1,13 @@
@echo off
IF [%1]==[] (
echo Missing Parameter
exit /b 1
)
mkdir %1\PLC
mkdir %1\GFX
mkdir %1\Alarms
mkdir %1\Simulation
mkdir %1\Historian
mkdir %1\Redlion
mkdir "%1\PlantPAX ConfigTools"
echo Created folder %1 with subfolders