LoginSignup
1
1

More than 5 years have passed since last update.

ノーツ(LotusScipt)で、WindowsやMacintoshのノーツ画面からネットワーク共有フォルダを開く

Last updated at Posted at 2015-12-08

IBM ロータスノーツをまだまだ使い続けている企業等があるかと思います(私の会社もそのひとつ)。
Tips のひとつとして、ノーツから任意のネットワーク共有フォルダを開くスクリプトを記述してみます。

スクリプト

Dim ss As New NotesSession
Dim path As String
Dim ret As Integer

' このコード例では、pathをUNC(Windowsで採用)で指定しています
path = "\\fileserver\sharedfolder\"

Select Case ss.Platform
 Case "Windows/32"
  ret = Shell("explorer """ & path & """", 1)       

 Case "Macintosh"
  ' UNCパスをsmbプロトコルのURL表現に変換します
  path = Replace(path, "\\", "smb://")
  path = Replace(path, "\", "/")

  ret = Shell("open """ & path & """")      

 Case Else
  MessageBox "非対応のOSです。直接開いてください" + Chr(13) + Chr(10)

End Select

説明

NotesSession インスタンス(オブジェクト)の Platform プロパティに、クライアント(ノーツ)が動作しているOSの種類が入っているので、この内容をもとにフォルダパスを指定して、フォルダを開くコマンド・アプリケーション(Windowsならexplorerアプリケーション、MacOSならopenコマンド)を Shell 関数で呼びだしています。

ちなみにネットワーク共有(SMB共有)フォルダパス表現方法は
Windowsであれば
\\<サーバ名>\<フォルダ名>\
MacOSであれば
smb://<サーバ名>/<フォルダ名>/
となります(LotusScript とは無関係ですが...)

式言語での実現方法

LotusScriptのShell関数に対応する式言語@Command([Execute])での例です。OS の識別は @Platform が返す値を参照することで可能です。

Windows

@Command([Execute];"¥¥fileserver¥sharedfolder¥")
@Command([Execute];"¥¥¥¥fileserver¥¥sharedfolder¥¥")
※NotesDesignerからの入力で、エンマークはなぜか2個打ちせねばならない場合と、1個打ちで済む場合とがあります。

パスでファイルを指定すれば、画像ファイルなども開くことができます。ShellExecute 的な動きをするのでしょう。

@Command([Execute];"¥¥fileserver¥sharedfolder¥picture.png")
(余談)
@Command([Execute];"explorer.exe";"¥¥¥¥fileserver¥¥sharedfolder¥¥")

のように指定して、同じことができたときと、うまくいかずに下記画像のような変な呼び出され方をされたときとがありました。
p3.png

Macintosh

うまくいく方法をご存知の方、教えてください!!次のコマンドはうまく動かず...

@Command([Execute];"//fileserver/sharedfolder/")
@Command([Execute];"smb://fileserver/sharedfolder/")
@Command([Execute];"open";"//fileserver/sharedfolder/")
@Command([Execute];"open";"smb://fileserver/sharedfolder/")

私の環境ではopen自体も動きません。

@Command([Execute];"open")
1
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1