m i d - a m e r i c a c a d d c o m m u n i t y c o...

32
MID-AMERICA CADD COMMUNITY CONFERENCE Using Unsupported Applications in ProjectWise Mike Dillner Software Specialist [email protected] (785) 233-8300

Upload: others

Post on 20-Mar-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

M I D - A M E R I C A C A D D C O M M U N I T Y C O N F E R E N C E

Using Unsupported Applications in ProjectWise

Mike Dillner

Software Specialist

[email protected]

(785) 233-8300

About Me

► Software Specialist with PEC

▪ Little over a year

► IT / CADD Support with KS Department of Transportation

▪ 7 of 15 years with KDOT

About Professional Engineering Consultants PA (PEC)

► Formed in 1965

► Full service, multi-discipline firm

► More than 300 professionals in seven offices▪ Wichita

▪ Topeka

▪ Lawrence

▪ Pittsburg

▪ Tulsa

▪ Oklahoma City

▪ Fort Collins

About Professional Engineering Consultants PA (PEC)

► Facilities

Mechanical | Electrical | Structural | Telecommunications | Energy

► Civil

Transportation | Municipal Services | Water/Wastewater | Land Development

► Field Services

Survey | Geotechnical | Materials Testing and Inspection | Commissioning

Air and Water Balance | 3D Scanning

Using Unsupported Applications in ProjectWise

► Based on Bentley Communities Post:

▪ https://communities.bentley.com/products/projectwise/content_management/f/content-management-

forum/125219/unintegrated-third-party-software-workflows

▪ Good reference for the concepts presented here

▪ Resource and reference links

▪ Covers .bat file syntax not presented today

▪ Proof-of-concept only – use at your own risk

Using Unsupported Applications in ProjectWise

► The Problem: Applications that spawn additional files through normal use that ProjectWise does not track

▪ HEC-RAS

▪ OneNote

▪ Etc.

HEC-RAS Example – What Happens

► User dumps HEC-RAS project (.prj) into ProjectWise

► Appears to work fine

► Numerous untracked files in DMS directory

► High potential for lost work

HEC-RAS Example – What can we do?

► Keep the data outside of ProjectWise?

+ Least amount of work for users

- Manage server location & independent access rights

- Potential for abuse

- Unavailable outside organization

HEC-RAS Example – What can we do?

► Folder Managed Export?

+ Available outside organization

+ Keeps all files in ProjectWise

- Additional work to export / import

- Any new files left after import need manually imported

- Allows uneducated users to use files without exporting and potentially lose work

HEC-RAS Example – What can we do?

► Flat Set Managed Export?

+ Available outside organization

+ Keeps all files in ProjectWise

- Additional work to export / import

- Any new files left after import need manually imported AND added to flat set

- Allows uneducated users to use files without exporting and potentially lose work

HEC-RAS Example – What can we do?

► Zip Managed Export?

+ Available outside organization

+ No accidental misuse within ProjectWise

+ One document to manage within ProjectWise

- Additional work to export / import

- Requires user to unzip the files after export, and zip them up before import - keeping the .zip name identical

- Potential issues if users attempt to use the files without unzipping them first

HEC-RAS Example – What can we do?

► Another solution?

+ No additional work for users

+ Available outside organization

+ No accidental misuse within ProjectWise

+ One document to manage within ProjectWise

- Some assembly required

HecZip Solution – Workflow Overview

Passes the script location,

version string, and file location

Passes the version

string, and file location

2. Passes

extracted

.prj location

Opens .prj file and

Spawns additional

files through use

3. Calls for

compression

of files1. Calls for

extraction

of files

Extract filesExtract files

Compress

files

File

and logic

al set m

em

bers

copie

d o

ut on o

pen

File

checked b

ack in

to P

roje

ctW

ise

ProjectWise

HecZip File

Application

Entry

wscript.exe

VBScript File

HEC-RAS

Application

Zip Utility

HEC-RAS

Files

Local HecZip

File

HecZip Solution - Warnings

► Relies on consistent DMS directory

▪ Restrict users from altering DMS directory

► Application version specific

► Assumes default application install directory

► Example code only – Use at your own risk

HecZip Solution – Template Document

► Zip File with custom extension - .HecZip

▪ Contains only empty HEC-RAS project: HEC-RAS.prj

► Uses “HecZip [version] Handler” application entry

► Parent document in logical set

▪ VBScript and zip utility child documents

HecZip Solution – Utility Files

► 7za.exe – Free open source command line zip utility

▪ http://www.7-zip.org/download.html

► HecZip.vbs – VBScript that controls:

▪ .HecZip Extraction / Compression

