Compare commits
6 Commits
2e26cd688f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5d6c645c4 | ||
|
|
24f5e143dd | ||
|
|
f2e0d00d03 | ||
|
|
37d787ce74 | ||
|
|
2cb5a4e505 | ||
|
|
7ae5096685 |
56
Make-FolderStruct.ps1
Normal file
56
Make-FolderStruct.ps1
Normal 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
|
||||||
|
|
||||||
|
#>
|
||||||
30
addBindings.jq
Normal file
30
addBindings.jq
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# Filter first
|
||||||
|
.
|
||||||
|
| debug("Filtering...")
|
||||||
|
| .tags[]
|
||||||
|
|= select(.typeId == $typeId)
|
||||||
|
# Sort first
|
||||||
|
| debug("Sorting...")
|
||||||
|
| walk( if type == "object" and has("tags") then .tags |= sort_by(.name) end )
|
||||||
|
# so object positions are predictable
|
||||||
|
# | 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
|
||||||
|
)
|
||||||
7
big_merge.ps1
Normal file
7
big_merge.ps1
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Write-Output "BIG MERGE!!"
|
||||||
|
Set-Content -Path "FTOptix_Combined.csv" "Location,Site,PLCName,SymbolName"
|
||||||
|
Get-ChildItem "FTOptix_Import*.csv" -Name | % {
|
||||||
|
Get-Content $_ |
|
||||||
|
Select -Skip 1 |
|
||||||
|
Add-Content -Path "FTOptix_Combined.csv"
|
||||||
|
}
|
||||||
4
countTypes.jq
Normal file
4
countTypes.jq
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
.
|
||||||
|
| .tags
|
||||||
|
| map(.typeId)
|
||||||
|
| unique
|
||||||
31
csv_merge.ps1
Normal file
31
csv_merge.ps1
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
$list =
|
||||||
|
"SCP_EG2102_15",
|
||||||
|
"SCP_EG2102_12_A11",
|
||||||
|
"SCP_EG2102_13_A21",
|
||||||
|
"SCP_EG2102_10_B11",
|
||||||
|
"SCP_EG2102_11_B21",
|
||||||
|
"SCP_EG2102_08_C11",
|
||||||
|
"SCP_EG2102_09_C21",
|
||||||
|
"SCP_EG2102_06_D11",
|
||||||
|
"SCP_EG2102_07_D21",
|
||||||
|
"SCP_EG2102_04_E11",
|
||||||
|
"SCP_EG2102_05_E21",
|
||||||
|
"SCP_EG2102_02_F11",
|
||||||
|
"SCP_EG2102_03_F21",
|
||||||
|
"SCP_EG2102_14_R11",
|
||||||
|
"SCP_EG2102_01_R21"
|
||||||
|
|
||||||
|
function Combine-Csv {
|
||||||
|
param (
|
||||||
|
$sufix
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-Output "Writing FTOptix_Combined_$sufix.csv"
|
||||||
|
Set-Content -Path "FTOptix_Combined_$sufix.csv" "Location,Site,PLCName,SymbolName"
|
||||||
|
Get-Content "./FTOptix_Combined.csv" |
|
||||||
|
where { $_ -match $sufix } |
|
||||||
|
add-content -Path "FTOptix_Combined_$sufix.csv"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Output "Writing to $($list.Count) files"
|
||||||
|
$list | foreach { Combine-Csv -sufix $_ }
|
||||||
13
dirmaker.bat
Normal file
13
dirmaker.bat
Normal 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
|
||||||
5
tag_sorter.jq
Normal file
5
tag_sorter.jq
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
walk(
|
||||||
|
if type == "object" and has("tags") then
|
||||||
|
.tags |= sort_by(.name)
|
||||||
|
end
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user