发布日期: 09/18/2023

Connect to a Network Directory

On Windows, you can connect to a network directory without connecting to the shared drive first.

Files in Directory( "\\myserver.company.com/source/Users/Smith" );

On macOS, you have to mount the volume first and then connect to the directory using a combination of JSL and AppleScript. Note that you can also modify this script to work on Windows. On macOS only, the user is prompted for a password.

mount = Function( {server},
	{Default Local},
 
	If( Host is( "Mac" ),
 

/* Use osascript to mount the volume.

The user will be prompted for credentials. */

		Run Program(
			Executable( "/usr/bin/osascript" ),
			Options( {"-e", Eval Insert( "mount volume \!"smb://^server^\!"" )} ),
			Read Function( "text" )
		);
		server = Concat Items( Remove( Words( server, "/" ), 1 ), "/" );
		Eval Insert( "/Volumes/^server^" );
	,

// Windows can use UNC to auto-mount the server.

		Eval Insert( "\!\\!\^server^" )
	)
);
 
users = Mount( "myserver.company.com/Users" );
Files In Directory( Eval Insert( "^users^/Smith" ) );
需要更多信息?有问题?从 JMP 用户社区得到解答 (community.jmp.com).