Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/miyako/4d-plugin-workspace-services
Collection of functions from the NSFileManager and NSWorkSpace classes on OS X 10.5 and later.
https://github.com/miyako/4d-plugin-workspace-services
4d-plugin 4d-plugin-apple-silicon
Last synced: about 2 months ago
JSON representation
Collection of functions from the NSFileManager and NSWorkSpace classes on OS X 10.5 and later.
- Host: GitHub
- URL: https://github.com/miyako/4d-plugin-workspace-services
- Owner: miyako
- License: mit
- Created: 2012-07-09T00:28:13.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2024-04-30T04:05:38.000Z (8 months ago)
- Last Synced: 2024-04-30T04:54:50.611Z (8 months ago)
- Topics: 4d-plugin, 4d-plugin-apple-silicon
- Language: C
- Homepage:
- Size: 4.81 MB
- Stars: 5
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![version](https://img.shields.io/badge/version-19%2B-5682DF)
![platform](https://img.shields.io/static/v1?label=platform&message=mac-intel%20|%20mac-arm&color=blue)
[![license](https://img.shields.io/github/license/miyako/4d-plugin-workspace-services)](LICENSE)
![downloads](https://img.shields.io/github/downloads/miyako/4d-plugin-workspace-services/total)4d-plugin-workspace-services
============================Collection of OS X native file manager commands.
## Syntax
```4d
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:](https://developer.apple.com/documentation/appkit/nsworkspace/1524886-performfileoperation?language=objc)
* Finder Operations
```c
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
``````4d
icon:=FINDER Get icon for file type (typeId;fileType)
```Parameter|Type|Description
------------|------------|----
typeId|TEXT|
fileType|LONGINT|see constants* File Types
```c
File OSType 0
File UTI 1
File Extension 2
File MIME Type 3
``````4d
FULL SCREEN BEGIN (width;height;flags)
FULL SCREEN END
```**deprecated** [QuickTime](https://developer.apple.com/library/content/documentation/QuickTime/QT6_3/Chap1/QT6WhatsNew.html) 32-bit only
```4d
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
```4d
success:=APPLICATION Launch (appId;options)
```Parameter|Type|Description
------------|------------|----
appId|TEXT|
options|LONGINT|see constants
success|LONGINT|[launchAppWithBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier:](https://developer.apple.com/documentation/appkit/nsworkspace/1533335-launchappwithbundleidentifier?language=objc)
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:](https://developer.apple.com/documentation/appkit/nsworkspace/1535886-openurls?language=objc)
* 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
``````4d
label:=DOCK Get badge label
DOCK SET BADGE LABEL (label)
```Parameter|Type|Description
------------|------------|----
label|TEXT|```4d
icon:=DOCK Get icon
DOCK SET ICON (icon)
```Parameter|Type|Description
------------|------------|----
icon|PICTURE|setting an empty picture resets the dock icon
```4d
icon:=FILE Get icon (path)
FILE SET ICON (path;icon)
```Parameter|Type|Description
------------|------------|----
path|TEXT|
icon|PICTURE|```4d
result:=FILE Get application name (path)
```Parameter|Type|Description
------------|------------|----
path|TEXT|
appName|TEXT|[getInfoForFile:application:type:](https://developer.apple.com/documentation/appkit/nsworkspace/1535102-getinfoforfile?language=objc)
```4d
name:=FILE Get localized name (path)
```Parameter|Type|Description
------------|------------|----
path|TEXT|
name|TEXT|[displayNameAtPath:](https://developer.apple.com/documentation/foundation/nsfilemanager/1409751-displaynameatpath)
```4d
success:=FILE Open with application (path;appId;deactivate)
```Parameter|Type|Description
------------|------------|----
path|TEXT|
appId|TEXT|
deactivate|LONGINT|
success|LONGINT|[openFile:withApplication:andDeactivate:](https://developer.apple.com/documentation/appkit/nsworkspace/1530182-openfile?language=objc)
```4d
FOLDER GET CONTENTS (path;paths;pathType)
FOLDER GET SUBPATHS (path;paths;pathType)
```Parameter|Type|Description
------------|------------|----
path|TEXT|
paths|ARRAY TEXT|
pathType|LONGINT|see constantsconsider native 4D command ``DOCUMENT LIST``
## Examples
```4d
$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)
``````4d
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)
``````4d
$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)
```