▪ Launching HEC-RAS application

HecZip Solution – Application Entry

► Program executable Path:

▪ %SystemRoot%\System32\wscript.exe

► Command line arguments:

▪ "C:\bms\pwe101-02\$USER.NAME$\dms06702\HecZip.vbs" "5.0.1"

► Command line that will be used to start application:

▪ C:\Windows\System32\wscript.exe "C:\bms\pwe101-02\Mike.Dillner\dms06702\HecZip.vbs" "5.0.1" "%1"

HecZip Solution – Application Entry

► Argument 1: "C:\bms\pwe101-02\$USER.NAME$\dms06702\HecZip.vbs"

▪ Starts with DMS root as defined in Users Properties

▪ Ends with DMS directory of VBScript file

HecZip Solution – Application Entry

► Argument 2: "5.0.1"

▪ Version string

▪ Used to construct path to HEC-RAS executable

▪ Avoid multiple scripts for each version

► Argument 3: "%1"

▪ Automatically appended by ProjectWise Administrator

▪ Represents the local full path to the file the user clicked on

▪ e.g. “C:\bms\pwe101-02\_test.user\dms06703\HEC-RAS 5.0.1 Template.HecZip”

HecZip Solution – Script Contents

HecZip Solution – Script Contents

HecZip Solution – Script Contents

HecZip Solution – Logical Set Creation

► How do we know Utility Files exist locally?

▪ Flat Set?

▪ Managed Workspace?

▪ Logical Set?

HecZip Solution – Logical Set Creation

► Create Placeholder DGNs

▪ Name similar to HecZip Template & Utility files

► Create Logical Set

▪ Open parent DGN – HEC-RAS.HecZip.dgn

▪ Reference child DGNs – 7za.exe.dgn, HecZip.vbs.dgn

▪ Close parent DGN – HEC-RAS.HecZip.dgn

▪ Check-in all files

HecZip Solution – Logical Set Creation

► Replace Files

▪ Managed Export DGNs

HecZip Solution – Logical Set Creation

► Replace Files

▪ Replace DGNs with HecZip Template & Utility files

▪ Import fake DGNs

HecZip Solution – Logical Set Creation

► Restore File Name and Application

▪ Remove .dgn extension from file names

▪ Reset Application property

HecZip Solution – Summary

Passes the script location,

version string, and file location

Passes the version

string, and file location

2. Passes

extracted

.prj location

Opens .prj file and

Spawns additional

files through use

3. Calls for

compression

of files1. Calls for

extraction

of files

Extract filesExtract files

Compress

files

File

and logic

al set m

em

bers

copie

d o

ut on o

pen

File

checked b

ack in

to P

roje

ctW

ise

ProjectWise

HecZip File

Application

Entry

wscript.exe

VBScript File

HEC-RAS

Application

Zip Utility

HEC-RAS

Files

Local HecZip

File

Questions?

Mike DillnerSoftware Specialist

[email protected](785) 233-8300

Thank You!

Mike DillnerSoftware Specialist

[email protected](785) 233-8300

HecZip Solution – Reference Documentation

SEE PDF ATTACHMENTS

Command Line Syntax

7z <command> [<switch>...] <base_archive_name> [<arguments>...]

<arguments> ::= <switch> | <wildcard> | <filename> | <list_file> <switch>::= <switch_symbol><switch_characters>[<option>] <switch_symbol> ::= '/' | '-' <list_file> ::= @{filename}

Expressions in square brackets (between '[' and ']') are optional.

Expressions in curly braces ('{' and '}') mean that instead of that Expression (including braces), the

user must substitute some string.

Expression

expression1 | expression2 | ... | expressionN

means that any (but only one) from these expressions must be specified.

Commands and switches can be entered in upper or lower case.

Command is the first non-switch argument.

The "base_archive_name" must be the first filename on the command line after the command.

The switches and other filenames can be in any order.

Wildcards or filenames with spaces must be quoted:

"Dir\Program files\*" Dir\"Program files"\*

Switch options can be combined to save command line length. However, some switch options take

optional string arguments and therefore, must be the last option in a combined argument token string

because 7-Zip accepts the rest of the argument token as the optional argument.

7-Zip uses wild name matching similar to Windows 95:

• '*' means a sequence of arbitrary characters.

• '?' means any character.

7-Zip doesn't use the system wildcard parser. 7-Zip doesn't follow the archaic rule by which *.*

means any file. 7-Zip treats *.* as matching the name of any file that has an extension. To

process all files, you must use a * wildcard.

Page 1 of 3Command Line Syntax

7/28/2017https://sevenzip.osdn.jp/chm/cmdline/syntax.htm

Examples:

*.txt means all files with an extension of ".txt"

?a* means all files with a second character of "a"

*1* means all names that contains character "1"

*.*.* means all names that contain two at least "." characters

The default wildcard "*" will be used if there is no filename/wildcard in the command line.

Slash ('\') at the end of a path means a directory. Without a Slash ('\') at the end of the path, the path

can refer either to a file or a directory.

List file

You can supply one or more filenames or wildcards for special list files (files containing lists of files).

The filenames in such list file must be separated by new line symbol(s).

For list files, 7-Zip uses UTF-8 encoding by default. You can change encoding using -scs switch.

Multiple list files are supported.

For example, if the file "listfile.txt" contains the following:

My programs\*.cpp

Src\*.cpp

then the command

7z a -tzip archive.zip @listfile.txt

adds to the archive "archive.zip" all "*.cpp" files from directories "My programs" and "Src".

Short and Long File Names

7-Zip supports short file names (like FILENA~1.TXT) in some cases. However, it's strongly

recommended to use only the real (long) file names.

Page 2 of 3Command Line Syntax

7/28/2017https://sevenzip.osdn.jp/chm/cmdline/syntax.htm

Command Line Commands

The command is the first non-switch argument on the command line.

Command names are not case sensitive.

See also Command Line Syntax for more details about using the command line.

Commands quick reference

Command Description

a Add

b Benchmark

d Delete

e Extract

h Hash

i Show information about supported formats

l List

rn Rename

t Test

u Update

x eXtract with full paths

Page 1 of 1Command Line Commands

7/28/2017https://sevenzip.osdn.jp/chm/cmdline/commands/index.htm

Command Line Switches

Syntax

<switch>::= <switch_symbol><switch_characters>[<option>] <switch_symbol> ::= '/' | '-'

On the command line, a switch consists of a switch specifier, either a dash (-) or a forward slash (/),

followed by the name of the switch. Switch names cannot be abbreviated.

Some switches take an argument after the switch name. No spaces or tabs are allowed within a switch

specification. Switch names are not case sensitive, but arguments can be case sensitive.

Switch can be used in any place in command line.

See also Command Line Syntax for more details about using the command line.

Switch quick reference

Switch Description

-- Stop switches parsing

-ad Show dialog box in GUI version (7zg)

-ai Include archive filenames

-an Disable parsing of archive_name

-ao Overwrite mode

-ax Exclude archive filenames

-bb[0-3] Set output log level

-bd Disable progress indicator

-bs{o|e|p}{0|1|2} Set output stream for output/error/progress

-bt Show execution time statistics

-i Include filenames

-m Set Compression Method

-o Set Output directory

-p Set Password

-r Recurse subdirectories

-sa Set Archive name mode

-scc Set charset for for console input/output

-scrc Set hash function

-scs Set charset for list files

Page 1 of 2Command Line Switches

7/28/2017https://sevenzip.osdn.jp/chm/cmdline/switches/index.htm

-sdel Delete files after including to archive

-seml Send archive by email

-sfx Create SFX archive

-si Read data from StdIn

-slp Set Large Pages mode

-slt Show technical information

-sni Store NT security information

-sns Store NTFS alternate Streams

-snc Extract file as alternate stream, if there is ':' character in name

-snr Replace ':' character to '_' character in paths of alternate streams

-snh Store hard links as links (WIM and TAR formats only)

-snl Store symbolic links as links (WIM and TAR formats only)

-so Write data to StdOut

-spd Disable wildcard matching for file names

-spe Eliminate duplication of root folder for extract archive command

-spf Use fully qualified file paths

-ssc Set Sensitive Case mode

-ssw Compress files open for writing

-stl Set archive timestamp from the most recently modified file

-stm{HexMask} Set CPU thread affinity mask (hexadecimal number).

-stx{Type} Exclude archive type

-t Type of archive

-u Update options

-v Create Volumes

-w Set Working directory

-x Exclude filenames

-y Assume Yes on all queries

Page 2 of 2Command Line Switches

7/28/2017https://sevenzip.osdn.jp/chm/cmdline/switches/index.htm

DeleteFolder Method

Description Deletes a specified folder and its contents. Syntaxobject. DeleteFolderfolderspec [,

force ] The DeleteFolder method syntax has these parts:

Part Description

object Required. Always the name of a FileSystemObject.

folderspecRequired. The name of the folder to delete. The folderspec can contain wildcard

characters in the last path component.

forceOptional. Boolean value that is True if folders with the read-only attribute set are

to be deleted; False (default) if they are not.

Remarks The DeleteFolder method does not distinguish between folders that have contents and

those that do not. The specified folder is deleted regardless of whether or not it has contents. An

error occurs if no matching folders are found. The DeleteFolder method stops on the first error it

encounters. No attempt is made to roll back or undo any changes that were made before an error

occurred.

Office VBA Reference (/vba/office-vba-reference) > (/vba/vba-language-reference)

© 2017 Microsoft

Page 1 of 1DeleteFolder Method

7/28/2017https://msdn.microsoft.com/VBA/Language-Reference-VBA/articles/deletefolder-method

Run Method (Windows Script Host)

Runs a program in a new process.

Syntax

Arguments

object

WshShell object.

strCommand

String value indicating the command line you want to run. You must include any parameters you want to

pass to the executable file.

intWindowStyle

Optional. Integer value indicating the appearance of the program's window. Note that not all programs

make use of this information.

bWaitOnReturn

Optional. Boolean value indicating whether the script should wait for the program to finish executing

before continuing to the next statement in your script. If set to true, script execution halts until the

program finishes, and Run returns any error code returned by the program. If set to false (the default), the

Run method returns immediately after starting the program, automatically returning 0 (not to be

interpreted as an error code).

RemarksThe Run method returns an integer. The Run method starts a program running in a new Windows process. You

can have your script wait for the program to finish execution before continuing. This allows you to run scripts and

programs synchronously. Environment variables within the argument strCommand are automatically expanded. If a

file type has been properly registered to a particular program, calling run on a file of that type executes the

program. For example, if Word is installed on your computer system, calling Run on a *.doc file starts Word and

loads the document. The following table lists the available settings for intWindowStyle.

object.Run(strCommand, [intWindowStyle], [bWaitOnReturn])

Page 1 of 3Run Method (Windows Script Host)

7/28/2017https://msdn.microsoft.com/en-us/library/d5fk67ky(v=vs.84).aspx

intWindowStyle Description

0 Hides the window and activates another window.

1 Activates and displays a window. If the window is minimized or maximized, the system

restores it to its original size and position. An application should specify this flag when

displaying the window for the first time.

2 Activates the window and displays it as a minimized window.

3 Activates the window and displays it as a maximized window.

4 Displays a window in its most recent size and position. The active window remains active.

5 Activates the window and displays it in its current size and position.

6 Minimizes the specified window and activates the next top-level window in the Z order.

7 Displays the window as a minimized window. The active window remains active.

8 Displays the window in its current state. The active window remains active.

9 Activates and displays the window. If the window is minimized or maximized, the system

restores it to its original size and position. An application should specify this flag when

restoring a minimized window.

10 Sets the show-state based on the state of the program that started the application.

Example 1The following VBScript code opens a copy of the currently running script with Notepad.

The following VBScript code does the same thing, except it specifies the window type, waits for Notepad to be

shut down by the user, and saves the error code returned from Notepad when it is shut down.

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run "%windir%\notepad " & WScript.ScriptFullName

Set WshShell = WScript.CreateObject("WScript.Shell")

Return = WshShell.Run("notepad " & WScript.ScriptFullName, 1, true)

Page 2 of 3Run Method (Windows Script Host)

7/28/2017https://msdn.microsoft.com/en-us/library/d5fk67ky(v=vs.84).aspx

Example 2The following VBScript code opens a command window, changes to the path to C:\ , and executes the DIR

command.

Applies To:

WshShell Object

See AlsoExec Method (Windows Script Host)

© 2017 Microsoft

Dim oShell

Set oShell = WScript.CreateObject ("WScript.Shell")

oShell.run "cmd /K CD C:\ & Dir"

Set oShell = Nothing

Page 3 of 3Run Method (Windows Script Host)

7/28/2017https://msdn.microsoft.com/en-us/library/d5fk67ky(v=vs.84).aspx

DeleteFile Method

Description Deletes a specified file. Syntaxobject. DeleteFilefilespec [, force ] The DeleteFile

method syntax has these parts:

Part Description

object Required. Always the name of a FileSystemObject.

filespecRequired. The name of the file to delete. The filespec can contain wildcard

characters in the last path component.

forceOptional. Boolean value that is True if files with the read-only attribute set are to

be deleted; False (default) if they are not.

Remarks An error occurs if no matching files are found. The DeleteFile method stops on the first

error it encounters. No attempt is made to roll back or undo any changes that were made before

an error occurred.

Office VBA Reference (/vba/office-vba-reference) > (/vba/vba-language-reference)

© 2017 Microsoft

Page 1 of 1DeleteFile Method

7/28/2017https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/deletefile-method