Powershell Befehle zur Umstellung auf sisNET CONNECT Edition

Wie gestern beim "sisNET CONNECT Update Meeting" angekündigt, 

die Powershell Befehle zum ersetzten der Funktionsaufrufe in Resource- und sisNET-Batchdateien (.r und .scr)

#Verzeichniss in dem sich die zu ändernden Dateien befinden
 cd d:\sis_data_ce\Powershell\
 #Befehle zum ersetzten der Funktionsaufrufe
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("mdlDialog_openMessageBox","OPENMESSAGEBOX")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("mdlDialog_openAlert","OPENMESSAGEBOX")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("mdlFence_fromShape","FENCEFROMOBJ")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("mdlRefFile_detach(-1)","REFDETACH('alle')")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("dgnBuf","dgnBuf()")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("mdlOutput_errorU","OUTPUT_ERROR")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("mdlOutput_messageU","OUTPUT_MESSAGE")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("mdlOutput_promptU","OUTPUT_PROMPT")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("mdlOutput_command","OUTPUT_COMMAND")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("mdlSystem_defineCfgVar","DEFINECFGVAR")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("usiP->id","UserGetId()")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("usiP->actSparte","UserGetSparteId()")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("usiP->user","UserGetName()")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("usiP->groupid","UserGetGroupId()")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("bliP->fid","FileInfoGetId()")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("bliP->ftyp","FileInfoGetType()")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("bliP->fullName","FileInfoGetFullName()")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("bliP->idx","FileInfoGetPoolId() ")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("mpiP->newP","PointsGetNew()")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("mpiP->oldP","PointsGetNew()")} | Set-Content $_}
 get-ChildItem *.r | Foreach-Object {Get-Content $_ | Out-String | Foreach-Object {$_.Replace("#include <rscdefs.h>","#include <Mstn\MdlApi\rscdefs.r.h>")} | Set-Content $_}

Für Batchdateien muss *.r in *.scr geändert werden.

Im Folgenden der Befehl zur Ersetzung von Variablen in *.*cfg Dateien. Bitte diese Befehle in dem Verzeichnis ausführen in dem die cfg Datein liegen.

$files = Get-ChildItem . *.*cfg -rec
foreach ($file in $files)
{
(Get-Content $file.PSPath) -replace "_USTN_SITE", "_USTN_ORGANIZATION" | Set-Content $file.PSPath
(Get-Content $file.PSPath) -replace "COMPRESS OPTIONS OFF LEVELS", "MS_COMPRESS_OPTIONS = -LEVELS" | Set-Content $file.PSPath
(Get-Content $file.PSPath) -replace "COMPRESS OPTIONS OFF LEVELTABLES ", "MS_COMPRESS_OPTIONS = -LEVELTABLES" | Set-Content $file.PSPath
}

Bitte beachten Sie, dass sich die Liste im Laufe der Zeit verändern kann und evtl. ergänzt werden muss. Die Informationen hierzu finden Sie in der Readme Datei der jeweiligen sisNET CONNECT Version.

  • Hallo Herr Klick,

    ich sehe, dass Sie bereits den Tippfehler "dgbBuf()" durch "dgnBuf()" korrigiert haben.

    Kann es sein, dass Ihnen noch ein Kopierfehler unterlaufen ist bei Replace("mpiP->oldP","PointsGetNew()")?

    Ich kann mir gut vorstellen, dass die neue Funktion "PointsGetOld()" heissen soll. Slight smile