Skip to content

Commit 0b8a392

Browse files
committed
Add clipboard.md & security.png, update relevant files
1 parent 0db3f70 commit 0b8a392

File tree

4 files changed

+73
-0
lines changed

4 files changed

+73
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ a little experiment, so you have six options to approach your idea:
3939

4040
Globals namespaces
4141
* [app](api/app.md#app)
42+
* [app.clipboard](api/app_clipboard.md#appclipboard)
4243
* [app.command](api/app_command.md#appcommand)
4344
* [app.fs](api/app_fs.md#appfs)
4445
* [app.os](api/app_os.md#appos)

api/app_clipboard.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
## app.clipboard
2+
3+
A set of functions to handle the clipboard.
4+
5+
When calling a function with clipboard write access in a script, Aseprite will ask the user if they want to allow the function to run or stop the script.
6+
7+
![security popup](image/security.png)
8+
9+
## app.clipboard.text
10+
11+
```lua
12+
local text = app.clipboard.text
13+
```
14+
15+
Gets or sets the clipboard text. Returns `nil` if there is no text.
16+
17+
## app.clipboard.image
18+
19+
```lua
20+
local image = app.clipboard.image
21+
```
22+
23+
Gets or sets the clipboard [image](image.md#image). Returns `nil` if there is no image.
24+
25+
## app.clipboard.content
26+
27+
```lua
28+
local content = app.clipboard.content
29+
```
30+
31+
Gets the content of the clipboard, as a table. Values:
32+
33+
* `image`: An [image](image.md#image) object or `nil`
34+
* `selection`: A [selection](selection.md#selection) object or `nil`
35+
* `palette`: A [palette](palette.md#palette) object or `nil`
36+
* `tileset`: A [tileset](tileset.md#tileset) object or `nil`
37+
* `text`: A string or `nil`
38+
39+
Depending on what is copied, each value will be set differently. Case table:
40+
41+
| |An image is copied in Aseprite |An image is copied externally|Text is copied|A portion of the Palette is copied |
42+
|-------------|------------------------------------|-----------------------------|--------------|---------------------------------------------------------|
43+
|`image` |[Image](image.md#image) |[Image](image.md#image) |`nil` |`nil` |
44+
|`selection`|[Selection](selection.md#selection) |`nil` |`nil` |`nil` |
45+
|`palette` |Sprite [palette](palette.md#palette)|`nil` |`nil` |`nil` |
46+
|`tileset` |`nil` |`nil` |`nil` |`nil` |
47+
|`text` |`nil` |`nil` |String |String of selected colors in hex codes, seperated by `\n`|
48+
49+
## app.clipboard.hasText
50+
51+
```lua
52+
local hasText = app.clipboard.hasText
53+
```
54+
55+
Returns true if the last item copied to the clipboard was text.
56+
57+
## app.clipboard.hasImage
58+
59+
```lua
60+
local hasImage = app.clipboard.hasImage
61+
```
62+
63+
Returns true if the last item copied to the clipboard was an [image](image.md#image).
64+
65+
## app.clipboard.clear()
66+
67+
```lua
68+
app.clipboard.clear()
69+
```
70+
71+
Clears the clipboard.

api/image/security.png

4.1 KB
Loading

sidebar.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
Globals namespaces
77
* [app](api/app.md#app)
8+
* [app.clipboard](api/app_clipboard.md#appclipboard)
89
* [app.command](api/app_command.md#appcommand)
910
* [app.fs](api/app_fs.md#appfs)
1011
* [app.os](api/app_os.md#appos)

0 commit comments

Comments
 (0)