Skip to content

Collection of functions from the NSFileManager and NSWorkSpace classes on OS X 10.5 and later.

License

Notifications You must be signed in to change notification settings

miyako/4d-plugin-workspace-services

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 

Repository files navigation

version platform license downloads

4d-plugin-workspace-services

Collection of OS X native file manager commands.

Syntax

result:=FINDER Perform operation (srcPath;dstPath;objects;operation)
Parameter Type Description
srcPath TEXT
dstPath TEXT
objects ARRAY TEXT ames of the files and directories to be manipulated
operation LONGINT see constants
success LONGINT

performFileOperation:source:destination:files:tag:

  • Finder Operations
Operation Move 0
Operation Copy 1
Operation Link 2
Operation Compress 3
Operation Decompress 4
Operation Encrypt 5
Operation Decrypt 6
Operation Destroy 7
Operation Recycle 8
Operation Duplicate 9
icon:=FINDER Get icon for file type (typeId;fileType)
Parameter Type Description
typeId TEXT
fileType LONGINT see constants
  • File Types
File OSType 0
File UTI 1
File Extension 2
File MIME Type 3
FULL SCREEN BEGIN (width;height;flags)
FULL SCREEN END

deprecated QuickTime 32-bit only

result:=APPLICATION Get path (appId;pathStyle)
Parameter Type Description
appId TEXT
pathStyle LONGINT see constants
result TEXT
  • Path Styles
Path Style HFS 0
Path Style POSIX 1
Path Style URL 2

returns the absolute or full path for the specified application, in the requested format

success:=APPLICATION Launch (appId;options)
Parameter Type Description
appId TEXT
options LONGINT see constants
success LONGINT

launchAppWithBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier:

success:=APPLICATION Launch paths (appId;options;paths)

Parameter Type Description
appId TEXT
options LONGINT see constants
paths ARRAY TEXT paths (internally converted from HFS to URL)
success LONGINT

openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:

  • Launch Options
Launch And Print 2
Launch Without Adding Recents 256
Launch Without Activation 512
Launch Asyncronous 65536
Launch New Instance 524288
Launch And Hide 1048576
Launch And Hide Others 2097152
label:=DOCK Get badge label
DOCK SET BADGE LABEL (label)
Parameter Type Description
label TEXT
icon:=DOCK Get icon
DOCK SET ICON (icon)
Parameter Type Description
icon PICTURE

setting an empty picture resets the dock icon

icon:=FILE Get icon (path)
FILE SET ICON (path;icon)
Parameter Type Description
path TEXT
icon PICTURE
result:=FILE Get application name (path)
Parameter Type Description
path TEXT
appName TEXT

getInfoForFile:application:type:

name:=FILE Get localized name (path)
Parameter Type Description
path TEXT
name TEXT

displayNameAtPath:

success:=FILE Open with application (path;appId;deactivate)
Parameter Type Description
path TEXT
appId TEXT
deactivate LONGINT
success LONGINT

openFile:withApplication:andDeactivate:

FOLDER GET CONTENTS (path;paths;pathType)
FOLDER GET SUBPATHS (path;paths;pathType)
Parameter Type Description
path TEXT
paths ARRAY TEXT
pathType LONGINT see constants

consider native 4D command DOCUMENT LIST

Examples

$icon:=FINDER Get icon for file type ("public.jpeg";File Extension)
SET PICTURE TO PASTEBOARD($icon)

$icon:=FINDER Get icon for file type ("4db";File Extension)
SET PICTURE TO PASTEBOARD($icon)

$icon:=FINDER Get icon for file type ("text/plain";File MIME Type)
SET PICTURE TO PASTEBOARD($icon)

$icon:=FINDER Get icon for file type ("trsh";File OSType)
SET PICTURE TO PASTEBOARD($icon)

$icon:=FILE Get icon (Structure file)
SET PICTURE TO PASTEBOARD($icon)

C_BLOB($data)
$filePath:=System folder(Desktop)+Generate UUID
BLOB TO DOCUMENT($filePath;$data)
FILE SET ICON ($filePath;$icon)
FOLDER GET CONTENTS (Get 4D folder(Database folder);$pathHFS;Path Style HFS)
FOLDER GET CONTENTS (Get 4D folder(Database folder);$pathPOS;Path Style POSIX)
FOLDER GET CONTENTS (Get 4D folder(Database folder);$pathURL;Path Style URL)
$filePath1:=System folder(Desktop)+Generate UUID+".txt"
$filePath2:=System folder(Desktop)+Generate UUID+".txt"

C_BLOB($data)
BLOB TO DOCUMENT($filePath1;$data)
BLOB TO DOCUMENT($filePath2;$data)

$appName:=FILE Get application name ($filePath)
$appName:="com.apple.TextEdit"
$appName:="TextEdit.app"
$appName:="TextEdit"

ARRAY TEXT($path;0)
APPEND TO ARRAY($path;$filePath1)
APPEND TO ARRAY($path;$filePath2)

APPLICATION Launch paths ($appName;Launch Without Activation | Launch And Print;$path)

About

Collection of functions from the NSFileManager and NSWorkSpace classes on OS X 10.5 and later.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages