├── ChooseAndDisplayImage.app
└── Contents
│ ├── Info.plist
│ ├── MacOS
│ └── applet
│ ├── PkgInfo
│ └── Resources
│ ├── Scripts
│ └── main.scpt
│ ├── applet.icns
│ ├── applet.rsrc
│ └── description.rtfd
│ └── TXT.rtf
├── HandleBtnClick.app
└── Contents
│ ├── Info.plist
│ ├── MacOS
│ └── applet
│ ├── PkgInfo
│ └── Resources
│ ├── Scripts
│ └── main.scpt
│ ├── applet.icns
│ ├── applet.rsrc
│ └── description.rtfd
│ └── TXT.rtf
├── NSButton.app
└── Contents
│ ├── Info.plist
│ ├── MacOS
│ └── applet
│ ├── PkgInfo
│ └── Resources
│ ├── Scripts
│ └── main.scpt
│ ├── applet.icns
│ ├── applet.rsrc
│ └── description.rtfd
│ └── TXT.rtf
├── NSComboBox.app
└── Contents
│ ├── Info.plist
│ ├── MacOS
│ └── applet
│ ├── PkgInfo
│ └── Resources
│ ├── Scripts
│ └── main.scpt
│ ├── applet.icns
│ ├── applet.rsrc
│ └── description.rtfd
│ └── TXT.rtf
├── NSImageView.app
└── Contents
│ ├── Info.plist
│ ├── MacOS
│ └── applet
│ ├── PkgInfo
│ └── Resources
│ ├── Scripts
│ └── main.scpt
│ ├── applet.icns
│ ├── applet.rsrc
│ └── description.rtfd
│ └── TXT.rtf
├── NSLog.app
└── Contents
│ ├── Info.plist
│ ├── MacOS
│ └── applet
│ ├── PkgInfo
│ └── Resources
│ ├── Scripts
│ └── main.scpt
│ ├── applet.icns
│ ├── applet.rsrc
│ └── description.rtfd
│ └── TXT.rtf
├── NSMatrix.app
└── Contents
│ ├── Info.plist
│ ├── MacOS
│ └── applet
│ ├── PkgInfo
│ └── Resources
│ ├── Scripts
│ └── main.scpt
│ ├── applet.icns
│ ├── applet.rsrc
│ └── description.rtfd
│ └── TXT.rtf
├── NSOpenPanel.app
└── Contents
│ ├── Info.plist
│ ├── MacOS
│ └── applet
│ ├── PkgInfo
│ └── Resources
│ ├── Scripts
│ └── main.scpt
│ ├── applet.icns
│ ├── applet.rsrc
│ └── description.rtfd
│ └── TXT.rtf
├── NSPipe.app
└── Contents
│ ├── Info.plist
│ ├── MacOS
│ └── applet
│ ├── PkgInfo
│ └── Resources
│ ├── Scripts
│ └── main.scpt
│ ├── applet.icns
│ ├── applet.rsrc
│ └── description.rtfd
│ └── TXT.rtf
├── NSPopUpButton.app
└── Contents
│ ├── Info.plist
│ ├── MacOS
│ └── applet
│ ├── PkgInfo
│ └── Resources
│ ├── Scripts
│ └── main.scpt
│ ├── applet.icns
│ ├── applet.rsrc
│ └── description.rtfd
│ └── TXT.rtf
├── NSSplitView.app
└── Contents
│ ├── Info.plist
│ ├── MacOS
│ └── applet
│ ├── PkgInfo
│ └── Resources
│ ├── Scripts
│ └── main.scpt
│ ├── applet.icns
│ ├── applet.rsrc
│ └── description.rtfd
│ └── TXT.rtf
├── NSTask.app
└── Contents
│ ├── Info.plist
│ ├── MacOS
│ └── applet
│ ├── PkgInfo
│ └── Resources
│ ├── Scripts
│ └── main.scpt
│ ├── applet.icns
│ ├── applet.rsrc
│ └── description.rtfd
│ └── TXT.rtf
├── NSTextField.app
└── Contents
│ ├── Info.plist
│ ├── MacOS
│ └── applet
│ ├── PkgInfo
│ └── Resources
│ ├── Scripts
│ └── main.scpt
│ ├── applet.icns
│ ├── applet.rsrc
│ └── description.rtfd
│ └── TXT.rtf
├── NSUserNotification.app
└── Contents
│ ├── Info.plist
│ ├── MacOS
│ └── applet
│ ├── PkgInfo
│ └── Resources
│ ├── Scripts
│ └── main.scpt
│ ├── applet.icns
│ ├── applet.rsrc
│ └── description.rtfd
│ └── TXT.rtf
├── NSWindow-growShrink.app
└── Contents
│ ├── Info.plist
│ ├── MacOS
│ └── applet
│ ├── PkgInfo
│ └── Resources
│ ├── Scripts
│ └── main.scpt
│ ├── applet.icns
│ ├── applet.rsrc
│ └── description.rtfd
│ └── TXT.rtf
├── NSWindow-minMaxSizes.app
└── Contents
│ ├── Info.plist
│ ├── MacOS
│ └── applet
│ ├── PkgInfo
│ └── Resources
│ ├── Scripts
│ └── main.scpt
│ ├── applet.icns
│ ├── applet.rsrc
│ └── description.rtfd
│ └── TXT.rtf
├── NSWindow.app
└── Contents
│ ├── Info.plist
│ ├── MacOS
│ └── applet
│ ├── PkgInfo
│ └── Resources
│ ├── Scripts
│ └── main.scpt
│ ├── applet.icns
│ ├── applet.rsrc
│ └── description.rtfd
│ └── TXT.rtf
├── README.md
└── docs
├── README.md
├── javascript-osa-add-track-to-itunes-playlist.md
├── js-closure-causing-odd-behavior-with-jxa.md
├── subclass-using-NSUserNotificationCenterDelegate.md
└── webview-not-rendering-html.md
/ChooseAndDisplayImage.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleAllowMixedLocalizations
6 |
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | applet
11 | CFBundleIconFile
12 | applet
13 | CFBundleIdentifier
14 | com.apple.ScriptEditor.id.ChooseAndDisplayImage
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | ChooseAndDisplayImage
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | aplt
25 | LSMinimumSystemVersionByArchitecture
26 |
27 | x86_64
28 | 10.6
29 |
30 | LSRequiresCarbon
31 |
32 | WindowState
33 |
34 | bundleDividerCollapsed
35 |
36 | bundlePositionOfDivider
37 | 0.0
38 | dividerCollapsed
39 |
40 | eventLogLevel
41 | 2
42 | name
43 | ScriptWindowState
44 | positionOfDivider
45 | 421
46 | savedFrame
47 | 3 162 1235 1015 0 0 1920 1177
48 | selectedTab
49 | description
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/ChooseAndDisplayImage.app/Contents/MacOS/applet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/ChooseAndDisplayImage.app/Contents/MacOS/applet
--------------------------------------------------------------------------------
/ChooseAndDisplayImage.app/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPLaplt
--------------------------------------------------------------------------------
/ChooseAndDisplayImage.app/Contents/Resources/Scripts/main.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/ChooseAndDisplayImage.app/Contents/Resources/Scripts/main.scpt
--------------------------------------------------------------------------------
/ChooseAndDisplayImage.app/Contents/Resources/applet.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/ChooseAndDisplayImage.app/Contents/Resources/applet.icns
--------------------------------------------------------------------------------
/ChooseAndDisplayImage.app/Contents/Resources/applet.rsrc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/ChooseAndDisplayImage.app/Contents/Resources/applet.rsrc
--------------------------------------------------------------------------------
/ChooseAndDisplayImage.app/Contents/Resources/description.rtfd/TXT.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1339
2 | {\fonttbl}
3 | {\colortbl;\red255\green255\blue255;}
4 | }
--------------------------------------------------------------------------------
/HandleBtnClick.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleAllowMixedLocalizations
6 |
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | applet
11 | CFBundleIconFile
12 | applet
13 | CFBundleIdentifier
14 | com.apple.ScriptEditor.id.HandleBtnClick
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | HandleBtnClick
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | aplt
25 | LSMinimumSystemVersionByArchitecture
26 |
27 | x86_64
28 | 10.6
29 |
30 | LSRequiresCarbon
31 |
32 | WindowState
33 |
34 | bundleDividerCollapsed
35 |
36 | bundlePositionOfDivider
37 | 0.0
38 | dividerCollapsed
39 |
40 | eventLogLevel
41 | -1
42 | name
43 | ScriptWindowState
44 | positionOfDivider
45 | 726
46 | savedFrame
47 | 851 227 1069 950 0 0 1920 1177
48 | selectedTabView
49 | result
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/HandleBtnClick.app/Contents/MacOS/applet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/HandleBtnClick.app/Contents/MacOS/applet
--------------------------------------------------------------------------------
/HandleBtnClick.app/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPLaplt
--------------------------------------------------------------------------------
/HandleBtnClick.app/Contents/Resources/Scripts/main.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/HandleBtnClick.app/Contents/Resources/Scripts/main.scpt
--------------------------------------------------------------------------------
/HandleBtnClick.app/Contents/Resources/applet.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/HandleBtnClick.app/Contents/Resources/applet.icns
--------------------------------------------------------------------------------
/HandleBtnClick.app/Contents/Resources/applet.rsrc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/HandleBtnClick.app/Contents/Resources/applet.rsrc
--------------------------------------------------------------------------------
/HandleBtnClick.app/Contents/Resources/description.rtfd/TXT.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1326\cocoasubrtf110
2 | {\fonttbl}
3 | {\colortbl;\red255\green255\blue255;}
4 | }
--------------------------------------------------------------------------------
/NSButton.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleAllowMixedLocalizations
6 |
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | applet
11 | CFBundleIconFile
12 | applet
13 | CFBundleIdentifier
14 | com.apple.ScriptEditor.id.NSButton
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | NSButton
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | aplt
25 | LSMinimumSystemVersionByArchitecture
26 |
27 | x86_64
28 | 10.6
29 |
30 | LSRequiresCarbon
31 |
32 | WindowState
33 |
34 | bundleDividerCollapsed
35 |
36 | bundlePositionOfDivider
37 | 0.0
38 | dividerCollapsed
39 |
40 | eventLogLevel
41 | -1
42 | name
43 | ScriptWindowState
44 | positionOfDivider
45 | 855
46 | savedFrame
47 | 983 103 937 1074 0 0 1920 1177
48 | selectedTabView
49 | event log
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/NSButton.app/Contents/MacOS/applet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSButton.app/Contents/MacOS/applet
--------------------------------------------------------------------------------
/NSButton.app/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPLaplt
--------------------------------------------------------------------------------
/NSButton.app/Contents/Resources/Scripts/main.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSButton.app/Contents/Resources/Scripts/main.scpt
--------------------------------------------------------------------------------
/NSButton.app/Contents/Resources/applet.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSButton.app/Contents/Resources/applet.icns
--------------------------------------------------------------------------------
/NSButton.app/Contents/Resources/applet.rsrc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSButton.app/Contents/Resources/applet.rsrc
--------------------------------------------------------------------------------
/NSButton.app/Contents/Resources/description.rtfd/TXT.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1326\cocoasubrtf110
2 | {\fonttbl}
3 | {\colortbl;\red255\green255\blue255;}
4 | }
--------------------------------------------------------------------------------
/NSComboBox.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleAllowMixedLocalizations
6 |
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | applet
11 | CFBundleIconFile
12 | applet
13 | CFBundleIdentifier
14 | com.apple.ScriptEditor.id.NSComboBox
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | NSComboBox
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | aplt
25 | LSMinimumSystemVersionByArchitecture
26 |
27 | x86_64
28 | 10.6
29 |
30 | LSRequiresCarbon
31 |
32 | WindowState
33 |
34 | bundleDividerCollapsed
35 |
36 | bundlePositionOfDivider
37 | 0.0
38 | dividerCollapsed
39 |
40 | eventLogLevel
41 | -1
42 | name
43 | ScriptWindowState
44 | positionOfDivider
45 | 659
46 | savedFrame
47 | 725 273 1185 904 0 0 1920 1177
48 | selectedTabView
49 | result
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/NSComboBox.app/Contents/MacOS/applet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSComboBox.app/Contents/MacOS/applet
--------------------------------------------------------------------------------
/NSComboBox.app/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPLaplt
--------------------------------------------------------------------------------
/NSComboBox.app/Contents/Resources/Scripts/main.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSComboBox.app/Contents/Resources/Scripts/main.scpt
--------------------------------------------------------------------------------
/NSComboBox.app/Contents/Resources/applet.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSComboBox.app/Contents/Resources/applet.icns
--------------------------------------------------------------------------------
/NSComboBox.app/Contents/Resources/applet.rsrc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSComboBox.app/Contents/Resources/applet.rsrc
--------------------------------------------------------------------------------
/NSComboBox.app/Contents/Resources/description.rtfd/TXT.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1326\cocoasubrtf110
2 | {\fonttbl}
3 | {\colortbl;\red255\green255\blue255;}
4 | }
--------------------------------------------------------------------------------
/NSImageView.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleAllowMixedLocalizations
6 |
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | applet
11 | CFBundleIconFile
12 | applet
13 | CFBundleIdentifier
14 | com.apple.ScriptEditor.id.NSImageView
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | NSImageView
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | aplt
25 | LSMinimumSystemVersionByArchitecture
26 |
27 | x86_64
28 | 10.6
29 |
30 | LSRequiresCarbon
31 |
32 | WindowState
33 |
34 | bundleDividerCollapsed
35 |
36 | bundlePositionOfDivider
37 | 679
38 | dividerCollapsed
39 |
40 | eventLogLevel
41 | 2
42 | name
43 | ScriptWindowState
44 | positionOfDivider
45 | 496
46 | savedFrame
47 | 537 344 977 747 0 0 1920 1177
48 | selectedTab
49 | description
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/NSImageView.app/Contents/MacOS/applet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSImageView.app/Contents/MacOS/applet
--------------------------------------------------------------------------------
/NSImageView.app/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPLaplt
--------------------------------------------------------------------------------
/NSImageView.app/Contents/Resources/Scripts/main.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSImageView.app/Contents/Resources/Scripts/main.scpt
--------------------------------------------------------------------------------
/NSImageView.app/Contents/Resources/applet.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSImageView.app/Contents/Resources/applet.icns
--------------------------------------------------------------------------------
/NSImageView.app/Contents/Resources/applet.rsrc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSImageView.app/Contents/Resources/applet.rsrc
--------------------------------------------------------------------------------
/NSImageView.app/Contents/Resources/description.rtfd/TXT.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1334
2 | {\fonttbl}
3 | {\colortbl;\red255\green255\blue255;}
4 | }
--------------------------------------------------------------------------------
/NSLog.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleAllowMixedLocalizations
6 |
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | applet
11 | CFBundleIconFile
12 | applet
13 | CFBundleIdentifier
14 | com.apple.ScriptEditor.id.NSLog
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | NSLog
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | aplt
25 | LSMinimumSystemVersionByArchitecture
26 |
27 | x86_64
28 | 10.6
29 |
30 | LSRequiresCarbon
31 |
32 | WindowState
33 |
34 | bundleDividerCollapsed
35 |
36 | bundlePositionOfDivider
37 | 0.0
38 | dividerCollapsed
39 |
40 | eventLogLevel
41 | 2
42 | name
43 | ScriptWindowState
44 | positionOfDivider
45 | 604
46 | savedFrame
47 | 713 320 784 857 0 0 1920 1177
48 | selectedTab
49 | result
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/NSLog.app/Contents/MacOS/applet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSLog.app/Contents/MacOS/applet
--------------------------------------------------------------------------------
/NSLog.app/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPLaplt
--------------------------------------------------------------------------------
/NSLog.app/Contents/Resources/Scripts/main.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSLog.app/Contents/Resources/Scripts/main.scpt
--------------------------------------------------------------------------------
/NSLog.app/Contents/Resources/applet.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSLog.app/Contents/Resources/applet.icns
--------------------------------------------------------------------------------
/NSLog.app/Contents/Resources/applet.rsrc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSLog.app/Contents/Resources/applet.rsrc
--------------------------------------------------------------------------------
/NSLog.app/Contents/Resources/description.rtfd/TXT.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1339
2 | {\fonttbl}
3 | {\colortbl;\red255\green255\blue255;}
4 | }
--------------------------------------------------------------------------------
/NSMatrix.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleAllowMixedLocalizations
6 |
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | applet
11 | CFBundleIconFile
12 | applet
13 | CFBundleIdentifier
14 | com.apple.ScriptEditor.id.NSMatrix
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | NSMatrix
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | aplt
25 | LSMinimumSystemVersionByArchitecture
26 |
27 | x86_64
28 | 10.6
29 |
30 | LSRequiresCarbon
31 |
32 | WindowState
33 |
34 | bundleDividerCollapsed
35 |
36 | bundlePositionOfDivider
37 | 0.0
38 | dividerCollapsed
39 |
40 | eventLogLevel
41 | 0
42 | name
43 | ScriptWindowState
44 | positionOfDivider
45 | 877
46 | savedFrame
47 | 466 62 987 1115 0 0 1920 1177
48 | selectedTabView
49 | event log
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/NSMatrix.app/Contents/MacOS/applet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSMatrix.app/Contents/MacOS/applet
--------------------------------------------------------------------------------
/NSMatrix.app/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPLaplt
--------------------------------------------------------------------------------
/NSMatrix.app/Contents/Resources/Scripts/main.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSMatrix.app/Contents/Resources/Scripts/main.scpt
--------------------------------------------------------------------------------
/NSMatrix.app/Contents/Resources/applet.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSMatrix.app/Contents/Resources/applet.icns
--------------------------------------------------------------------------------
/NSMatrix.app/Contents/Resources/applet.rsrc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSMatrix.app/Contents/Resources/applet.rsrc
--------------------------------------------------------------------------------
/NSMatrix.app/Contents/Resources/description.rtfd/TXT.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1326\cocoasubrtf110
2 | {\fonttbl}
3 | {\colortbl;\red255\green255\blue255;}
4 | }
--------------------------------------------------------------------------------
/NSOpenPanel.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleAllowMixedLocalizations
6 |
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | applet
11 | CFBundleIconFile
12 | applet
13 | CFBundleIdentifier
14 | com.apple.ScriptEditor.id.NSOpenPanel
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | NSOpenPanel
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | aplt
25 | LSMinimumSystemVersionByArchitecture
26 |
27 | x86_64
28 | 10.6
29 |
30 | LSRequiresCarbon
31 |
32 | WindowState
33 |
34 | bundleDividerCollapsed
35 |
36 | bundlePositionOfDivider
37 | 0.0
38 | dividerCollapsed
39 |
40 | eventLogLevel
41 | -1
42 | name
43 | ScriptWindowState
44 | positionOfDivider
45 | 862
46 | savedFrame
47 | 815 62 1055 1115 0 0 1920 1177
48 | selectedTabView
49 | event log
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/NSOpenPanel.app/Contents/MacOS/applet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSOpenPanel.app/Contents/MacOS/applet
--------------------------------------------------------------------------------
/NSOpenPanel.app/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPLaplt
--------------------------------------------------------------------------------
/NSOpenPanel.app/Contents/Resources/Scripts/main.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSOpenPanel.app/Contents/Resources/Scripts/main.scpt
--------------------------------------------------------------------------------
/NSOpenPanel.app/Contents/Resources/applet.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSOpenPanel.app/Contents/Resources/applet.icns
--------------------------------------------------------------------------------
/NSOpenPanel.app/Contents/Resources/applet.rsrc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSOpenPanel.app/Contents/Resources/applet.rsrc
--------------------------------------------------------------------------------
/NSOpenPanel.app/Contents/Resources/description.rtfd/TXT.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1326\cocoasubrtf110
2 | {\fonttbl}
3 | {\colortbl;\red255\green255\blue255;}
4 | }
--------------------------------------------------------------------------------
/NSPipe.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleAllowMixedLocalizations
6 |
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | applet
11 | CFBundleIconFile
12 | applet
13 | CFBundleIdentifier
14 | com.apple.ScriptEditor.id.NSPipe
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | NSPipe
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | aplt
25 | LSMinimumSystemVersionByArchitecture
26 |
27 | x86_64
28 | 10.6
29 |
30 | LSRequiresCarbon
31 |
32 | WindowState
33 |
34 | bundleDividerCollapsed
35 |
36 | bundlePositionOfDivider
37 | 0.0
38 | dividerCollapsed
39 |
40 | eventLogLevel
41 | 0
42 | name
43 | ScriptWindowState
44 | positionOfDivider
45 | 820
46 | savedFrame
47 | 668 181 1236 996 0 0 1920 1177
48 | selectedTabView
49 | event log
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/NSPipe.app/Contents/MacOS/applet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSPipe.app/Contents/MacOS/applet
--------------------------------------------------------------------------------
/NSPipe.app/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPLaplt
--------------------------------------------------------------------------------
/NSPipe.app/Contents/Resources/Scripts/main.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSPipe.app/Contents/Resources/Scripts/main.scpt
--------------------------------------------------------------------------------
/NSPipe.app/Contents/Resources/applet.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSPipe.app/Contents/Resources/applet.icns
--------------------------------------------------------------------------------
/NSPipe.app/Contents/Resources/applet.rsrc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSPipe.app/Contents/Resources/applet.rsrc
--------------------------------------------------------------------------------
/NSPipe.app/Contents/Resources/description.rtfd/TXT.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1326\cocoasubrtf110
2 | {\fonttbl}
3 | {\colortbl;\red255\green255\blue255;}
4 | }
--------------------------------------------------------------------------------
/NSPopUpButton.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleAllowMixedLocalizations
6 |
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | applet
11 | CFBundleIconFile
12 | applet
13 | CFBundleIdentifier
14 | com.apple.ScriptEditor.id.NSPopUpButton
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | NSPopUpButton
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | aplt
25 | LSMinimumSystemVersionByArchitecture
26 |
27 | x86_64
28 | 10.6
29 |
30 | LSRequiresCarbon
31 |
32 | WindowState
33 |
34 | bundleDividerCollapsed
35 |
36 | bundlePositionOfDivider
37 | 0.0
38 | dividerCollapsed
39 |
40 | eventLogLevel
41 | -1
42 | name
43 | ScriptWindowState
44 | positionOfDivider
45 | 674
46 | savedFrame
47 | 785 120 1105 1057 0 0 1920 1177
48 | selectedTabView
49 | result
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/NSPopUpButton.app/Contents/MacOS/applet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSPopUpButton.app/Contents/MacOS/applet
--------------------------------------------------------------------------------
/NSPopUpButton.app/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPLaplt
--------------------------------------------------------------------------------
/NSPopUpButton.app/Contents/Resources/Scripts/main.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSPopUpButton.app/Contents/Resources/Scripts/main.scpt
--------------------------------------------------------------------------------
/NSPopUpButton.app/Contents/Resources/applet.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSPopUpButton.app/Contents/Resources/applet.icns
--------------------------------------------------------------------------------
/NSPopUpButton.app/Contents/Resources/applet.rsrc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSPopUpButton.app/Contents/Resources/applet.rsrc
--------------------------------------------------------------------------------
/NSPopUpButton.app/Contents/Resources/description.rtfd/TXT.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1326\cocoasubrtf110
2 | {\fonttbl}
3 | {\colortbl;\red255\green255\blue255;}
4 | }
--------------------------------------------------------------------------------
/NSSplitView.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleAllowMixedLocalizations
6 |
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | applet
11 | CFBundleIconFile
12 | applet
13 | CFBundleIdentifier
14 | com.apple.ScriptEditor.id.NSSplitView
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | NSSplitView
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | aplt
25 | LSMinimumSystemVersionByArchitecture
26 |
27 | x86_64
28 | 10.6
29 |
30 | LSRequiresCarbon
31 |
32 | WindowState
33 |
34 | bundleDividerCollapsed
35 |
36 | bundlePositionOfDivider
37 | 0.0
38 | dividerCollapsed
39 |
40 | eventLogLevel
41 | 2
42 | name
43 | ScriptWindowState
44 | positionOfDivider
45 | 421
46 | savedFrame
47 | 899 326 846 761 0 0 1920 1177
48 | selectedTab
49 | description
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/NSSplitView.app/Contents/MacOS/applet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSSplitView.app/Contents/MacOS/applet
--------------------------------------------------------------------------------
/NSSplitView.app/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPLaplt
--------------------------------------------------------------------------------
/NSSplitView.app/Contents/Resources/Scripts/main.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSSplitView.app/Contents/Resources/Scripts/main.scpt
--------------------------------------------------------------------------------
/NSSplitView.app/Contents/Resources/applet.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSSplitView.app/Contents/Resources/applet.icns
--------------------------------------------------------------------------------
/NSSplitView.app/Contents/Resources/applet.rsrc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSSplitView.app/Contents/Resources/applet.rsrc
--------------------------------------------------------------------------------
/NSSplitView.app/Contents/Resources/description.rtfd/TXT.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1334
2 | {\fonttbl}
3 | {\colortbl;\red255\green255\blue255;}
4 | }
--------------------------------------------------------------------------------
/NSTask.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleAllowMixedLocalizations
6 |
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | applet
11 | CFBundleIconFile
12 | applet
13 | CFBundleIdentifier
14 | com.apple.ScriptEditor.id.NSTask
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | NSTask
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | aplt
25 | LSMinimumSystemVersionByArchitecture
26 |
27 | x86_64
28 | 10.6
29 |
30 | LSRequiresCarbon
31 |
32 | WindowState
33 |
34 | bundleDividerCollapsed
35 |
36 | bundlePositionOfDivider
37 | 0.0
38 | dividerCollapsed
39 |
40 | eventLogLevel
41 | -1
42 | name
43 | ScriptWindowState
44 | positionOfDivider
45 | 456
46 | savedFrame
47 | 632 350 1081 743 0 0 1920 1177
48 | selectedTabView
49 | event log
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/NSTask.app/Contents/MacOS/applet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSTask.app/Contents/MacOS/applet
--------------------------------------------------------------------------------
/NSTask.app/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPLaplt
--------------------------------------------------------------------------------
/NSTask.app/Contents/Resources/Scripts/main.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSTask.app/Contents/Resources/Scripts/main.scpt
--------------------------------------------------------------------------------
/NSTask.app/Contents/Resources/applet.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSTask.app/Contents/Resources/applet.icns
--------------------------------------------------------------------------------
/NSTask.app/Contents/Resources/applet.rsrc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSTask.app/Contents/Resources/applet.rsrc
--------------------------------------------------------------------------------
/NSTask.app/Contents/Resources/description.rtfd/TXT.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1326\cocoasubrtf110
2 | {\fonttbl}
3 | {\colortbl;\red255\green255\blue255;}
4 | }
--------------------------------------------------------------------------------
/NSTextField.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleAllowMixedLocalizations
6 |
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | applet
11 | CFBundleIconFile
12 | applet
13 | CFBundleIdentifier
14 | com.apple.ScriptEditor.id.NSWindow
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | NSWindow
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | aplt
25 | LSMinimumSystemVersionByArchitecture
26 |
27 | x86_64
28 | 10.6
29 |
30 | LSRequiresCarbon
31 |
32 | WindowState
33 |
34 | bundleDividerCollapsed
35 |
36 | bundlePositionOfDivider
37 | 0.0
38 | dividerCollapsed
39 |
40 | eventLogLevel
41 | -1
42 | name
43 | ScriptWindowState
44 | positionOfDivider
45 | 702
46 | savedFrame
47 | 109 205 896 972 0 0 1920 1177
48 | selectedTabView
49 | event log
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/NSTextField.app/Contents/MacOS/applet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSTextField.app/Contents/MacOS/applet
--------------------------------------------------------------------------------
/NSTextField.app/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPLaplt
--------------------------------------------------------------------------------
/NSTextField.app/Contents/Resources/Scripts/main.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSTextField.app/Contents/Resources/Scripts/main.scpt
--------------------------------------------------------------------------------
/NSTextField.app/Contents/Resources/applet.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSTextField.app/Contents/Resources/applet.icns
--------------------------------------------------------------------------------
/NSTextField.app/Contents/Resources/applet.rsrc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSTextField.app/Contents/Resources/applet.rsrc
--------------------------------------------------------------------------------
/NSTextField.app/Contents/Resources/description.rtfd/TXT.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1326\cocoasubrtf110
2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;}
3 | {\colortbl;\red255\green255\blue255;}
4 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
5 |
6 | \f0\fs24 \cf0 A basic example of creating a Cocoa NSWindow using JavaScript for OS X.}
--------------------------------------------------------------------------------
/NSUserNotification.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleAllowMixedLocalizations
6 |
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | applet
11 | CFBundleIconFile
12 | applet
13 | CFBundleIdentifier
14 | com.apple.ScriptEditor.id.NSUserNotification
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | NSUserNotification
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | aplt
25 | LSMinimumSystemVersionByArchitecture
26 |
27 | x86_64
28 | 10.6
29 |
30 | LSRequiresCarbon
31 |
32 | WindowState
33 |
34 | bundleDividerCollapsed
35 |
36 | bundlePositionOfDivider
37 | 0.0
38 | dividerCollapsed
39 |
40 | eventLogLevel
41 | 0
42 | name
43 | ScriptWindowState
44 | positionOfDivider
45 | 853
46 | savedFrame
47 | 495 36 1305 1141 0 0 1920 1177
48 | selectedTab
49 | log
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/NSUserNotification.app/Contents/MacOS/applet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSUserNotification.app/Contents/MacOS/applet
--------------------------------------------------------------------------------
/NSUserNotification.app/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPLaplt
--------------------------------------------------------------------------------
/NSUserNotification.app/Contents/Resources/Scripts/main.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSUserNotification.app/Contents/Resources/Scripts/main.scpt
--------------------------------------------------------------------------------
/NSUserNotification.app/Contents/Resources/applet.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSUserNotification.app/Contents/Resources/applet.icns
--------------------------------------------------------------------------------
/NSUserNotification.app/Contents/Resources/applet.rsrc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSUserNotification.app/Contents/Resources/applet.rsrc
--------------------------------------------------------------------------------
/NSUserNotification.app/Contents/Resources/description.rtfd/TXT.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1334
2 | {\fonttbl}
3 | {\colortbl;\red255\green255\blue255;}
4 | }
--------------------------------------------------------------------------------
/NSWindow-growShrink.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleAllowMixedLocalizations
6 |
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | applet
11 | CFBundleIconFile
12 | applet
13 | CFBundleIdentifier
14 | com.apple.ScriptEditor.id.NSWindow-growShrink
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | NSWindow-growShrink
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | aplt
25 | LSMinimumSystemVersionByArchitecture
26 |
27 | x86_64
28 | 10.6
29 |
30 | LSRequiresCarbon
31 |
32 | WindowState
33 |
34 | bundleDividerCollapsed
35 |
36 | bundlePositionOfDivider
37 | 0.0
38 | dividerCollapsed
39 |
40 | eventLogLevel
41 | 2
42 | name
43 | ScriptWindowState
44 | positionOfDivider
45 | 421
46 | savedFrame
47 | 847 70 969 1107 0 0 1920 1177
48 | selectedTab
49 | description
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/NSWindow-growShrink.app/Contents/MacOS/applet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSWindow-growShrink.app/Contents/MacOS/applet
--------------------------------------------------------------------------------
/NSWindow-growShrink.app/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPLaplt
--------------------------------------------------------------------------------
/NSWindow-growShrink.app/Contents/Resources/Scripts/main.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSWindow-growShrink.app/Contents/Resources/Scripts/main.scpt
--------------------------------------------------------------------------------
/NSWindow-growShrink.app/Contents/Resources/applet.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSWindow-growShrink.app/Contents/Resources/applet.icns
--------------------------------------------------------------------------------
/NSWindow-growShrink.app/Contents/Resources/applet.rsrc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSWindow-growShrink.app/Contents/Resources/applet.rsrc
--------------------------------------------------------------------------------
/NSWindow-growShrink.app/Contents/Resources/description.rtfd/TXT.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1339
2 | {\fonttbl}
3 | {\colortbl;\red255\green255\blue255;}
4 | }
--------------------------------------------------------------------------------
/NSWindow-minMaxSizes.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleAllowMixedLocalizations
6 |
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | applet
11 | CFBundleIconFile
12 | applet
13 | CFBundleIdentifier
14 | com.apple.ScriptEditor.id.NSWindow-minMaxSizes
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | NSWindow-minMaxSizes
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | aplt
25 | LSMinimumSystemVersionByArchitecture
26 |
27 | x86_64
28 | 10.6
29 |
30 | LSRequiresCarbon
31 |
32 | WindowState
33 |
34 | bundleDividerCollapsed
35 |
36 | bundlePositionOfDivider
37 | 0.0
38 | dividerCollapsed
39 |
40 | eventLogLevel
41 | 2
42 | name
43 | ScriptWindowState
44 | positionOfDivider
45 | 618
46 | savedFrame
47 | 948 407 904 770 0 0 1920 1177
48 | selectedTab
49 | description
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/NSWindow-minMaxSizes.app/Contents/MacOS/applet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSWindow-minMaxSizes.app/Contents/MacOS/applet
--------------------------------------------------------------------------------
/NSWindow-minMaxSizes.app/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPLaplt
--------------------------------------------------------------------------------
/NSWindow-minMaxSizes.app/Contents/Resources/Scripts/main.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSWindow-minMaxSizes.app/Contents/Resources/Scripts/main.scpt
--------------------------------------------------------------------------------
/NSWindow-minMaxSizes.app/Contents/Resources/applet.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSWindow-minMaxSizes.app/Contents/Resources/applet.icns
--------------------------------------------------------------------------------
/NSWindow-minMaxSizes.app/Contents/Resources/applet.rsrc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSWindow-minMaxSizes.app/Contents/Resources/applet.rsrc
--------------------------------------------------------------------------------
/NSWindow-minMaxSizes.app/Contents/Resources/description.rtfd/TXT.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1334
2 | {\fonttbl}
3 | {\colortbl;\red255\green255\blue255;}
4 | }
--------------------------------------------------------------------------------
/NSWindow.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleAllowMixedLocalizations
6 |
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | applet
11 | CFBundleIconFile
12 | applet
13 | CFBundleIdentifier
14 | com.apple.ScriptEditor.id.NSWindow
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | NSWindow
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | aplt
25 | LSMinimumSystemVersionByArchitecture
26 |
27 | x86_64
28 | 10.6
29 |
30 | LSRequiresCarbon
31 |
32 | WindowState
33 |
34 | bundleDividerCollapsed
35 |
36 | bundlePositionOfDivider
37 | 0.0
38 | dividerCollapsed
39 |
40 | eventLogLevel
41 | -1
42 | name
43 | ScriptWindowState
44 | positionOfDivider
45 | 494
46 | savedFrame
47 | 136 274 977 798 0 0 1920 1177
48 | selectedTabView
49 | event log
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/NSWindow.app/Contents/MacOS/applet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSWindow.app/Contents/MacOS/applet
--------------------------------------------------------------------------------
/NSWindow.app/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPLaplt
--------------------------------------------------------------------------------
/NSWindow.app/Contents/Resources/Scripts/main.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSWindow.app/Contents/Resources/Scripts/main.scpt
--------------------------------------------------------------------------------
/NSWindow.app/Contents/Resources/applet.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSWindow.app/Contents/Resources/applet.icns
--------------------------------------------------------------------------------
/NSWindow.app/Contents/Resources/applet.rsrc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tylergaw/js-osx-app-examples/3ab7df3cbade9715befcb54d9e537cf9b81086f6/NSWindow.app/Contents/Resources/applet.rsrc
--------------------------------------------------------------------------------
/NSWindow.app/Contents/Resources/description.rtfd/TXT.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\cocoartf1326\cocoasubrtf110
2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;}
3 | {\colortbl;\red255\green255\blue255;}
4 | \vieww10800\viewh8400\viewkind0
5 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
6 |
7 | \f0\fs24 \cf0 A basic example of creating a Cocoa NSWindow using JavaScript for OS X.}
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # JavaScript OS X App Examples
2 |
3 | ### Updates
4 |
5 | **06/15 - OS X 10.11 Release Notes**
6 |
7 | OS X 10.11 includes a number of updates to JSX https://developer.apple.com/library/prerelease/mac/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/Articles/OSX10-11.html#//apple_ref/doc/uid/TP40014508-CH110-SW1
8 |
9 | Sandboxing info: https://developer.apple.com/library/prerelease/mac/qa/qa1888/_index.html#//apple_ref/doc/uid/DTS40015156
10 |
11 | **09/02/14 - YOSEMITE DEVELOPER PREVIEW 7 NOTE:**
12 |
13 | Developer preview 7 has fixed the major issues that were in dev preview 5. All of
14 | the demos are working again.
15 |
16 | I updated the Radar: http://openradar.appspot.com/radar?id=6472227281174528
17 |
18 | **08/14/14 - YOSEMITE DEVELOPER PREVIEW 5/6 NOTE:**
19 |
20 | A good number of the demos are crashing. Any demo that has a button that you can click
21 | that does something will crash. (HandleBtnClick, NSOpenPanel, etc.)
22 |
23 | I have a question up on the Apple dev forums:
24 | https://devforums.apple.com/thread/240935?tstart=150
25 |
26 | I've submitted a bug to Apple, and it's copied on Radar:
27 | http://openradar.appspot.com/radar?id=6472227281174528
28 |
29 | ### What is this?
30 |
31 | Starting with OS X 10.10, Yosemite you can use JavaScript to create native Cocoa
32 | applications. I wrote a [big ole post](http://tylergaw.com/articles/building-osx-apps-with-js) to help get you started.
33 |
34 | This is a collection of examples showing how to create many of the common components
35 | used in OS X Applications. The goal is to help people learn how to build apps
36 | by showing clear, atomic examples.
37 |
38 | These aren't exhaustive examples. Most of them are as basic as possible. The idea
39 | isn't to show everything that can be done, it's to give a solid foundation to get you started.
40 |
41 | ### Running
42 | You can run any of the example apps by double clicking them.
43 |
44 | If you are running the app while editing from Script Editor, there are two different ways.
45 | Script > Run (cmd + r) is the normal run. This can be good for quick debugging, but
46 | the app will not act like the application and is usually not what you want. You'll
47 | want Script > Run Application (cmd + opt + r).
48 |
49 | ### Editing
50 | To view and edit the code for each example you will need to use the Script Editor
51 | application. It is located in Applications > Utilities > Script Editor. From there
52 | you can either File > Open any of the example apps or drag the example app icon
53 | to the Script Editor in the dock.
54 |
55 | ### How to create an app
56 | Since using JavaScript to create apps is new there's not much documentation. We've
57 | had the ability to do all of this with AppleScript for years, but I haven't had
58 | much luck finding thorough docs on that either.
59 |
60 | Here's a couple of gotchas that had me scratching my head for some time.
61 |
62 | To create a new application:
63 | - Open a new document in Script Editor cmd+n
64 | - Save the document cmd+s
65 | - When prompted with the Save dialog, name your app, set the file format to Application, and
66 | make sure you check the Stay open after run handler option.
67 |
68 | 
69 |
70 | **NOTE**: If you do not check the Stay open... option on the save dialog there does
71 | not appear to be a way to update this later. (I hope I'm wrong, but haven't found a way to do it yet).
72 | If the option isn't checked pretty much nothing is going to work how you expect it.
73 |
74 | ### Code Signing
75 | Apps created this way can be code signed. Signing your app is helpful if you are
76 | planning to distribute it to other people. Code Signing is a broad topic, for details
77 | check out [http://macosxautomation.com/mavericks/codesign/index.html](http://macosxautomation.com/mavericks/codesign/index.html)
78 |
79 | ### Reference
80 | [JavaScript for Automation Release Notes](https://developer.apple.com/library/prerelease/mac/releasenotes/interapplicationcommunication/rn-javascriptforautomation/index.html)
81 |
82 | Check out the WWDC presentation on [JavaScript for Automation](https://developer.apple.com/videos/wwdc/2014/)
83 | You'll need an Apple Developer Account.
84 |
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
1 | # What’s This?
2 |
3 | While learning how to use JavaScript for Automation I’ve run into no shortage of
4 | snags. I’ve looked to the [https://devforums.apple.com/](Apple Developer Forums) for help.
5 |
6 | The forums can be helpful, but I don’t like that all that valuable information is
7 | stuck behind a login and unsearchable. I’m going to copy the content of threads
8 | to files here.
9 |
10 | I may edit some of the content for copy or clarity.
11 |
--------------------------------------------------------------------------------
/docs/javascript-osa-add-track-to-itunes-playlist.md:
--------------------------------------------------------------------------------
1 | #Javascript OSA, add track to iTunes playlist
2 | https://devforums.apple.com/message/1044316
3 |
4 | ### [forumuser*] Jul 15, 2014 12:20 PM
5 |
6 | I'm trying to get a track from one playlist and then add it to another playlist using Javascript in the ScriptEditor. To illustrate what I want to do, here is a working _AppleScript_ doing exactly the correct thing:
7 |
8 | ```
9 | tell application "iTunes"
10 |
11 | set sourcePlaylistName to "Source"
12 | set targetPlaylistName to "Target"
13 |
14 | set sourcePlaylist to user playlist sourcePlaylistName
15 | set targetPlaylist to user playlist targetPlaylistName
16 |
17 | set sourceTrack to first track of sourcePlaylist
18 |
19 | duplicate sourceTrack to targetPlaylist
20 |
21 | end tell
22 | ```
23 |
24 | I'm sorry the Javascript version is not as neat looking, because I have sprinkled console.logs to try to sort out what is going wrong:
25 |
26 | ```javascript
27 | var sourcePlaylistName = "Source";
28 | var targetPlaylistName = "Target";
29 |
30 | var iTunes = Application("iTunes");
31 | var library = iTunes.sources[0];
32 | var sourcePlaylist = library.playlists[sourcePlaylistName];
33 | var targetPlaylist = library.playlists[targetPlaylistName];
34 |
35 |
36 | console.log("sourcePlaylist name: " + sourcePlaylist.name() + " track count: " + sourcePlaylist.tracks.length);
37 | var sourceTrack = sourcePlaylist.tracks[0];
38 | console.log("sourceTrack.name: " + sourceTrack.name());
39 |
40 | console.log("targetPlaylist name: " + targetPlaylist.name() + " track count: " + targetPlaylist.tracks.length);
41 |
42 | //targetPlaylist.tracks.push(sourceTrack); // --> Error -1700: Can't convert types.
43 | console.log("Duplicating...")
44 | iTunes.duplicate(sourceTrack, targetPlaylist);
45 |
46 | console.log("sourcePlaylist name: " + sourcePlaylist.name() + " track count: " + sourcePlaylist.tracks.length);
47 | console.log("targetPlaylist name: " + targetPlaylist.name() + " track count: " + targetPlaylist.tracks.length);
48 |
49 | ```
50 |
51 | The output of running the Javascript version is:
52 |
53 | ```
54 | /* sourcePlaylist name: Source track count: 1 */
55 | /* sourceTrack.name: They're Coming To Take Me Away Ha-Haaa! */
56 | /* targetPlaylist name: Target track count: 0 */
57 | /* Duplicating... */
58 | /* sourcePlaylist name: Source track count: 2 */
59 | /* targetPlaylist name: Target track count: 0 */
60 | ```
61 |
62 | As you can see, the track is duplicated into the source playlist rather than being added to the target playlist, as if the targetPlaylist is being ignored in the duplicate. The events for the Javascript version are:
63 |
64 | ```
65 | app = Application("iTunes")
66 |
67 | app.sources.at(0).playlists.byName("Source").name()
68 |
69 | app.sources.at(0).playlists.byName("Source").tracks.length
70 |
71 | /* sourcePlaylist name: Source track count: 1 */
72 |
73 | app = Application("iTunes")
74 |
75 | app.sources.at(0).playlists.byName("Source").tracks.at(0).name()
76 |
77 | /* sourceTrack.name: They're Coming To Take Me Away Ha-Haaa! */
78 |
79 | app = Application("iTunes")
80 |
81 | app.sources.at(0).playlists.byName("Target").name()
82 |
83 | app.sources.at(0).playlists.byName("Target").tracks.length
84 |
85 | /* targetPlaylist name: Target track count: 0 */
86 |
87 | /* Duplicating... */
88 |
89 | app = Application("iTunes")
90 |
91 | app.duplicate(app.sources.at(0).playlists.byName("Source").tracks.at(0))
92 |
93 | app.sources.at(0).playlists.byName("Source").name()
94 |
95 | app.sources.at(0).playlists.byName("Source").tracks.length
96 |
97 | /* sourcePlaylist name: Source track count: 2 */
98 |
99 | app = Application("iTunes")
100 |
101 | app.sources.at(0).playlists.byName("Target").name()
102 |
103 | app.sources.at(0).playlists.byName("Target").tracks.length
104 |
105 | /* targetPlaylist name: Target track count: 0 */
106 | ```
107 |
108 | And, indeed, it does seem like the duplicate only has one argument.
109 |
110 | Can anyone spot where I'm going wrong?
111 |
112 | As an aside, I initially tried the push (which is commented out in the Javascript) and that returns an error. I tried that because I recalled a slide from the WWDC presentation which pushed a new mail message into the Outgoing Messages. It seems like the push would be a more sensible solution than the duplicate, so if you can help me get that working, I'd appreciate it.
113 |
114 | Thank you
115 |
116 | ** *I'm not sure I should name other users in these docs? **
117 |
118 | ### Tyler Gaw - Aug 20, 2014 12:50 PM
119 |
120 | Hey [forumuser], it's been a while so not sure if you're still looking for input on this, but I spent some time and got it working. It definitely had me scratching my head for while too.
121 |
122 | The duplicate method takes an optional second parameter for where to duplicate the track. That parameter needs to be an object with a "to" member.
123 |
124 | ```
125 | track.duplicate({to: targetPlaylist});
126 | ```
127 |
128 | The docs for that–and all the similar docs–aren't very clear. Could just be some weirdness in the transition to JS I suppose. I found out that worked by just trying a bunch of stuff until something worked.
129 |
130 | I wrote the script a bit different than your example. I'm not sure that accessing playlists by there name is supported anymore so
131 |
132 | ```
133 | var sourcePlaylist = library.playlists[sourcePlaylistName];
134 | ```
135 |
136 | would need to be changed. I wrote a quick function to find playlists by name to do something similar. Here's my full script
137 |
138 | ```javascript
139 | var iTunes = Application("iTunes");
140 |
141 | var library = iTunes.sources[0];
142 | var sourcePlaylist = getPlaylistByName(library.playlists, "Source");
143 | var targetPlaylist = getPlaylistByName(library.playlists, "Target");
144 |
145 | var track = sourcePlaylist.tracks[0];
146 | track.duplicate({to: targetPlaylist});
147 |
148 |
149 | console.log("Duplicated " + track.name() + " to " + targetPlaylist.name());
150 |
151 | function getPlaylistByName (lists, listName) {
152 | var playlist = null;
153 |
154 |
155 | for (var i = 0; i < lists.length; i += 1) {
156 | var l = lists[i];
157 | if (l.name() == listName) {
158 | playlist = l;
159 | break;
160 | }
161 | }
162 |
163 | return playlist;
164 | }
165 | ```
166 |
167 | ### [forumuser*] Sep 17, 2014 7:59 AM
168 |
169 | Tyler, Thanks so much for the thorough response; I had in fact given up on the whole thing and decided to do what I wanted to do by writing out an xml file, reading it in Swift and writing another xml file and importing that in iTunes! So, your answer provides a gleam of hope that I can get back to a less cumbersome workflow.
170 |
171 | I would never have come up with '{to: targetPlaylist}' unless I had accidentally typed it whilst bashing my head against the keyboard in frustration.
172 |
--------------------------------------------------------------------------------
/docs/js-closure-causing-odd-behavior-with-jxa.md:
--------------------------------------------------------------------------------
1 | # RESOLVED
2 |
3 | # JS closure causing odd behavior with JXA
4 | https://forums.developer.apple.com/thread/5208
5 |
6 | ### Tyler Gaw - June 14, 2015 12:52 PM EST
7 |
8 | I'm using JXA to build Cocoa applications and running into a strange issue when attempting to wrap all an app's JavaScript with an immediately-invoked function expression.
9 |
10 | **What's the issue?**
11 |
12 | If the code for an app with a single NSWindow is wrapped in an immediately-invoked function, the app's window will close on it's own without any type of application crash. The app stays running.
13 |
14 | **Here's the code I'm using:**
15 |
16 | ```javascript
17 | (function() {
18 | ObjC.import("Cocoa");
19 | var styleMask = $.NSTitledWindowMask | $.NSClosableWindowMask | $.NSResizableWindowMask | $.NSMiniaturizableWindowMask;
20 | var window = $.NSWindow.alloc.initWithContentRectStyleMaskBackingDefer(
21 | $.NSMakeRect(0, 0, 800, 400),
22 | styleMask,
23 | $.NSBackingStoreBuffered,
24 | false
25 | );
26 | window.center;
27 | window.title = 'NSWindow Closure Bug?';
28 | window.makeKeyAndOrderFront(window);
29 | }());
30 | ```
31 |
32 | Here's the example application https://dl.dropboxusercontent.com/u/271215/jsclosurebugexample.zip or recreate it with
33 | - Script Editor > New
34 | - Copy/paste the above code
35 | - Save > File Format: Application, Options: Stay open after run handler (important)
36 |
37 | Then Script > Run Application or double-click the application icon. That should open the app which is a single NSWindow.
38 |
39 | If you leave the app running and window open, after about 2 min the window will close. The app stays running, just the window closes as if you'd clicked the "x" button. This does not happen if the wrapping function is removed like:
40 |
41 | ```javascript
42 | ObjC.import("Cocoa");
43 | var styleMask = $.NSTitledWindowMask | $.NSClosableWindowMask | $.NSResizableWindowMask | $.NSMiniaturizableWindowMask;
44 | var window = $.NSWindow.alloc.initWithContentRectStyleMaskBackingDefer(
45 | $.NSMakeRect(0, 0, 800, 400),
46 | styleMask,
47 | $.NSBackingStoreBuffered,
48 | false
49 | );
50 | window.center;
51 | window.title = 'NSWindow Closure Bug?';
52 | window.makeKeyAndOrderFront(window);
53 | ```
54 |
55 | **Why do I want to wrap the code in an immediately-invoked function?**
56 |
57 | I'm starting to use JavaScript build processes to write JXA. I want to separate JS into modules and then compile them into a single JS file that will be compiled with osacompile to create the script needed for the application. In this case, I'm using Browserify which wraps all loaded modules in a similar function.
58 |
59 | **What have I tried?**
60 |
61 | When a window closes, the windowWillClose: message is sent. In another version of the above example I implemented an NSWindow delete and added an NSLog to the windowWillClose: message. If you close the window manually, the message is sent and the NSLog is trigger. When the window closes automatically, the message is not sent and the log isn't...logged.
62 |
63 | Example:
64 |
65 | ```javascript
66 | (function() {
67 | ObjC.import("Cocoa");
68 |
69 | ObjC.registerSubclass({
70 | name: "WindowDelegate",
71 | methods: {
72 | "windowWillClose:": {
73 | types: ["void", ["id"]],
74 | implementation: function(sender) {
75 | $.NSLog('CLOSED THE WINDOW');
76 | }
77 | }
78 | }
79 | });
80 |
81 | var windowDelegate = $.WindowDelegate.alloc.init;
82 | var styleMask = $.NSTitledWindowMask | $.NSClosableWindowMask | $.NSResizableWindowMask | $.NSMiniaturizableWindowMask;
83 | var window = $.NSWindow.alloc.initWithContentRectStyleMaskBackingDefer(
84 | $.NSMakeRect(0, 0, 800, 400),
85 | styleMask,
86 | $.NSBackingStoreBuffered,
87 | false
88 | );
89 | window.delegate = windowDelegate;
90 |
91 |
92 | window.center;
93 | window.title = 'NSWindow Closure Bug?';
94 | window.makeKeyAndOrderFront(window);
95 | }());
96 | ```
97 |
98 | ## Solution
99 | ### [username withheld cause I'm not sure I should share it] - June 23, 2015 3:52 PM EST
100 |
101 | You must be experiencing JavaScript's garbage collection here. When the immediately invoked closure is cleaned up, the variables created inside are cleaned up as well (and your window goes away, because it has no variable referencing it anymore). To keep the window around, you will need a persistent variable in the global scope (which is why the non-closure version worked for you). You can accomplish this by either having a window variable outside of the closure that you set to an NSWindow inside the closure or declaring the window variable without the "var" keyword inside the closure (which will declare the window variable in the global scope). Here is code demonstrating these two approaches:
102 |
103 | ```javascript
104 | var globalWindow = null;
105 |
106 | (function() {
107 |
108 | ObjC.import('Cocoa');
109 |
110 | // Helper function for window creation
111 | function windowWithTitle(title) {
112 |
113 | var window = $.NSWindow.alloc.initWithContentRectStyleMaskBackingDefer(
114 | $.NSMakeRect(0, 0, 800, 400),
115 | $.NSTitledWindowMask | $.NSClosableWindowMask | $.NSResizableWindowMask | $.NSMiniaturizableWindowMask,
116 | $.NSBackingStoreBuffered,
117 | false
118 | );
119 |
120 | window.center;
121 | window.title = title;
122 | window.makeKeyAndOrderFront(window);
123 |
124 | return window;
125 | }
126 |
127 | // Create one local window and two global windows
128 | var localWindow = windowWithTitle('I will disappear');
129 | globalWindow = windowWithTitle('I will stick around');
130 | anotherGlobalWindow = windowWithTitle('I will also stick around');
131 | }());
132 | ```
133 |
--------------------------------------------------------------------------------
/docs/subclass-using-NSUserNotificationCenterDelegate.md:
--------------------------------------------------------------------------------
1 | # Subclass using NSUserNotificationCenterDelegate in JavaScript for Automation
2 | https://devforums.apple.com/message/1023636#1023636
3 |
4 | ### Tyler Gaw - Aug 14, 2014 2:10 PM
5 |
6 | I'm attempting to register a subclass–using ObjC.registerSubclass–that conforms
7 | to NSUserNotificationCenterDelegate. I'm doing this create a demo where
8 | NSUserNotifications are shown even when my app is the key application. To do that,
9 | I need to override userNotificationCEnter:shouldPresentNotification:
10 |
11 | I'm not getting any errors, it just appears to be choking on something while
12 | attempting to register. The two calls to NSLog I've been using to see if **anything**
13 | will happen.
14 |
15 | The code I have so far.
16 |
17 | ```javascript
18 | ObjC.import("Cocoa");
19 |
20 | $.NSLog("This will be logged");
21 |
22 | ObjC.registerSubclass({
23 | name: "MyNotification",
24 | protocols: ["NSUserNotificationCenterDelegate"],
25 | methods: {
26 | "userNotificationCenterShouldPresentNotification:": {
27 | implementation: function (center, notification) {
28 | return true;
29 | }
30 | }
31 | }
32 | });
33 |
34 | $.NSLog("This will not be logged");
35 | ```
36 |
37 | ### Tyler Gaw - Aug 14, 2014 6:13 PM
38 |
39 | A bit more info: I do have the file saved as an Application and I have the Stay
40 | open after run handler option checked.
41 |
42 | ### Tyler Gaw - Aug 14, 2014 7:40 PM
43 |
44 | Guess I just needed to keep picking at it. I have it working now, and found
45 | something interesting about ObjC.registerSubclass. Not sure if it's a bug or
46 | intentional.
47 |
48 | ```javascript
49 | ObjC.import("Cocoa");
50 |
51 | ObjC.registerSubclass({
52 | name: "MyNotification",
53 | methods: {
54 | "userNotificationCenter:shouldPresentNotification:": {
55 | types: ["bool", ["id", "id"]],
56 | implementation: function (center, notification) {
57 | return true;
58 | }
59 | }
60 | }
61 | });
62 | ```
63 |
64 | I found out that the main culprit was my inclusion of NSUserNotificationCenterDelegate
65 | in the protocols list. If protocol is included the registering of the subclass–and
66 | anything after it–will fail silently. Leaving out the protocol had an effect on
67 | the methods. I now have to have the types member of any methods. According to the
68 | initial JS for Automation session video you do not have to include the types if
69 | you are overriding a method of an existing class or protocol. Since I have to remove
70 | the protocol, the types are needed. BTW: I couldn't find any docs on that types array
71 | so as I understand it, it goes like this: types: ["the return type", ["arg 1 type", "arg 2 type"]].
72 | There is an explanation of available types in the JS for automation release notes.
73 |
74 | Only thing to note. Since I need to use a method of NSUserNotificationCenterDelegate,
75 | the method signature needs to be exactely as it is in the docs. Meaning, you do
76 | not remove any colons ":" separating parts. I assumed that those names would be
77 | treated like other methods where "userNotificationCenter:shouldPresentNotification:"
78 | should have been "userNotificationCenterShouldPresentNotification:". That was an
79 | incorrect assumption.
80 |
81 | OK, hopefully all of that is helpful to someone else. For reference, here is my
82 | full script that displays a notification even if the app is the key application.
83 | Happy coding!
84 |
85 | ```javascript
86 | ObjC.import("Cocoa");
87 |
88 | ObjC.registerSubclass({
89 | name: "MyNotification",
90 | methods: {
91 | "userNotificationCenter:shouldPresentNotification:": {
92 | types: ["bool", ["id", "id"]],
93 | implementation: function (center, notification) {
94 | return true;
95 | }
96 | }
97 | }
98 | });
99 |
100 | var myNotification = $.MyNotification.alloc.init;
101 |
102 | $.NSUserNotificationCenter.defaultUserNotificationCenter.delegate = myNotification;
103 |
104 | function showNotification (title, msg) {
105 | var notification = $.NSUserNotification.alloc.init;
106 | notification.title = title;
107 | notification.informativeText = msg;
108 | notification.soundName = $.NSUserNotificationDefaultSoundName;
109 | $.NSUserNotificationCenter.defaultUserNotificationCenter.deliverNotification(notification);
110 | }
111 |
112 | showNotification("Hello World", "This is a user notification.");
113 | ```
114 |
115 | NOTE: A working example of the code in this thread can be found in the example app NSUserNotification.app
116 |
--------------------------------------------------------------------------------
/docs/webview-not-rendering-html.md:
--------------------------------------------------------------------------------
1 | # (NOTE: UNRESOLVED)
2 |
3 | # JS for Automation: WebView not rendering HTML
4 | https://devforums.apple.com/message/1034879#1034879
5 |
6 | ### Tyler Gaw - Sep 5, 2014 2:28 AM
7 |
8 | Using JavaScript for Automation, I'm attempting to build a simple app that displays a web site in a WebKit WebView. WebKit seems to import as it should and I'm able to create the WebView and add it to the main NSWindow. I can load a URL using loadRequest and the page displays. However, it's rendered as plain text. No HTML, CSS, or JS is rendered in the WebView. This is the same will all URLs.
9 |
10 | Can anyone tell if I'm missing something in the configuration of the WebView or something else?
11 |
12 | Here's the app: https://www.dropbox.com/s/l35o42816rlcofm/TestWebView.zip?dl=0 You will need Yosemite Dev Preview. (best to have the latest, 7)
13 |
14 | and here's the full code:
15 |
16 | ```javascript
17 | ObjC.import("Cocoa");
18 | ObjC.import("WebKit");
19 |
20 | var url = $.NSURL.alloc.initWithString("http://craigslist.org");
21 | var req = $.NSURLRequest.requestWithURL(url);
22 |
23 | var styleMask = $.NSTitledWindowMask | $.NSClosableWindowMask | $.NSMiniaturizableWindowMask | $.NSTexturedBackgroundWindowMask;
24 |
25 | var window = $.NSWindow.alloc.initWithContentRectStyleMaskBackingDefer(
26 | $.NSMakeRect(0, 0, 600, 400),
27 | styleMask,
28 | $.NSBackingStoreBuffered,
29 | false
30 | );
31 |
32 | var webview = $.WebView.alloc.initWithFrameFrameNameGroupName(
33 | window.contentView.bounds,
34 | "framename",
35 | "groupname"
36 | );
37 |
38 | webview.mainFrame.loadRequest(req);
39 |
40 | window.contentView.addSubview(webview);
41 | window.center;
42 | window.title = "WebView Example";
43 | window.makeKeyAndOrderFront(window);
44 | ```
45 |
--------------------------------------------------------------------------------