├── .gitignore
├── README.md
├── compiled source
├── bin
│ ├── q_json.helper
│ │ └── Contents
│ │ │ ├── Frameworks
│ │ │ └── Appscript.framework
│ │ │ │ ├── Appscript
│ │ │ │ ├── Headers
│ │ │ │ ├── Resources
│ │ │ │ └── Versions
│ │ │ │ ├── A
│ │ │ │ ├── Appscript
│ │ │ │ ├── Headers
│ │ │ │ │ ├── Appscript.h
│ │ │ │ │ ├── appdata.h
│ │ │ │ │ ├── application.h
│ │ │ │ │ ├── base.h
│ │ │ │ │ ├── bridgedata.h
│ │ │ │ │ ├── codecs.h
│ │ │ │ │ ├── command.h
│ │ │ │ │ ├── constant.h
│ │ │ │ │ ├── event.h
│ │ │ │ │ ├── objectrenderer.h
│ │ │ │ │ ├── parser.h
│ │ │ │ │ ├── reference.h
│ │ │ │ │ ├── referencerenderer.h
│ │ │ │ │ ├── sendthreadsafe.h
│ │ │ │ │ ├── specifier.h
│ │ │ │ │ ├── terminology.h
│ │ │ │ │ ├── test.h
│ │ │ │ │ ├── types.h
│ │ │ │ │ ├── unittype.h
│ │ │ │ │ └── utils.h
│ │ │ │ ├── Resources
│ │ │ │ │ ├── BridgeSupport
│ │ │ │ │ │ └── Appscript.bridgesupport
│ │ │ │ │ └── Info.plist
│ │ │ │ └── _CodeSignature
│ │ │ │ │ └── CodeResources
│ │ │ │ └── Current
│ │ │ ├── Info.plist
│ │ │ ├── MacOS
│ │ │ └── JSON Helper
│ │ │ ├── PkgInfo
│ │ │ ├── Resources
│ │ │ ├── English.lproj
│ │ │ │ ├── InfoPlist.strings
│ │ │ │ └── MainMenu.nib
│ │ │ ├── JSON Helper.sdef
│ │ │ └── json.icns
│ │ │ └── _CodeSignature
│ │ │ └── CodeResources
│ └── q_notifier.helper
└── q_workflow.scpt
├── documentation
└── Documentation.md
├── example workflows
├── README.md
├── Search Twitter.alfredworkflow
├── iTunes Ratings.alfredworkflow
└── screenshots
│ ├── screenshot.jpg
│ ├── screenshot2.jpg
│ ├── screenshot3.jpg
│ ├── screenshot4.jpg
│ └── screenshot5.jpg
└── uncompiled source
└── q_workflow.applescript
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #qWorkflow Library
2 |
3 | ##A. Introduction
4 | This is an AppleScript library for creating workflows with Alfred 2. This library provides an object-oriented class with functions for working with plist settings files, reading and writing data to files, generating Alfred feedback results, requesting remote data, and more (make sure you read the [FULL DOCUMENTATION](https://github.com/qlassiqa/qWorkflow/blob/master/documentation/Documentation.md) to get a grip on how to properly use this library).
5 |
6 | It was originally created by [David Ferguson using PHP](https://github.com/jdfwarrior/Workflows), and was entirely rewritten by me using AppleScript to provide the same functionality to all my fellow AppleScript lovers.
7 |
8 | So you may be asking yourself:
9 |
10 | * ***why on Earth would I use AppleScript when I already have PHP, Python, Ruby, Bash, etc.?*** - yes, it's true, Alfred can be scripted using all those languages, but ask yourself this: **are you able to control MacOS and its Apps using those languages?** I'm afraid not, and this is where AppleScript comes to help.
11 |
12 | * ***but isn't it simpler to use my PHP / Python / etc. skills and combine them with AppleScript inside Alfred?*** Actually no, it isn't simpler - I've tried it, and it becomes really messy, not to mention that Alfred's workflow system doesn't allow that much mixing.
13 |
14 | **NOTE:** the `compiled source` folder contains the ready-to-use library script (the files inside this folder should be put inside your Alfred workflow's folder); the `uncompiled source` folder contains the plain .applescript file that you can view online, and it contains fully commented code to better understand what I did there.
15 |
16 | ##B. Features
17 | There are a lot of things you can do with this library to make your life a lot easier when creating & programming your Alfred Workflows, so here's a list of the most important features (the list will grow while I improve the library):
18 |
19 | * **object-oriented approach** to write less & more readable code
20 | * internal **workflow introspection** (finding the bundle ID, cache & storage paths)
21 | * generate Alfred-compatible **XML feedback** with ease
22 | * saving & retrieving **workflow-related settings**
23 | * **remote data requests**, as well as **JSON support** (thanks to David @[Mousedown Software](http://www.mousedown.net/mouseware/index.html))
24 | * **sending notifications** through the Notification Center (thanks to [Daji-Djan](https://github.com/Daij-Djan/DDMountainNotifier))
25 | * various **internal utilities that improve AppleScript** (string and date manipulation, file system utilities)
26 |
27 | ##C. Known Limitations
28 | Now, because AppleScript is a bit limited in terms of capabilities, some functionality isn't available right now, but I will try to improve this library further.
29 |
30 | * **no JSONP support yet** - AppleScript doesn't know anything about JSON or JSONP, so I had to get help from [Mousedown Software](http://www.mousedown.net/mouseware/index.html), and they provided me with a fully functional and really fast JSON helper for which I've made a wrapper to embed it inside my library, and hopefully they will add JSONP support in the near feature; but until then you will have to make sure you're only working with JSON data
31 |
32 | * **strict syntax for accessing JSON properties** - the [JSON Helper](http://www.mousedown.net/mouseware/JSONHelper.html) that I'm using to add JSON capabilities to this library parses JSON data and converts it to native AppleScript lists and records, and it's obvious that some JSON properties will have the same name as AppleScript's reserved keywords, so to avoid any syntax issues it's highly recommended that you enclose all JSON property names in vertical bar characters, like so: `|text| of |result| of item 1 of json` (both `text` and `result` are reserved keywords in the AppleScript language, and not using the vertical bars would trigger errors in your code)
33 |
34 | * **bigger file size** - since AppleScript requires extra coding for text manipulation and object handling, the file size is a bit large compared to the PHP equivalent, and it will probably increase as I add new features to it (features that are totally worth the size increase)
35 |
36 | * **strict syntax for plist records** - it's known that AppleScript's records are a bit clumsy since they lack so many features, that's why when saving a list of records as a PList settings file you should adhere to the following strict record notation:
37 |
38 | ```
39 | {
40 | {theKey:"someKeyName", theValue: "textValue"},
41 | {theKey:"mynum", theValue: 2},
42 | {theKey: "booltest", theValue: false},
43 | {theKey:"na", theValue: missing value}
44 | }
45 | ```
46 |
47 | ##D. Initialization
48 | Before you write any code, it's imperative that you copy the `q_workflow.scpt` library file.
49 |
50 |
NOTE: If you plan to use the NotificationCenter methods to trigger notifications or if you plan on using the JSON capabilities of this library, then it's vital that you also copy the `bin` folder to your Workflow folder "as is" since it contains the helper utilities that provide these extra features. Note that trying to send notifications or read JSON without having the bin folder in your Workflow folder will produce no result (and yes, the utilities have to stay inside the bin folder at all time with the current filenames for this to work).
51 |
52 | ```
53 | set workflowFolder to do shell script "pwd"
54 | set wlib to load script POSIX file (workflowFolder & "/q_workflow.scpt")
55 | set wf to wlib's new_workflow()
56 | ```
57 |
58 | or by specifying a bundle name:
59 |
60 | ```
61 | ...
62 | set wf to wlib's new_workflow_with_bundle("com.mycompany.mybundlename")
63 | ```
64 |
65 | **Explanations:**
66 | * the first line determines the Alfred workflow's bundle path because this is where the "q_workflow.scpt" library should be placed in order to work
67 |
68 | * the second line loads the library from the bundle's path assuming that you already placed it there
69 |
70 | * the last line creates a new script object (the equivalent of a class in other languages) with all the required functionality
71 |
72 | * since AppleScript doesn't support optional parameters, there are 2 constructors: `new_workflow()` with no parameters, which creates a new class that automatically fetches the bundle name from Alfred, and `new_workflow_with_bundle()`, which takes 1 parameter with the desired bundle name if none was specified in Alfred.
73 |
74 | ##E. Methods
75 | For more info, tips and examples on how to use the following methods, please consult the accompanying documentation (again, it is vital that you look at the [FULL DOCUMENTATION](https://github.com/qlassiqa/qWorkflow/blob/master/documentation/Documentation.md) to get a grip on how to properly use this library).
76 |
77 | This library provides 2 categories of methods, namely **workflow methods** and **utility methods**. Workflow methods can be used only after creating a new workflow class (these are also known as instance methods), and provide basic handlers to deal with Alfred Workflows. Utility methods, on the other hand, contain handlers that are used internally by the workflow methods, as well as useful handlers for regular use that enhance AppleScript's capabilities (these include string and date manipulation, file system checks, sending notification, etc.)
78 |
79 | #### Workflow Methods
80 | 1. get\_bundle()
81 | 2. get\_data()
82 | 3. get\_cache()
83 | 4. get\_path()
84 | 5. get\_home()
85 | 6. set\_value(key, value, plistfile)
86 | 7. set\_values(listofrecords, plistfile)
87 | 8. get\_value(key, plistfile)
88 | 9. request(url)
89 | 10. request\_json(url)
90 | 11. mdfind(query)
91 | 12. write\_file(textorlist, cachefile)
92 | 13. read\_file(cachefile)
93 | 14. add\_result with(out) isValid given theUid, theArg, theTitle, theSubtitle, theAutocomplete, theIcon, theType
94 | 15. get\_results()
95 | 16. to\_xml(listofrecords)
96 |
97 | #### Utility Methods
98 | 1. q\_trim(text)
99 | 2. q\_join(list, delimiter or string of delimiters)
100 | 3. q\_split(text, delimiter or string of delimiters or list of delimiters)
101 | 4. q\_is\_empty(string or list)
102 | 5. q\_file\_exists(file path)
103 | 6. q\_folder\_exists(folder path)
104 | 7. q\_path\_exists(file or folder path)
105 | 8. q\_clean\_list(list)
106 | 9. q\_encode(text)
107 | 10. q\_date\_to\_unixdate(date)
108 | 11. q\_unixdate\_to\_date(text)
109 | 12. q\_date\_to\_timestamp(date)
110 | 13. q\_timestamp\_to\_date(text)
111 | 14. q\_send\_notification(message, details, extra)
112 | 15. q\_notify()
113 | 16. q\_encode\_url(str)
114 | 17. q\_decode\_url(str)
115 |
116 | ##F. Licensing
117 | This library is free to use, copy and modify, and is provided "AS IS", without warranty of any kind. However, I will greatly appreciate it if you'd give me credit and mention me in your works or anywhere you use this library.
118 |
119 | The use of the helper utilities shipped with this library is subject to each author's license, which can be read at the links provided in [section B].
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Appscript:
--------------------------------------------------------------------------------
1 | Versions/Current/Appscript
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Headers:
--------------------------------------------------------------------------------
1 | Versions/Current/Headers
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Resources:
--------------------------------------------------------------------------------
1 | Versions/Current/Resources
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Appscript:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qlassiqa/qWorkflow/3362aa4a42ab0fc28a9dcc03f0171362d94dec1c/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Appscript
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/Appscript.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Appscript.h
3 | *
4 | */
5 |
6 | // aem
7 | #import "application.h"
8 | #import "event.h"
9 | #import "base.h"
10 | #import "codecs.h"
11 | #import "specifier.h"
12 | #import "test.h"
13 | #import "types.h"
14 |
15 | // appscript base
16 | #import "constant.h"
17 | #import "appdata.h"
18 | #import "command.h"
19 | #import "reference.h"
20 | #import "referencerenderer.h"
21 |
22 | // misc
23 | #import "sendthreadsafe.h"
24 | #import "utils.h"
25 | #import "objectrenderer.h"
26 |
27 | // appscript bridge
28 | #import "parser.h"
29 | #import "terminology.h"
30 | #import "bridgedata.h"
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/appdata.h:
--------------------------------------------------------------------------------
1 | //
2 | // appdata.h
3 | // Appscript
4 | //
5 |
6 |
7 | #import "application.h"
8 | #import "codecs.h"
9 | #import "reference.h"
10 | #import "utils.h"
11 |
12 |
13 | /**********************************************************************/
14 | // typedefs
15 |
16 | typedef enum {
17 | kASTargetCurrent = 1,
18 | kASTargetName,
19 | kASTargetBundleID,
20 | kASTargetURL,
21 | kASTargetPID,
22 | kASTargetDescriptor,
23 | } ASTargetType;
24 |
25 |
26 | /**********************************************************************/
27 |
28 |
29 | @interface ASAppDataBase : AEMCodecs {
30 | Class aemApplicationClass;
31 | ASTargetType targetType;
32 | id targetData;
33 | AEMApplication *target;
34 | ASRelaunchMode relaunchMode;
35 | }
36 |
37 | - (id)initWithApplicationClass:(Class)appClass
38 | targetType:(ASTargetType)type
39 | targetData:(id)data;
40 |
41 | // creates AEMApplication instance for target application; used internally
42 | - (BOOL)connectWithError:(out NSError **)error;
43 |
44 | // returns AEMApplication instance for target application
45 | - (id)targetWithError:(out NSError **)error;
46 |
47 | // is target application running?
48 | - (BOOL)isRunning;
49 |
50 | // launch the target application without sending it the usual 'run' event;
51 | // equivalent to 'launch' command in AppleScript.
52 | - (BOOL)launchApplicationWithError:(out NSError **)error;
53 |
54 | // determines if an application specified by path should be relaunched if
55 | // its AEAddressDesc is no longer valid (i.e. application has quit/restarted)
56 | - (void)setRelaunchMode:(ASRelaunchMode)relaunchMode_;
57 | - (ASRelaunchMode)relaunchMode;
58 |
59 | @end
60 |
61 |
62 | /**********************************************************************/
63 |
64 |
65 | @interface ASAppData : ASAppDataBase {
66 | Class constantClass, referenceClass;
67 | }
68 |
69 | - (id)initWithApplicationClass:(Class)appClass
70 | constantClass:(Class)constClass
71 | referenceClass:(Class)refClass
72 | targetType:(ASTargetType)type
73 | targetData:(id)data;
74 |
75 | // AEMCodecs hook allowing extra typechecking to be performed here
76 | - (id)unpackContainsCompDescriptorWithOperand1:(id)op1 operand2:(id)op2;
77 |
78 | @end
79 |
80 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/application.h:
--------------------------------------------------------------------------------
1 | //
2 | // application.h
3 | // aem
4 | //
5 |
6 | #import "codecs.h"
7 | #import "sendthreadsafe.h"
8 | #import "event.h"
9 | #import "utils.h"
10 | #import "objectrenderer.h"
11 |
12 |
13 | /**********************************************************************/
14 | // typedefs
15 |
16 | typedef enum {
17 | kAEMTargetCurrent = 1,
18 | kAEMTargetFileURL,
19 | kAEMTargetEppcURL,
20 | kAEMTargetPID,
21 | kAEMTargetDescriptor,
22 | } AEMTargetType;
23 |
24 |
25 | /**********************************************************************/
26 | // Application class
27 |
28 | @interface AEMApplication : NSObject {
29 | AEMTargetType targetType;
30 | id targetData;
31 | NSAppleEventDescriptor *addressDesc;
32 | id defaultCodecs;
33 | AETransactionID transactionID;
34 |
35 | AEMCreateProcPtr createProc;
36 | AEMSendProcPtr sendProc;
37 | Class eventClass;
38 | }
39 |
40 | // Utility class methods
41 |
42 | // Find application by creator code, bundle ID and/or file name
43 | // Convenience wrapper for LSFindApplicationForInfo()
44 |
45 | + (NSURL *)findApplicationForCreator:(OSType)creator // use kLSUnknownCreator if none
46 | bundleID:(NSString *)bundleID // use nil if none
47 | name:(NSString *)name // use nil if none
48 | error:(out NSError **)error;
49 |
50 | // Find application by file name. Full path is also acceptable; .app suffix is optional.
51 |
52 | + (NSURL *)findApplicationForName:(NSString *)name error:(out NSError **)error;
53 |
54 | // Get Unix process ID of first process launched from specified application
55 |
56 | + (pid_t)findProcessIDForApplication:(NSURL *)fileURL error:(out NSError **)error;
57 |
58 |
59 | // Check if specified application is running
60 |
61 | // Does a local process launched from the specified application file exist?
62 | // e.g. [NSURL fileURLWithPath: @"/Applications/iCal.app"]
63 | // Returns false if process doesn't exist or file isn't found.
64 |
65 | +(BOOL)processExistsForFileURL:(NSURL *)fileURL;
66 |
67 |
68 | // Is there a local application process with the given Unix process id?
69 |
70 | +(BOOL)processExistsForPID:(pid_t)pid;
71 |
72 |
73 | // Does an application process specified by the given eppc:// URL exist?
74 | // e.g. [NSURL URLWithString: @"eppc://user:pass@0.0.0.1/TextEdit"]
75 | // Returns false if process doesn't exist, or if access isn't allowed.
76 |
77 | +(BOOL)processExistsForEppcURL:(NSURL *)eppcURL;
78 |
79 |
80 | // Does an application process specified by the given AEAddressDesc exist?
81 | // Returns false if process doesn't exist, or if access isn't allowed.
82 |
83 | +(BOOL)processExistsForDescriptor:(NSAppleEventDescriptor *)desc;
84 |
85 |
86 |
87 |
88 | // Launch an application
89 |
90 | + (pid_t)launchApplication:(NSURL *)fileURL
91 | event:(NSAppleEventDescriptor *)firstEvent
92 | flags:(LSLaunchFlags)launchFlags
93 | error:(out NSError **)error;
94 |
95 | // convenience shortcuts for the above
96 |
97 | + (pid_t)launchApplication:(NSURL *)appFileURL error:(out NSError **)error;
98 |
99 | + (pid_t)runApplication:(NSURL *)appFileURL error:(out NSError **)error;
100 |
101 | + (pid_t)openDocuments:(id)files inApplication:(NSURL *)appFileURL error:(out NSError **)error;
102 |
103 | /*
104 | * make AEAddressDescs
105 | *
106 | * Note: addressDescForLocalApplication:error: will start application if not already running
107 | */
108 |
109 | + (NSAppleEventDescriptor *)addressDescForLocalApplication:(NSURL *)fileURL error:(out NSError **)error;
110 |
111 | + (NSAppleEventDescriptor *)addressDescForLocalProcess:(pid_t)pid;
112 |
113 | + (NSAppleEventDescriptor *)addressDescForRemoteProcess:(NSURL *)eppcURL;
114 |
115 | + (NSAppleEventDescriptor *)addressDescForCurrentProcess;
116 |
117 |
118 | /*******/
119 |
120 | // designated initialiser; clients shouldn't call this directly but use one of the following methods
121 |
122 | - (id)initWithTargetType:(AEMTargetType)targetType_ data:(id)targetData_ error:(out NSError **)error;
123 |
124 |
125 | /*
126 | * clients should call one of the following methods to initialize AEMApplication object
127 | *
128 | * Note: if an error occurs when finding/launching an application by name/bundle ID/file URL, additional
129 | * error information may be returned via the error argument.
130 | */
131 |
132 | - (id)initWithName:(NSString *)name error:(out NSError **)error;
133 |
134 | - (id)initWithBundleID:(NSString *)bundleID error:(out NSError **)error;
135 |
136 | - (id)initWithURL:(NSURL *)url error:(out NSError **)error;
137 |
138 | - (id)initWithPID:(pid_t)pid;
139 |
140 | - (id)initWithDescriptor:(NSAppleEventDescriptor *)desc;
141 |
142 | // shortcuts for above
143 |
144 | - (id)initWithName:(NSString *)name;
145 |
146 | - (id)initWithBundleID:(NSString *)bundleID;
147 |
148 | - (id)initWithURL:(NSURL *)url;
149 |
150 | // comparison, hash support
151 |
152 | - (BOOL)isEqual:(id)object;
153 |
154 | - (AEMTargetType)targetType; // used by -isEqual:
155 |
156 | - (id)targetData; // used by -isEqual:
157 |
158 |
159 | // clients can call following methods to modify standard create/send behaviours
160 |
161 | - (void)setCreateProc:(AEMCreateProcPtr)createProc_;
162 |
163 | - (void)setSendProc:(AEMSendProcPtr)sendProc_;
164 |
165 | - (void)setEventClass:(Class)eventClass_;
166 |
167 |
168 | // create new AEMEvent object
169 |
170 | - (id)eventWithEventClass:(AEEventClass)classCode
171 | eventID:(AEEventID)code
172 | returnID:(AEReturnID)returnID
173 | codecs:(id)codecs;
174 |
175 | - (id)eventWithEventClass:(AEEventClass)classCode
176 | eventID:(AEEventID)code
177 | returnID:(AEReturnID)returnID;
178 |
179 | - (id)eventWithEventClass:(AEEventClass)classCode
180 | eventID:(AEEventID)code
181 | codecs:(id)codecs;
182 |
183 | - (id)eventWithEventClass:(AEEventClass)classCode
184 | eventID:(AEEventID)code;
185 |
186 |
187 | // reconnect to a local application originally specified by name, bundle ID or file URL
188 |
189 | - (BOOL)reconnect;
190 |
191 | - (BOOL)reconnectWithError:(out NSError **)error;
192 |
193 |
194 | // transaction support
195 |
196 | - (BOOL)beginTransactionWithError:(out NSError **)error;
197 |
198 | - (BOOL)beginTransactionWithSession:(id)session error:(out NSError **)error;
199 |
200 | - (BOOL)endTransactionWithError:(out NSError **)error;
201 |
202 | - (BOOL)abortTransactionWithError:(out NSError **)error;
203 |
204 |
205 |
206 | @end
207 |
208 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/base.h:
--------------------------------------------------------------------------------
1 | //
2 | // base.h
3 | // aem
4 | //
5 |
6 | #import "utils.h"
7 |
8 |
9 | /**********************************************************************/
10 | // AEM reference base (shared by specifiers and tests)
11 |
12 | @interface AEMQuery : NSObject {
13 | NSAppleEventDescriptor *cachedDesc;
14 | unsigned cachedHash;
15 | }
16 |
17 | // set cached descriptor; performance optimisation, used internally by AEMCodecs
18 | - (void)setCachedDesc:(NSAppleEventDescriptor *)desc;
19 |
20 | // walk reference
21 | - (id)resolveWithObject:(id)object;
22 |
23 | // pack reference
24 | - (NSAppleEventDescriptor *)packWithCodecsNoCache:(id)codecs;
25 |
26 | // pack reference, caching result for efficiency
27 | - (NSAppleEventDescriptor *)packWithCodecs:(id)codecs;
28 |
29 | @end
30 |
31 |
32 | /**********************************************************************/
33 |
34 | /*
35 | * Base class for objects to be passed to -[AEMQuery resolveWithObject:]
36 | * Each method simply returns self; subclasses can override some or all of
37 | * these methods as needed.
38 | */
39 | @interface AEMResolver : NSObject
40 |
41 | - (id)property:(OSType)code;
42 | - (id)elements:(OSType)code;
43 |
44 | - (id)first;
45 | - (id)middle;
46 | - (id)last;
47 | - (id)any;
48 |
49 | - (id)byIndex:(id)index;
50 | - (id)byName:(id)name;
51 | - (id)byID:(id)id_;
52 |
53 | - (id)previous:(OSType)class_;
54 | - (id)next:(OSType)class_;
55 |
56 | - (id)byRange:(id)fromObject to:(id)toObject;
57 | - (id)byTest:(id)testReference;
58 |
59 | - (id)beginning;
60 | - (id)end;
61 | - (id)before;
62 | - (id)after;
63 |
64 | - (id)greaterThan:(id)object;
65 | - (id)greaterOrEquals:(id)object;
66 | - (id)equals:(id)object;
67 | - (id)notEquals:(id)object;
68 | - (id)lessThan:(id)object;
69 | - (id)lessOrEquals:(id)object;
70 | - (id)beginsWith:(id)object;
71 | - (id)endsWith:(id)object;
72 | - (id)contains:(id)object;
73 | - (id)isIn:(id)object;
74 | - (id)AND:(id)remainingOperands;
75 | - (id)OR:(id)remainingOperands;
76 | - (id)NOT;
77 |
78 | - (id)app;
79 | - (id)con;
80 | - (id)its;
81 | - (id)customRoot:(id)rootObject;
82 |
83 | @end
84 |
85 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/bridgedata.h:
--------------------------------------------------------------------------------
1 | //
2 | // bridgedata.h
3 | // Appscript
4 | //
5 |
6 | #import "appdata.h"
7 | #import "parser.h"
8 | #import "terminology.h"
9 | #import "utils.h"
10 |
11 | @interface ASBridgeData : ASAppDataBase {
12 | id terms;
13 | ASTerminology *defaultTerms;
14 | id converter;
15 | }
16 |
17 | - (id)initWithApplicationClass:(Class)appClass
18 | targetType:(ASTargetType)type
19 | targetData:(id)data
20 | terminology:(id)terms_
21 | defaultTerms:(ASTerminology *)defaultTerms_
22 | keywordConverter:(id)converter_;
23 |
24 | - (ASTargetType)targetType;
25 |
26 | - (id)targetData;
27 |
28 | - (ASTerminology *)terminology;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/codecs.h:
--------------------------------------------------------------------------------
1 | //
2 | // codecs.h
3 | // aem
4 | //
5 |
6 | #import "unittype.h"
7 | #import "specifier.h"
8 | #import "types.h"
9 | #import "utils.h"
10 |
11 |
12 | /**********************************************************************/
13 | // AE types not defined in older OS versions
14 |
15 | enum {
16 | AS_typeUTF16ExternalRepresentation = 'ut16',
17 | AS_typeUInt16 = 'ushr',
18 | AS_typeUInt64 = 'ucom'
19 | };
20 |
21 |
22 | /**********************************************************************/
23 |
24 |
25 | @interface AEMCodecs : NSObject {
26 | id applicationRootDescriptor;
27 | BOOL disableCache, disableUnicode, allowUInt64;
28 | DescType textType;
29 | NSMutableDictionary *unitTypeDefinitionByName, *unitTypeDefinitionByCode;
30 | }
31 |
32 | + (id)defaultCodecs;
33 |
34 |
35 | /**********************************************************************/
36 | // compatibility options
37 |
38 | /*
39 | * Some applications may define custom unit types in addition to those
40 | * normally recognised by AppleScript/appscript. Clients can add
41 | * definitions for these types to an AEMCodecs object so that these
42 | * types can be packed and unpacked automatically.
43 | */
44 | - (void)addUnitTypeDefinition:(AEMUnitTypeDefinition *)definition;
45 |
46 | /*
47 | * When unpacking object specifiers, unlike AppleScript, appscript caches
48 | * the original AEDesc for efficiency, allowing the resulting AEMQuery to
49 | * be re-packed much more quickly. Occasionally this causes compatibility
50 | * problems with applications that returned subtly malformed specifiers.
51 | * To force an AEMCodecs object to fully unpack and repack object specifiers,
52 | * call its -dontCacheUnpackedSpecifiers method.
53 | */
54 | - (void)dontCacheUnpackedSpecifiers;
55 |
56 | /*
57 | * Some older (pre-OS X) applications may require text to be passed as
58 | * typeChar or typeIntlText rather than the usual typeUnicodeText. To force
59 | * an AEMCodecs object to pack strings as one of these older types, call
60 | * its -packStringsAsType: method, specifying the type you want used instead.
61 | */
62 | - (void)packStringsAsType:(DescType)type;
63 |
64 | /*
65 | * For compatibility's sake, appscript packs integers between 2^62 and 2^63-1 as
66 | * doubles, with some potential loss of precision. Mac OS X 10.5 adds typeUInt64;
67 | * to use this, call -allowUInt64.
68 | */
69 | - (void)allowUInt64;
70 |
71 |
72 | /**********************************************************************/
73 | // main pack methods
74 |
75 | /*
76 | * Converts a Cocoa object to an NSAppleEventDescriptor.
77 | * Calls -packUnknown: if object is of an unsupported class.
78 | */
79 | - (NSAppleEventDescriptor *)pack:(id)anObject;
80 |
81 | /*
82 | * Called by -pack: to process a Cocoa object of unsupported class.
83 | * Default implementation raises "CodecsError" NSException; subclasses
84 | * can override this method to provide alternative behaviours if desired.
85 | */
86 | - (NSAppleEventDescriptor *)packUnknown:(id)anObject;
87 |
88 |
89 | /**********************************************************************/
90 | /*
91 | * The following methods will be called by -pack: as needed.
92 | * Subclasses can override the following methods to provide alternative
93 | * behaviours if desired, although this is generally unnecessary.
94 | */
95 | - (NSAppleEventDescriptor *)packArray:(NSArray *)anObject;
96 | - (NSAppleEventDescriptor *)packDictionary:(NSDictionary *)anObject;
97 |
98 | - (void)setApplicationRootDescriptor:(NSAppleEventDescriptor *)desc;
99 | - (NSAppleEventDescriptor *)applicationRootDescriptor;
100 |
101 |
102 | /**********************************************************************/
103 | // main unpack methods; subclasses can override to process still-unconverted objects
104 |
105 | /*
106 | * Converts an NSAppleEventDescriptor to a Cocoa object.
107 | * Calls -unpackUnknown: if descriptor is of an unsupported type.
108 | */
109 | - (id)unpack:(NSAppleEventDescriptor *)desc;
110 |
111 | /*
112 | * Called by -unpack: to process an NSAppleEventDescriptor of unsupported type.
113 | * Default implementation checks to see if the descriptor is a record-type structure
114 | * and unpacks it as an NSDictionary if it is, otherwise it returns the value as-is.
115 | * Subclasses can override this method to provide alternative behaviours if desired.
116 | */
117 | - (id)unpackUnknown:(NSAppleEventDescriptor *)desc;
118 |
119 |
120 | /**********************************************************************/
121 | /*
122 | * The following methods will be called by -unpack: as needed.
123 | * Subclasses can override the following methods to provide alternative
124 | * behaviours if desired, although this is generally unnecessary.
125 | */
126 | - (id)unpackAEList:(NSAppleEventDescriptor *)desc;
127 | - (id)unpackAERecord:(NSAppleEventDescriptor *)desc;
128 | - (id)unpackAERecordKey:(AEKeyword)key;
129 |
130 | - (id)unpackType:(NSAppleEventDescriptor *)desc;
131 | - (id)unpackEnum:(NSAppleEventDescriptor *)desc;
132 | - (id)unpackProperty:(NSAppleEventDescriptor *)desc;
133 | - (id)unpackKeyword:(NSAppleEventDescriptor *)desc;
134 |
135 | - (id)fullyUnpackObjectSpecifier:(NSAppleEventDescriptor *)desc;
136 | - (id)unpackObjectSpecifier:(NSAppleEventDescriptor *)desc;
137 | - (id)unpackInsertionLoc:(NSAppleEventDescriptor *)desc;
138 |
139 | - (id)app;
140 | - (id)con;
141 | - (id)its;
142 | - (id)customRoot:(NSAppleEventDescriptor *)desc;
143 |
144 | - (id)unpackCompDescriptor:(NSAppleEventDescriptor *)desc;
145 | - (id)unpackLogicalDescriptor:(NSAppleEventDescriptor *)desc;
146 |
147 | /*
148 | * Notes:
149 | *
150 | * kAEContains is also used to construct 'is in' tests, where test value is first operand and
151 | * reference being tested is second operand, so need to make sure first operand is an its-based ref;
152 | * if not, rearrange accordingly.
153 | *
154 | * Since type-checking is involved, this extra hook is provided so that appscript's ASAppData class
155 | * can override this method to add its own type checking.
156 | */
157 | - (id)unpackContainsCompDescriptorWithOperand1:(id)op1 operand2:(id)op2;
158 |
159 |
160 | /**********************************************************************/
161 | /*
162 | * The following methods are not called by -unpack:, but are provided for benefit of
163 | * subclasses that may wish to use them.
164 | */
165 |
166 | - (NSString *)unpackApplicationBundleID:(NSAppleEventDescriptor *)desc;
167 |
168 | - (NSURL *)unpackApplicationURL:(NSAppleEventDescriptor *)desc;
169 |
170 | - (OSType)unpackApplicationSignature:(NSAppleEventDescriptor *)desc;
171 |
172 | - (pid_t)unpackProcessID:(NSAppleEventDescriptor *)desc;
173 |
174 | - (pid_t)unpackProcessSerialNumber:(NSAppleEventDescriptor *)desc;
175 |
176 | @end
177 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/command.h:
--------------------------------------------------------------------------------
1 | //
2 | // command.h
3 | // Appscript
4 | //
5 |
6 | #import "event.h"
7 | #import "constant.h"
8 | #import "appdata.h"
9 | #import "utils.h"
10 |
11 |
12 | // used internally
13 | #define kASNoDirectParameter ((void *)-1)
14 |
15 |
16 | /**********************************************************************/
17 | // Command base
18 |
19 | @interface ASCommand : NSObject {
20 | AEMEvent *AS_event;
21 | AESendMode sendMode;
22 | long timeout;
23 | UInt32 considsAndIgnoresFlags;
24 | NSError *targetError;
25 | }
26 |
27 | + (id)commandWithAppData:(id)appData
28 | eventClass:(AEEventClass)classCode
29 | eventID:(AEEventID)code
30 | directParameter:(id)directParameter
31 | parentReference:(id)parentReference;
32 |
33 | - (id)initWithAppData:(id)appData
34 | eventClass:(AEEventClass)classCode
35 | eventID:(AEEventID)code
36 | directParameter:(id)directParameter
37 | parentReference:(id)parentReference;
38 |
39 | // get underlying AEMEvent instance
40 |
41 | - (AEMEvent *)AS_aemEvent;
42 |
43 | // set attributes
44 |
45 | /*
46 | * Set considering/ignoring attributes.
47 | *
48 | * kAECaseConsiderMask = 0x00000001
49 | * kAEDiacriticConsiderMask = 0x00000002
50 | * kAEWhiteSpaceConsiderMask = 0x00000004
51 | * kAEHyphensConsiderMask = 0x00000008
52 | * kAEExpansionConsiderMask = 0x00000010
53 | * kAEPunctuationConsiderMask = 0x00000020
54 | * kASNumericStringsConsiderMask = 0x00000080
55 | *
56 | * kAECaseIgnoreMask = 0x00010000
57 | * kAEDiacriticIgnoreMask = 0x00020000
58 | * kAEWhiteSpaceIgnoreMask = 0x00040000
59 | * kAEHyphensIgnoreMask = 0x00080000
60 | * kAEExpansionIgnoreMask = 0x00100000
61 | * kAEPunctuationIgnoreMask = 0x00200000
62 | * kASNumericStringsIgnoreMask = 0x00800000
63 | */
64 | - (id)considering:(UInt32)consideringFlags_;
65 |
66 | /* Set send mode flags.
67 | * kAENoReply = 0x00000001,
68 | * kAEQueueReply = 0x00000002,
69 | * kAEWaitReply = 0x00000003,
70 | * kAEDontReconnect = 0x00000080,
71 | * kAEWantReceipt = 0x00000200,
72 | * kAENeverInteract = 0x00000010,
73 | * kAECanInteract = 0x00000020,
74 | * kAEAlwaysInteract = 0x00000030,
75 | * kAECanSwitchLayer = 0x00000040,
76 | * kAEDontRecord = 0x00001000,
77 | * kAEDontExecute = 0x00002000,
78 | * kAEProcessNonReplyEvents = 0x00008000
79 | *
80 | * Default is kAEWaitReply | kAECanSwitchLayer
81 | */
82 | - (id)sendMode:(AESendMode)flags;
83 |
84 | /*
85 | * Shortcut for setting kAEWaitReply send mode flag:
86 | */
87 | - (id)waitForReply;
88 |
89 | /*
90 | * Shortcut for setting kAENoReply send mode flag:
91 | */
92 | - (id)ignoreReply;
93 |
94 | /*
95 | * Shortcut for setting kAEQueueReply send mode flag:
96 | */
97 | - (id)queueReply;
98 |
99 | /*
100 | * Specify timeout in seconds (or kAEDefaultTimeout/kAENoTimeOut).
101 | *
102 | * Default is kAEDefaultTimeout (2 minutes)
103 | */
104 | - (id)timeout:(long)timeout_;
105 |
106 | /*
107 | * Specify the desired type for the return value. Where the application's event
108 | * handler supports this, it will attempt to coerce the event's result to this
109 | * type before returning it. May be a standard AE type (e.g. [ASConstant alias])
110 | * or, occasionally, an application-defined type.
111 | *
112 | * Note that most applications don't support this, and those that do usually
113 | * only support it for 'get' events (e.g. Finder).
114 | */
115 | - (id)requestedClass:(ASConstant *)classConstant;
116 | - (id)requestedType:(DescType)type;
117 |
118 | /*
119 | * Specify the AE type that the returned AEDesc must be coerced to before unpacking.
120 | * Whereas the -requestedType: method adds a kAERequestedType parameter to the outgoing
121 | * event, this coercion is performed locally by the -sendWithError: method using a
122 | * built-in or user-installed AE coercion handler if one is available. Note that if
123 | * the coercion fails, -sendWithError: will return nil and the associated NSError's
124 | * error code will be -1700 (errAECoercionFail).
125 | *
126 | * If the specified type is typeWildCard (the default), no coercion is performed.
127 | */
128 | - (id)returnClass:(ASConstant *)classConstant;
129 | - (id)returnType:(DescType)type;
130 |
131 | /*
132 | * Shortcut for [cmd returnType: typeAEList].
133 | */
134 | - (id)returnList;
135 |
136 | /*
137 | * Similar to -returnType:, except that the returned AEDesc is first coerced to
138 | * to typeAEList; each list item is then coerced to the specified type.
139 | */
140 | - (id)returnListOfClass:(ASConstant *)classConstant;
141 | - (id)returnListOfType:(DescType)type;
142 |
143 | /*
144 | * Invoke -returnDescriptor to have -sendWithError: return the returned AEDesc as
145 | * an NSAppleEventDescriptor without unpacking it.
146 | *
147 | */
148 | - (id)returnDescriptor;
149 |
150 | // send events
151 |
152 |
153 | /*
154 | * Send the event.
155 | *
156 | * error
157 | * On return, an NSError object that describes an Apple Event Manager or application
158 | * error if one has occurred, otherwise nil. Pass nil if not required.
159 | *
160 | * Return value
161 | *
162 | * The value returned by the application, or an NSNull instance if no value was returned,
163 | * or nil if an error occurred.
164 | *
165 | * Notes
166 | *
167 | * A single event can be sent more than once if desired.
168 | */
169 | - (id)sendWithError:(out NSError **)error;
170 |
171 | /*
172 | * Send the event with minimal error reporting.
173 | *
174 | * Return value
175 | *
176 | * The value returned by the application, or an NSNull instance if no value was returned,
177 | * or nil if an error occurred.
178 | *
179 | * Notes
180 | *
181 | * Convenience method; [evt send] is equivalent to [evt sendWithError: nil]
182 | */
183 | - (id)send;
184 |
185 |
186 | // display formatting; subclasses will override these
187 |
188 | - (NSString *)AS_commandName;
189 | - (NSString *)AS_parameterNameForCode:(DescType)code;
190 | - (NSString *)AS_formatObject:(id)obj appData:(id)appData;
191 |
192 | @end
193 |
194 |
195 | /**********************************************************************/
196 |
197 |
198 | @interface ASGetSetItemCommand : ASCommand
199 | @end
200 |
201 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/constant.h:
--------------------------------------------------------------------------------
1 | //
2 | // constant.h
3 | // appscript
4 | //
5 |
6 | #import "utils.h"
7 |
8 | /**********************************************************************/
9 | // base class for application-specific constants
10 |
11 | @interface ASConstant : NSObject {
12 | NSString *name;
13 | NSAppleEventDescriptor *desc;
14 | }
15 |
16 | + (id)constantWithName:(NSString *)name_ type:(DescType)type_ code:(OSType)code_ NS_RETURNS_RETAINED;
17 | + (id)constantWithCode:(OSType)code_;
18 |
19 | - (id)initWithName: (NSString *)name_ descriptor:(NSAppleEventDescriptor *)desc_;
20 |
21 | - (NSString *)AS_name;
22 | - (OSType)AS_code;
23 |
24 | - (NSAppleEventDescriptor *)AS_packSelf:(id)codecs;
25 |
26 |
27 | /***********************************/
28 | // Apple Event Manager-defined types and enumerators
29 |
30 | /* Enumerators */
31 |
32 | + (ASConstant *)applicationResponses;
33 | + (ASConstant *)ask;
34 | + (ASConstant *)case_;
35 | + (ASConstant *)diacriticals;
36 | + (ASConstant *)expansion;
37 | + (ASConstant *)hyphens;
38 | + (ASConstant *)no;
39 | + (ASConstant *)numericStrings;
40 | + (ASConstant *)punctuation;
41 | + (ASConstant *)whitespace;
42 | + (ASConstant *)yes;
43 |
44 | /* Types and properties */
45 |
46 | + (ASConstant *)April;
47 | + (ASConstant *)August;
48 | + (ASConstant *)December;
49 | + (ASConstant *)EPSPicture;
50 | + (ASConstant *)February;
51 | + (ASConstant *)Friday;
52 | + (ASConstant *)GIFPicture;
53 | + (ASConstant *)JPEGPicture;
54 | + (ASConstant *)January;
55 | + (ASConstant *)July;
56 | + (ASConstant *)June;
57 | + (ASConstant *)March;
58 | + (ASConstant *)May;
59 | + (ASConstant *)Monday;
60 | + (ASConstant *)November;
61 | + (ASConstant *)October;
62 | + (ASConstant *)PICTPicture;
63 | + (ASConstant *)RGB16Color;
64 | + (ASConstant *)RGB96Color;
65 | + (ASConstant *)RGBColor;
66 | + (ASConstant *)Saturday;
67 | + (ASConstant *)September;
68 | + (ASConstant *)Sunday;
69 | + (ASConstant *)TIFFPicture;
70 | + (ASConstant *)Thursday;
71 | + (ASConstant *)Tuesday;
72 | + (ASConstant *)Wednesday;
73 | + (ASConstant *)alias;
74 | + (ASConstant *)anything;
75 | + (ASConstant *)applicationBundleID;
76 | + (ASConstant *)applicationSignature;
77 | + (ASConstant *)applicationURL;
78 | + (ASConstant *)best;
79 | + (ASConstant *)boolean;
80 | + (ASConstant *)boundingRectangle;
81 | + (ASConstant *)centimeters;
82 | + (ASConstant *)class_;
83 | + (ASConstant *)classInfo;
84 | + (ASConstant *)colorTable;
85 | + (ASConstant *)cubicCentimeters;
86 | + (ASConstant *)cubicFeet;
87 | + (ASConstant *)cubicInches;
88 | + (ASConstant *)cubicMeters;
89 | + (ASConstant *)cubicYards;
90 | + (ASConstant *)dashStyle;
91 | + (ASConstant *)data;
92 | + (ASConstant *)date;
93 | + (ASConstant *)decimalStruct;
94 | + (ASConstant *)degreesCelsius;
95 | + (ASConstant *)degreesFahrenheit;
96 | + (ASConstant *)degreesKelvin;
97 | + (ASConstant *)doubleInteger;
98 | + (ASConstant *)elementInfo;
99 | + (ASConstant *)encodedString;
100 | + (ASConstant *)enumerator;
101 | + (ASConstant *)eventInfo;
102 | + (ASConstant *)extendedFloat;
103 | + (ASConstant *)feet;
104 | + (ASConstant *)fileRef;
105 | + (ASConstant *)fileSpecification;
106 | + (ASConstant *)fileURL;
107 | + (ASConstant *)fixed;
108 | + (ASConstant *)fixedPoint;
109 | + (ASConstant *)fixedRectangle;
110 | + (ASConstant *)float_;
111 | + (ASConstant *)float128bit;
112 | + (ASConstant *)gallons;
113 | + (ASConstant *)grams;
114 | + (ASConstant *)graphicText;
115 | + (ASConstant *)inches;
116 | + (ASConstant *)integer;
117 | + (ASConstant *)internationalText;
118 | + (ASConstant *)internationalWritingCode;
119 | + (ASConstant *)kernelProcessID;
120 | + (ASConstant *)kilograms;
121 | + (ASConstant *)kilometers;
122 | + (ASConstant *)list;
123 | + (ASConstant *)liters;
124 | + (ASConstant *)locationReference;
125 | + (ASConstant *)longFixed;
126 | + (ASConstant *)longFixedPoint;
127 | + (ASConstant *)longFixedRectangle;
128 | + (ASConstant *)longPoint;
129 | + (ASConstant *)longRectangle;
130 | + (ASConstant *)machPort;
131 | + (ASConstant *)machine;
132 | + (ASConstant *)machineLocation;
133 | + (ASConstant *)meters;
134 | + (ASConstant *)miles;
135 | + (ASConstant *)missingValue;
136 | + (ASConstant *)null;
137 | + (ASConstant *)ounces;
138 | + (ASConstant *)parameterInfo;
139 | + (ASConstant *)pixelMapRecord;
140 | + (ASConstant *)point;
141 | + (ASConstant *)pounds;
142 | + (ASConstant *)processSerialNumber;
143 | + (ASConstant *)property;
144 | + (ASConstant *)propertyInfo;
145 | + (ASConstant *)quarts;
146 | + (ASConstant *)record;
147 | + (ASConstant *)reference;
148 | + (ASConstant *)rotation;
149 | + (ASConstant *)script;
150 | + (ASConstant *)shortFloat;
151 | + (ASConstant *)shortInteger;
152 | + (ASConstant *)squareFeet;
153 | + (ASConstant *)squareKilometers;
154 | + (ASConstant *)squareMeters;
155 | + (ASConstant *)squareMiles;
156 | + (ASConstant *)squareYards;
157 | + (ASConstant *)string;
158 | + (ASConstant *)styledClipboardText;
159 | + (ASConstant *)styledText;
160 | + (ASConstant *)suiteInfo;
161 | + (ASConstant *)textStyleInfo;
162 | + (ASConstant *)typeClass;
163 | + (ASConstant *)unicodeText;
164 | + (ASConstant *)unsignedInteger;
165 | + (ASConstant *)utf16Text;
166 | + (ASConstant *)utf8Text;
167 | + (ASConstant *)version;
168 | + (ASConstant *)writingCode;
169 | + (ASConstant *)yards;
170 |
171 | @end
172 |
173 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/event.h:
--------------------------------------------------------------------------------
1 | //
2 | // event.h
3 | // aem
4 | //
5 |
6 | #import "codecs.h"
7 | #import "sendthreadsafe.h"
8 | #import "utils.h"
9 | #import "objectrenderer.h"
10 |
11 |
12 | /**********************************************************************/
13 | // NSError constants
14 |
15 | extern NSString *const kASErrorDomain; // @"net.sourceforge.appscript.objc-appscript.ErrorDomain"; domain name for NSErrors returned by appscript
16 |
17 | /*
18 | * -sendWithError: will return an NSError containing error code, localized description, and a userInfo dictionary
19 | * containing kASErrorNumberKey (this has the same value as -[NSError code]) and zero or more other keys:
20 | */
21 |
22 | extern NSString *const kASErrorNumberKey; // @"ErrorNumber"; error number returned by Apple Event Manager or application
23 | extern NSString *const kASErrorStringKey; // @"ErrorString"; error string returned by application, if given
24 | extern NSString *const kASErrorBriefMessageKey; // @"ErrorBriefMessage"; brief error string returned by application, if given
25 | extern NSString *const kASErrorExpectedTypeKey; // @"ErrorExpectedType"; AE type responsible for a coercion error (-1700), if given
26 | extern NSString *const kASErrorOffendingObjectKey; // @"ErrorOffendingObject"; value or object specifer responsible for error, if given
27 | extern NSString *const kASErrorFailedEvent; // @"ErrorFailedEvent"; the AEMEvent object that returned the error
28 |
29 |
30 | /**********************************************************************/
31 | // typedefs
32 |
33 | typedef enum {
34 | kAEMDontUnpack,
35 | kAEMUnpackAsItem,
36 | kAEMUnpackAsList
37 | } AEMUnpackFormat;
38 |
39 |
40 | typedef OSErr(*AEMCreateProcPtr)(AEEventClass theAEEventClass,
41 | AEEventID theAEEventID,
42 | const AEAddressDesc *target,
43 | AEReturnID returnID,
44 | AETransactionID transactionID,
45 | AppleEvent *result);
46 |
47 |
48 | typedef OSStatus(*AEMSendProcPtr)(const AppleEvent *event,
49 | AppleEvent *reply,
50 | AESendMode sendMode,
51 | long timeOutInTicks);
52 |
53 |
54 | /**********************************************************************/
55 | // Event class
56 | /*
57 | * Note: clients shouldn't instantiate AEMEvent directly; instead use AEMApplication -eventWith... methods.
58 | */
59 |
60 | @interface AEMEvent : NSObject {
61 | AppleEvent *event;
62 | id codecs;
63 | AEMSendProcPtr sendProc;
64 | // type to coerce returned value to before unpacking it
65 | DescType resultType;
66 | AEMUnpackFormat resultFormat;
67 | }
68 |
69 | /*
70 | * Note: new AEMEvent instances are constructed by AEMApplication objects;
71 | * clients shouldn't instantiate this class directly.
72 | */
73 |
74 | - (id)initWithEvent:(AppleEvent *)event_
75 | codecs:(id)codecs_
76 | sendProc:(AEMSendProcPtr)sendProc_;
77 |
78 | /*
79 | * Get codecs object used by this AEMEvent instance
80 | */
81 | - (id)codecs;
82 |
83 | /*
84 | * Get a pointer to the AEDesc contained by this AEMEvent instance
85 | */
86 | - (const AppleEvent *)aeDesc;
87 |
88 | /*
89 | * Get an NSAppleEventDescriptor instance containing a copy of this event
90 | */
91 | - (NSAppleEventDescriptor *)descriptor;
92 |
93 | // Pack event's attributes and parameters, if any.
94 |
95 | - (void)setAttribute:(id)value forKeyword:(AEKeyword)key;
96 |
97 | - (void)setParameter:(id)value forKeyword:(AEKeyword)key;
98 |
99 | // Get event's attributes and parameters.
100 |
101 | - (id)attributeForKeyword:(AEKeyword)key type:(DescType)type error:(out NSError **)error;
102 |
103 | - (id)attributeForKeyword:(AEKeyword)key; // shortcut for above
104 |
105 | - (id)parameterForKeyword:(AEKeyword)key type:(DescType)type error:(out NSError **)error;
106 |
107 | - (id)parameterForKeyword:(AEKeyword)key; // shortcut for above
108 |
109 | /*
110 | * Specify how the the reply descriptor should be unpacked.
111 | * (Default = kAEMUnpackAsItem of typeWildCard)
112 | */
113 |
114 | - (void)setUnpackFormat:(AEMUnpackFormat)format_ type:(DescType)type_;
115 |
116 | - (void)getUnpackFormat:(AEMUnpackFormat *)format_ type:(DescType *)type_;
117 |
118 | /*
119 | * Send event.
120 |
121 | * Parameters
122 | *
123 | * sendMode
124 | * kAEWaitReply
125 | *
126 | * timeoutInTicks
127 | * kAEDefaultTimeout
128 | *
129 | * error
130 | * On return, an NSError object that describes an Apple Event Manager or application
131 | * error if one has occurred, otherwise nil. Pass nil if not required.
132 | *
133 | * Return value
134 | *
135 | * The value returned by the application, or an NSNull instance if no value was returned,
136 | * or nil if an error occurred.
137 | *
138 | * Notes
139 | *
140 | * A single event can be sent more than once if desired.
141 | *
142 | */
143 |
144 | - (id)sendWithMode:(AESendMode)sendMode timeout:(long)timeoutInTicks error:(out NSError **)error;
145 |
146 | // shortcuts for -sendWithMode:timeout:error:
147 |
148 | - (id)sendWithError:(out NSError **)error;
149 |
150 | - (id)send;
151 |
152 | @end
153 |
154 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/objectrenderer.h:
--------------------------------------------------------------------------------
1 | //
2 | // formatter.m
3 | // appscript
4 | //
5 |
6 |
7 | @interface AEMObjectRenderer : NSObject
8 |
9 | +(NSString *)formatOSType:(OSType)code;
10 |
11 | +(void)formatObject:(id)obj indent:(NSString *)indent result:(NSMutableString *)result;
12 |
13 | +(NSString *)formatObject:(id)obj;
14 |
15 | @end
16 |
17 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/parser.h:
--------------------------------------------------------------------------------
1 | //
2 | // parser.h
3 | // appscript
4 | //
5 |
6 | #import "types.h"
7 | #import "utils.h"
8 | #import "objectrenderer.h"
9 |
10 |
11 | /**********************************************************************/
12 |
13 |
14 | @interface ASParserDef : NSObject {
15 | NSString *name;
16 | OSType code;
17 | unsigned hash;
18 | }
19 |
20 | - (id)initWithName:(NSString*)name_ code:(OSType)code_;
21 | - (NSString *)name;
22 | - (OSType)fourCharCode;
23 |
24 | @end
25 |
26 |
27 | /**********************************************************************/
28 |
29 |
30 | @interface ASParserCommandDef : ASParserDef {
31 | OSType classCode;
32 | NSMutableSet *parameters;
33 | }
34 |
35 | - (id)initWithName:(NSString*)name eventClass:(OSType)classCode_ eventID:(OSType)code_;
36 | - (OSType)eventClass;
37 | - (OSType)eventID;
38 | - (void)addParameter:(ASParserDef *)def;
39 | - (NSSet *)parameters;
40 | @end
41 |
42 |
43 | /**********************************************************************/
44 |
45 |
46 | @interface ASAETEParser : NSObject {
47 | char *aeteData;
48 | unsigned long aeteSize;
49 | unsigned long cursor;
50 | /* terminology tables; order is significant where synonym definitions occur */
51 | NSMutableDictionary *commands;
52 | NSMutableSet *properties, *elements, *classes, *enumerators;
53 | /* use sets to record previously found definitions, and avoid adding duplicates to lists
54 | ** (i.e. 'name+code not in ' is quicker than using 'name+code not in ')
55 | */
56 | NSMutableSet *foundProperties, *foundElements, *foundClasses, *foundEnumerators;
57 | /* ideally, aetes should define both singular and plural names for each class, but
58 | ** some define only one or the other so we need to fill in any missing ones afterwards
59 | */
60 | NSMutableDictionary *classAndElementDefsByCode;
61 | NSMutableSet *foundClassCodes, *foundElementCodes;
62 | }
63 |
64 | - (unsigned short)integer;
65 | - (OSType)word;
66 | - (NSString *)name NS_RETURNS_RETAINED;
67 |
68 | - (void)parseCommand;
69 | - (void)parseClass;
70 | - (void)parseComparison;
71 | - (void)parseEnumeration;
72 | - (void)parseSuite;
73 |
74 | - (ASAETEParser *)parse:(id)aetes;
75 |
76 | - (NSArray *)classes;
77 | - (NSArray *)enumerators;
78 | - (NSArray *)properties;
79 | - (NSArray *)elements;
80 | - (NSArray *)commands;
81 | @end
82 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/reference.h:
--------------------------------------------------------------------------------
1 | //
2 | // reference.h
3 | // appscript
4 | //
5 |
6 | #import "application.h"
7 | #import "constant.h"
8 | #import "specifier.h"
9 | #import "command.h"
10 | #import "utils.h"
11 |
12 | /**********************************************************************/
13 |
14 | #define ASInt(val) [NSNumber numberWithInt: (int)val]
15 | #define ASLong(val) [NSNumber numberWithLong: (long)val]
16 | #define ASDouble(val) [NSNumber numberWithDouble: (double)val]
17 |
18 | /**********************************************************************/
19 | // Reference base
20 |
21 |
22 | @interface ASReference : NSObject {
23 | id AS_appData;
24 | id AS_aemReference;
25 | }
26 |
27 | + (id)referenceWithAppData:(id)appData aemReference:(id)aemReference;
28 |
29 | - (id)initWithAppData:(id)appData aemReference:(id)aemReference;
30 |
31 | - (NSAppleEventDescriptor *)AS_packSelf:(id)codecs;
32 |
33 | - (id)AS_appData;
34 |
35 | - (id)AS_aemReference;
36 |
37 | - (void)AS_setRelaunchMode:(ASRelaunchMode)relaunchMode_;
38 | - (ASRelaunchMode)AS_relaunchMode;
39 |
40 | // is target application running?
41 | - (BOOL)isRunning;
42 |
43 | // launch the target application without sending it the usual 'run' event;
44 | // equivalent to 'launch' command in AppleScript.
45 | - (BOOL)launchApplicationWithError:(out NSError **)error; // may be nil
46 |
47 | - (BOOL)launchApplication; // convenience shortcut for the above
48 |
49 |
50 | // restart local application and/or update AEAddressDesc if needed
51 | // (typically used after application has quit; refreshes existing
52 | // application object without the need to recreate it)
53 | // note: only works for apps specified by name/path/bundle ID
54 |
55 | - (BOOL)reconnectApplicationWithError:(out NSError **)error;
56 |
57 | - (BOOL)reconnectApplication;
58 |
59 |
60 | // transaction support
61 |
62 | - (BOOL)beginTransactionWithError:(out NSError **)error;
63 |
64 | - (BOOL)beginTransactionWithSession:(id)session error:(out NSError **)error;
65 |
66 | - (BOOL)endTransactionWithError:(out NSError **)error;
67 |
68 | - (BOOL)abortTransactionWithError:(out NSError **)error;
69 |
70 | // get/set shortcuts
71 |
72 | // shortcut for [[[ref set] to: value] send]
73 | - (id)setItem:(id)data;
74 | - (id)setItem:(id)data error:(out NSError **)error;
75 |
76 | // shortcut for [[ref get] send]
77 | - (id)getItem;
78 | - (id)getItemWithError:(out NSError **)error;
79 |
80 | // shortcut for [[[ref get] returnList] send]
81 | - (id)getList;
82 | - (id)getListWithError:(out NSError **)error;
83 |
84 | // shortcut for [[[[ref get] requestedType: descType] returnType: descType] send]
85 | - (id)getItemOfType:(DescType)type;
86 | - (id)getItemOfType:(DescType)type error:(out NSError **)error;
87 |
88 | // shortcut for [[[[ref get] requestedType: descType] returnListOfType: descType] send]
89 | - (id)getListOfType:(DescType)type;
90 | - (id)getListOfType:(DescType)type error:(out NSError **)error;
91 |
92 | /*
93 | * shortcuts for getting numerical property values as C primitives
94 | */
95 |
96 | // shortcut for [[[[[ref get] requestedType: typeSInt32] returnType: typeSInt32] send] intValue]
97 | - (int)getIntWithError:(out NSError **)error;
98 |
99 | // shortcut for [[[[[ref get] requestedType: typeSInt32] returnType: typeSInt32] send] intValue] in 32-bit builds,
100 | // and [[[[[ref get] requestedType: typeSInt64] returnType: typeSInt64] send] longValue] in 64-bit builds
101 | - (long)getLongWithError:(out NSError **)error;
102 |
103 | // shortcut for [[[[[ref get] requestedType: typeIEEE64BitFloatingPoint] returnType: typeIEEE64BitFloatingPoint] send] doubleValue]
104 | - (double)getDoubleWithError:(out NSError **)error;
105 |
106 | @end
107 |
108 |
109 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/referencerenderer.h:
--------------------------------------------------------------------------------
1 | //
2 | // referencerenderer.h
3 | // appscript
4 | //
5 |
6 | #import "objectrenderer.h"
7 | #import "reference.h"
8 | #import "utils.h"
9 |
10 | /**********************************************************************/
11 | // reference renderer abstract base
12 |
13 | @interface ASReferenceRenderer : AEMResolver {
14 | id appData;
15 | NSMutableString *result;
16 | }
17 |
18 | - (id)initWithAppData:(id)appData_;
19 |
20 |
21 | /*******/
22 | // private
23 |
24 | - (NSString *)format:(id)object;
25 | - (NSString *)result;
26 |
27 | /*******/
28 | // public
29 | // application-specific subclasses should override this method to provide their own prefix codes
30 |
31 | + (NSString *)formatObject:(id)object appData:(id)appData_;
32 |
33 | /*******/
34 | // method stubs; application-specific subclasses will override to provide code->name translations
35 |
36 | - (NSString *)propertyByCode:(OSType)code;
37 | - (NSString *)elementByCode:(OSType)code;
38 | - (NSString *)prefix;
39 |
40 | @end
41 |
42 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/sendthreadsafe.h:
--------------------------------------------------------------------------------
1 | /*
2 | File: AESendThreadSafe.h
3 |
4 | Contains: Code to send Apple events in a thread-safe manner.
5 |
6 | Written by: DTS
7 |
8 | Copyright: Copyright (c) 2007 Apple Inc. All Rights Reserved.
9 |
10 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
11 | ("Apple") in consideration of your agreement to the following
12 | terms, and your use, installation, modification or
13 | redistribution of this Apple software constitutes acceptance of
14 | these terms. If you do not agree with these terms, please do
15 | not use, install, modify or redistribute this Apple software.
16 |
17 | In consideration of your agreement to abide by the following
18 | terms, and subject to these terms, Apple grants you a personal,
19 | non-exclusive license, under Apple's copyrights in this
20 | original Apple software (the "Apple Software"), to use,
21 | reproduce, modify and redistribute the Apple Software, with or
22 | without modifications, in source and/or binary forms; provided
23 | that if you redistribute the Apple Software in its entirety and
24 | without modifications, you must retain this notice and the
25 | following text and disclaimers in all such redistributions of
26 | the Apple Software. Neither the name, trademarks, service marks
27 | or logos of Apple Inc. may be used to endorse or promote
28 | products derived from the Apple Software without specific prior
29 | written permission from Apple. Except as expressly stated in
30 | this notice, no other rights or licenses, express or implied,
31 | are granted by Apple herein, including but not limited to any
32 | patent rights that may be infringed by your derivative works or
33 | by other works in which the Apple Software may be incorporated.
34 |
35 | The Apple Software is provided by Apple on an "AS IS" basis.
36 | APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
37 | WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
38 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING
39 | THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
40 | COMBINATION WITH YOUR PRODUCTS.
41 |
42 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT,
43 | INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
44 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
45 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY
46 | OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
47 | OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY
48 | OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
49 | OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF
50 | SUCH DAMAGE.
51 |
52 | Change History (most recent first):
53 |
54 | $Log: AESendThreadSafe.h,v $
55 | Revision 1.2 2007/02/12 11:58:43
56 | Corrected grammo in comment.
57 |
58 | Revision 1.1 2007/02/09 10:55:27
59 | First checked in.
60 |
61 |
62 | */
63 |
64 | /*
65 |
66 | 2007/06/24 -- Modified by HAS to make AESendMessageThreadSafeSynchronous API-compatible with AESendMessage; renamed AEMSendMessageThreadSafe.
67 |
68 | */
69 |
70 | #ifndef _AESENDTHREADSAFE_H
71 | #define _AESENDTHREADSAFE_H
72 |
73 | #include
74 |
75 | /////////////////////////////////////////////////////////////////
76 |
77 | /*
78 | Introduction
79 | ------------
80 | Since Mac OS X 10.2 it has been possible to synchronously send an Apple event
81 | from a thread other than the main thread. The technique for doing this is
82 | documented in Technote 2053 "Mac OS X 10.2".
83 |
84 |
85 |
86 | Unfortunately, this technique isn't quite right. Specifically, due to a bug
87 | in Apple Event Manager , it is not safe to dispose of
88 | the Mach port (using mach_port_destroy, as documented in the technote, or, more
89 | correctly, using mach_port_mod_refs) that you created to use as the reply port.
90 | Doing this triggers a race condition that, very rarely, can cause the system
91 | to destroy some other, completely unrelated, Mach port within your process.
92 | This could cause all sorts of problems. One common symptom is that, after
93 | accidentally destroying the Mach port associated with a thread, your program
94 | dies with the following message:
95 |
96 | /SourceCache/Libc/Libc-320.1.3/pthreads/pthread.c:897: failed assertion `ret == MACH_MSG_SUCCESS'
97 |
98 | The best workaround to this problem is to not dispose of the Mach port that
99 | you use as the Apple event reply port. If you have a limited number of
100 | secondary threads from which you need to send Apple events, it's relatively
101 | easy to allocate an Apple event reply port for each thread and then never
102 | dispose it. However, if you have general case code, it might be tricky
103 | to track down all of the threads that send Apple events and make sure they
104 | have reply ports. This module was designed as a general case solution to
105 | the problem.
106 |
107 | The module exports a single function, AESendMessageThreadSafeSynchronous, which,
108 | as its name suggests, sends an Apple event and waits for the reply (that is,
109 | a synchronous IPC) and is safe to call from an arbitrary thread. It's basically
110 | a wrapper around the system function AESendMessage, with added smarts to manage
111 | a per-thread Apple event reply port.
112 |
113 | When is fixed, this module should be unnecessary but
114 | benign.
115 |
116 | For information about how this works, see the comments in the implementation.
117 | */
118 |
119 | /////////////////////////////////////////////////////////////////
120 |
121 | #ifdef __cplusplus
122 | extern "C" {
123 | #endif
124 |
125 | OSStatus AEMSendMessageThreadSafe(
126 | AppleEvent * eventPtr,
127 | AppleEvent * replyPtr,
128 | AESendMode sendMode,
129 | long timeOutInTicks
130 | );
131 | // A thread-safe replacement for AESend. This is very much like AESendMessage,
132 | // except that it takes care of setting up the reply port when you use it
133 | // from a thread other than the main thread.
134 |
135 | #ifdef __cplusplus
136 | }
137 | #endif
138 |
139 | #endif
140 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/specifier.h:
--------------------------------------------------------------------------------
1 | //
2 | // specifier.h
3 | // aem
4 | //
5 |
6 | #import "base.h"
7 | #import "test.h"
8 | #import "utils.h"
9 | #import "objectrenderer.h"
10 |
11 |
12 | /**********************************************************************/
13 |
14 |
15 | #define AEMApp [AEMApplicationRoot applicationRoot]
16 | #define AEMCon [AEMCurrentContainerRoot currentContainerRoot]
17 | #define AEMIts [AEMObjectBeingExaminedRoot objectBeingExaminedRoot]
18 | #define AEMRoot(object) [AEMCustomRoot customRootWithObject: object]
19 |
20 |
21 | /**********************************************************************/
22 | // Forward declarations
23 |
24 | @class AEMPropertySpecifier;
25 | @class AEMUserPropertySpecifier;
26 | @class AEMElementByNameSpecifier;
27 | @class AEMElementByIndexSpecifier;
28 | @class AEMElementByIDSpecifier;
29 | @class AEMElementByOrdinalSpecifier;
30 | @class AEMElementByRelativePositionSpecifier;
31 | @class AEMElementsByRangeSpecifier;
32 | @class AEMElementsByTestSpecifier;
33 | @class AEMAllElementsSpecifier;
34 |
35 | @class AEMGreaterThanTest;
36 | @class AEMGreaterOrEqualsTest;
37 | @class AEMEqualsTest;
38 | @class AEMNotEqualsTest;
39 | @class AEMLessThanTest;
40 | @class AEMLessOrEqualsTest;
41 | @class AEMBeginsWithTest;
42 | @class AEMEndsWithTest;
43 | @class AEMContainsTest;
44 | @class AEMIsInTest;
45 |
46 | @class AEMSpecifier;
47 | @class AEMReferenceRootBase;
48 | @class AEMApplicationRoot;
49 | @class AEMCurrentContainerRoot;
50 | @class AEMObjectBeingExaminedRoot;
51 | @class AEMCustomRoot;
52 |
53 | @class AEMTest;
54 |
55 |
56 | /**********************************************************************/
57 | // initialise constants
58 |
59 | void initSpecifierModule(void); // called automatically
60 |
61 | void disposeSpecifierModule(void);
62 |
63 |
64 | /**********************************************************************/
65 | // Specifier base
66 |
67 | /*
68 | * Abstract base class for all object specifier classes.
69 | */
70 | @interface AEMSpecifier : AEMQuery {
71 | AEMSpecifier *container;
72 | id key;
73 | }
74 |
75 | - (id)initWithContainer:(AEMSpecifier *)container_ key:(id)key_;
76 |
77 | // reserved methods
78 |
79 | - (id)key; // used by -isEqual:
80 | - (id)container; // used by -isEqual:
81 |
82 | - (AEMReferenceRootBase *)root;
83 | - (AEMSpecifier *)trueSelf;
84 |
85 | @end
86 |
87 |
88 | /**********************************************************************/
89 | // Performance optimisation used by -[AEMCodecs unpackObjectSpecifier:]
90 |
91 |
92 | @interface AEMDeferredSpecifier : AEMSpecifier {
93 | id reference;
94 | NSAppleEventDescriptor *desc;
95 | id codecs;
96 | }
97 |
98 | - (id)initWithDescriptor:(NSAppleEventDescriptor *)desc_ codecs:(id)codecs_;
99 |
100 | - (id)realReference;
101 |
102 | @end
103 |
104 |
105 | /**********************************************************************/
106 | // Insertion location specifier
107 |
108 | /*
109 | * A reference to an element insertion point.
110 | */
111 | @interface AEMInsertionSpecifier : AEMSpecifier
112 | @end
113 |
114 |
115 | /**********************************************************************/
116 | // Position specifier base
117 |
118 | /*
119 | * All property and element reference forms inherit from this abstract class.
120 | */
121 | @interface AEMObjectSpecifier : AEMSpecifier {
122 | OSType wantCode;
123 | }
124 |
125 | - (id)initWithContainer:(AEMSpecifier *)container_ key:(id)key_ wantCode:(OSType)wantCode_;
126 |
127 | - (OSType)wantCode; // used by isEqual
128 |
129 | // Comparison and logic tests
130 |
131 | - (AEMGreaterThanTest *)greaterThan:(id)object;
132 | - (AEMGreaterOrEqualsTest *)greaterOrEquals:(id)object;
133 | - (AEMEqualsTest *)equals:(id)object;
134 | - (AEMNotEqualsTest *)notEquals:(id)object;
135 | - (AEMLessThanTest *)lessThan:(id)object;
136 | - (AEMLessOrEqualsTest *)lessOrEquals:(id)object;
137 | - (AEMBeginsWithTest *)beginsWith:(id)object;
138 | - (AEMEndsWithTest *)endsWith:(id)object;
139 | - (AEMContainsTest *)contains:(id)object;
140 | - (AEMIsInTest *)isIn:(id)object;
141 |
142 | // Insertion location selectors
143 |
144 | - (AEMInsertionSpecifier *)beginning;
145 | - (AEMInsertionSpecifier *)end;
146 | - (AEMInsertionSpecifier *)before;
147 | - (AEMInsertionSpecifier *)after;
148 |
149 | // property and all-element specifiers
150 |
151 | - (AEMPropertySpecifier *)property:(OSType)propertyCode;
152 | - (AEMUserPropertySpecifier *)userProperty:(NSString *)propertyName;
153 | - (AEMAllElementsSpecifier *)elements:(OSType)classCode;
154 |
155 | // by-relative-position selectors
156 |
157 | - (AEMElementByRelativePositionSpecifier *)previous:(OSType)classCode;
158 | - (AEMElementByRelativePositionSpecifier *)next:(OSType)classCode;
159 |
160 | @end
161 |
162 |
163 | /**********************************************************************/
164 | // Properties
165 |
166 | /*
167 | * Specifier identifying an application-defined property
168 | */
169 | @interface AEMPropertySpecifier : AEMObjectSpecifier
170 | @end
171 |
172 |
173 | @interface AEMUserPropertySpecifier : AEMObjectSpecifier
174 | @end
175 |
176 |
177 | /**********************************************************************/
178 | // Single elements
179 |
180 | /*
181 | * Abstract base class for all single element specifiers
182 | */
183 | @interface AEMSingleElementSpecifier : AEMObjectSpecifier
184 | @end
185 |
186 | /*
187 | * Specifiers identifying a single element by name, index, id or named ordinal
188 | */
189 | @interface AEMElementByNameSpecifier : AEMSingleElementSpecifier
190 | @end
191 |
192 | @interface AEMElementByIndexSpecifier : AEMSingleElementSpecifier
193 | @end
194 |
195 | @interface AEMElementByIDSpecifier : AEMSingleElementSpecifier
196 | @end
197 |
198 | @interface AEMElementByOrdinalSpecifier : AEMSingleElementSpecifier
199 | @end
200 |
201 | @interface AEMElementByRelativePositionSpecifier : AEMObjectSpecifier
202 | @end
203 |
204 |
205 | /**********************************************************************/
206 | // Multiple elements
207 |
208 | /*
209 | * Base class for all multiple element specifiers.
210 | */
211 | @interface AEMMultipleElementsSpecifier : AEMObjectSpecifier
212 |
213 | // ordinal selectors
214 |
215 | - (AEMElementByOrdinalSpecifier *)first;
216 | - (AEMElementByOrdinalSpecifier *)middle;
217 | - (AEMElementByOrdinalSpecifier *)last;
218 | - (AEMElementByOrdinalSpecifier *)any;
219 |
220 | // by-index, by-name, by-id selectors
221 |
222 | - (AEMElementByIndexSpecifier *)at:(int)index;
223 | - (AEMElementByIndexSpecifier *)byIndex:(id)index; // normally NSNumber, but may occasionally be other types
224 | - (AEMElementByNameSpecifier *)byName:(id)name;
225 | - (AEMElementByIDSpecifier *)byID:(id)id_;
226 |
227 | // by-range selector
228 |
229 | - (AEMElementsByRangeSpecifier *)at:(int)startIndex to:(int)stopIndex;
230 | - (AEMElementsByRangeSpecifier *)byRange:(id)startReference to:(id)stopReference; // takes two con-based references, with other values being expanded as necessary
231 |
232 | // by-test selector
233 |
234 | - (AEMElementsByTestSpecifier *)byTest:(AEMTest *)testReference;
235 |
236 | @end
237 |
238 |
239 | @interface AEMElementsByRangeSpecifier : AEMMultipleElementsSpecifier {
240 | id startReference, stopReference;
241 | }
242 |
243 | - (id)initWithContainer:(AEMSpecifier *)container_
244 | start:(id)startReference_
245 | stop:(id)stopReference_
246 | wantCode:(OSType)wantCode_;
247 |
248 | - (id)startReference; // used by isEqual:
249 | - (id)stopReference; // used by isEqual:
250 |
251 | @end
252 |
253 |
254 | @interface AEMElementsByTestSpecifier : AEMMultipleElementsSpecifier
255 | @end
256 |
257 |
258 | @interface AEMAllElementsSpecifier : AEMMultipleElementsSpecifier
259 | @end
260 |
261 |
262 | /**********************************************************************/
263 | // Multiple element shim
264 |
265 | @interface AEMUnkeyedElementsShim : AEMSpecifier {
266 | OSType wantCode;
267 | }
268 |
269 | - (id)initWithContainer:(AEMSpecifier *)container_ wantCode:(OSType)wantCode_;
270 |
271 | @end
272 |
273 |
274 | /**********************************************************************/
275 | // Reference roots
276 |
277 | @interface AEMReferenceRootBase : AEMObjectSpecifier // abstract class
278 |
279 | // note: clients should avoid initialising this class directly;
280 | // use provided class methods or convenience macros instead
281 |
282 | @end
283 |
284 | @interface AEMApplicationRoot : AEMReferenceRootBase
285 |
286 | + (AEMApplicationRoot *)applicationRoot;
287 |
288 | @end
289 |
290 | @interface AEMCurrentContainerRoot : AEMReferenceRootBase
291 |
292 | + (AEMCurrentContainerRoot *)currentContainerRoot;
293 |
294 | @end
295 |
296 | @interface AEMObjectBeingExaminedRoot : AEMReferenceRootBase
297 |
298 | + (AEMObjectBeingExaminedRoot *)objectBeingExaminedRoot;
299 |
300 | @end
301 |
302 | @interface AEMCustomRoot : AEMReferenceRootBase {
303 | id rootObject;
304 | }
305 |
306 | + (AEMCustomRoot *)customRootWithObject:(id)object;
307 |
308 | - (id)initWithObject:(id)object;
309 |
310 | - (id)rootObject; // used by isEqual
311 |
312 | @end
313 |
314 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/terminology.h:
--------------------------------------------------------------------------------
1 | //
2 | // terminology.h
3 | // appscript
4 | //
5 |
6 | #import "types.h"
7 | #import "parser.h"
8 | #import "utils.h"
9 | #import "objectrenderer.h"
10 |
11 |
12 | /**********************************************************************/
13 |
14 |
15 | @interface ASNullConverter : NSObject
16 |
17 | - (NSString *)convert:(NSString *)name;
18 |
19 | - (NSString *)escape:(NSString *)name;
20 |
21 | @end
22 |
23 |
24 | /**********************************************************************/
25 |
26 |
27 | @interface ASCommandDef : NSObject {
28 | NSString *name;
29 | OSType eventClass, eventID;
30 | NSMutableDictionary *parameters;
31 | }
32 |
33 | - (id)initWithName:(NSString *)name_ eventClass:(OSType)eventClass_ eventID:(OSType)eventID_;
34 |
35 | - (void)addParameterWithName:(NSString *)name_ code:(OSType)code_;
36 |
37 | // PUBLIC
38 |
39 | - (NSString *)name;
40 |
41 | - (OSType)eventClass;
42 |
43 | - (OSType)eventID;
44 |
45 | - (AEMType *)parameterForName:(NSString *)name_;
46 |
47 | @end
48 |
49 |
50 | /**********************************************************************/
51 |
52 |
53 | @interface ASTerminology : NSObject {
54 | NSMutableDictionary *typeByName,
55 | *typeByCode,
56 | *propertyByName,
57 | *propertyByCode,
58 | *elementByName,
59 | *elementByCode,
60 | *commandByName;
61 | id converter;
62 | NSMutableDictionary *keywordCache;
63 | ASTerminology *defaultTerms;
64 | }
65 |
66 | // PUBLIC
67 |
68 | /*
69 | * converter : AS keyword string to C identifer string converter; should implement:
70 | * -(NSString *)convert:(NSString *)name
71 | * -(NSString *)escape:(NSString *)name
72 | *
73 | * defaultTerms may be nil
74 | */
75 | - (id)initWithKeywordConverter:(id)converter_
76 | defaultTerminology:(ASTerminology *)defaultTerms_;
77 |
78 | /*
79 | * add data from ASParser or equivalent
80 | */
81 | - (void)addClasses:(NSArray *)classes
82 | enumerators:(NSArray *)enumerators
83 | properties:(NSArray *)properties
84 | elements:(NSArray *)elements
85 | commands:(NSArray *)commands;
86 |
87 | // PRIVATE; used by addClasses:...commands: method
88 |
89 | - (void)addTypeTableDefinitions:(NSArray *)definitions ofType:(OSType)descType;
90 |
91 | - (void)addReferenceTableDefinitions:(NSArray *)definitions
92 | toNameTable:(NSMutableDictionary *)nameTable
93 | codeTable:(NSMutableDictionary *)codeTable;
94 |
95 | - (void)addCommandTableDefinitions:(NSArray *)commands;
96 |
97 | // PUBLIC
98 | // Get conversion tables (no copy)
99 |
100 | - (NSMutableDictionary *)typeByNameTable;
101 | - (NSMutableDictionary *)typeByCodeTable;
102 | - (NSMutableDictionary *)propertyByNameTable;
103 | - (NSMutableDictionary *)propertyByCodeTable;
104 | - (NSMutableDictionary *)elementByNameTable;
105 | - (NSMutableDictionary *)elementByCodeTable;
106 | - (NSMutableDictionary *)commandByNameTable;
107 |
108 | @end
109 |
110 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/test.h:
--------------------------------------------------------------------------------
1 | //
2 | // test.h
3 | // aem
4 | //
5 |
6 |
7 | #import "base.h"
8 | #import "specifier.h"
9 | #import "utils.h"
10 |
11 |
12 | /**********************************************************************/
13 | // Forward declarations
14 |
15 | @class AEMANDTest;
16 | @class AEMORTest;
17 | @class AEMNOTTest;
18 |
19 |
20 | /**********************************************************************/
21 | // initialise constants
22 |
23 | void initTestModule(void); // called automatically
24 |
25 | void disposeTestModule(void);
26 |
27 |
28 | /**********************************************************************/
29 | // Abstract base class for all comparison and logic test classes
30 |
31 | @interface AEMTest : AEMQuery
32 |
33 | - (AEMANDTest *)AND:(id)remainingOperands; // takes a single test clause or an NSArray of test clauses
34 | - (AEMORTest *)OR:(id)remainingOperands;
35 | - (AEMNOTTest *)NOT;
36 |
37 | - (NSString *)formatString;
38 |
39 | @end
40 |
41 |
42 | /**********************************************************************/
43 | // Comparison tests
44 |
45 | // Abstract base class for all comparison test classes
46 | @interface AEMComparisonTest : AEMTest {
47 | id operand1, operand2;
48 | }
49 |
50 | - (id)initWithOperand1:(id)operand1_ operand2:(id)operand2_;
51 |
52 | - (id)operand1; // used by isEqual:
53 | - (id)operand2; // used by isEqual:
54 |
55 | @end
56 |
57 | // comparison tests
58 | // Note: clients should not instantiate these classes directly
59 |
60 | @interface AEMGreaterThanTest : AEMComparisonTest
61 | @end
62 |
63 | @interface AEMGreaterOrEqualsTest : AEMComparisonTest
64 | @end
65 |
66 | @interface AEMEqualsTest : AEMComparisonTest
67 | @end
68 |
69 | @interface AEMNotEqualsTest : AEMComparisonTest
70 | @end
71 |
72 | @interface AEMLessThanTest : AEMComparisonTest
73 | @end
74 |
75 | @interface AEMLessOrEqualsTest : AEMComparisonTest
76 | @end
77 |
78 | @interface AEMBeginsWithTest : AEMComparisonTest
79 | @end
80 |
81 | @interface AEMEndsWithTest : AEMComparisonTest
82 | @end
83 |
84 | @interface AEMContainsTest : AEMComparisonTest
85 | @end
86 |
87 | @interface AEMIsInTest : AEMComparisonTest
88 | @end
89 |
90 |
91 | /**********************************************************************/
92 | // Logical tests
93 |
94 | // Abstract base class for all logical test classes
95 | @interface AEMLogicalTest : AEMTest {
96 | NSArray *operands;
97 | }
98 |
99 | - (id)initWithOperands:(NSArray *)operands_;
100 |
101 | - (id)operands; // used by isEqual:
102 |
103 | @end
104 |
105 | // logical tests
106 | // Note: clients should not instantiate these classes directly
107 |
108 | @interface AEMANDTest : AEMLogicalTest
109 | @end
110 |
111 | @interface AEMORTest : AEMLogicalTest
112 | @end
113 |
114 | @interface AEMNOTTest : AEMLogicalTest
115 | @end
116 |
117 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/types.h:
--------------------------------------------------------------------------------
1 | //
2 | // types.h
3 | // aem
4 | //
5 |
6 | #import "utils.h"
7 | #import "objectrenderer.h"
8 |
9 | /**********************************************************************/
10 | // not defined in __LP64__
11 |
12 | #ifdef __LP64__
13 | enum { typeFSS = 'fss ' };
14 | #endif
15 |
16 |
17 | /**********************************************************************/
18 | // convenience macros
19 |
20 | #define ASTrue [ASBoolean True]
21 | #define ASFalse [ASBoolean False]
22 |
23 |
24 | /**********************************************************************/
25 | // Boolean class represents AEDescs of typeTrue and typeFalse
26 |
27 |
28 | @interface ASBoolean : NSObject {
29 | BOOL boolValue;
30 | NSAppleEventDescriptor *cachedDesc;
31 | }
32 |
33 | + (id)True;
34 |
35 | + (id)False;
36 |
37 | // client's shouldn't call -initWithBool: directly; use +True/+False (or ASTrue/ASFalse macros) instead
38 | - (id)initWithBool:(BOOL)boolValue_;
39 |
40 | - (BOOL)boolValue;
41 |
42 | - (NSAppleEventDescriptor *)descriptor;
43 |
44 | @end
45 |
46 |
47 | /**********************************************************************/
48 | // file object classes represent AEDescs of typeAlias, typeFSRef, typeFSSpec
49 |
50 | //abstract base class
51 | @interface ASFileBase : NSObject {
52 | NSAppleEventDescriptor *desc;
53 | }
54 |
55 | + (NSURL *)HFSPathToURL:(NSString *)path;
56 |
57 | + (NSString *)URLToHFSPath:(NSURL *)url;
58 |
59 | - (id)initWithPath:(NSString *)path;
60 |
61 | - (id)initWithFileURL:(NSURL *)url;
62 |
63 | - (id)initWithDescriptor:(NSAppleEventDescriptor *)desc_;
64 |
65 | - (NSString *)path;
66 |
67 | - (NSURL *)url;
68 |
69 | - (NSAppleEventDescriptor *)descriptor;
70 |
71 | - (DescType)descriptorType;
72 |
73 | @end
74 |
75 |
76 | /***********************************/
77 | // concrete classes
78 |
79 | @interface ASAlias : ASFileBase
80 |
81 | + (id)aliasWithPath:(NSString *)path;
82 |
83 | + (id)aliasWithFileURL:(NSURL *)url;
84 |
85 | + (id)aliasWithDescriptor:(NSAppleEventDescriptor *)desc_;
86 |
87 | + (id)aliasWithAliasHandle:(AliasHandle)alias;
88 |
89 | - (AliasHandle)aliasHandle;
90 |
91 | @end
92 |
93 |
94 | @interface ASFileRef : ASFileBase
95 |
96 | + (id)fileRefWithPath:(NSString *)path;
97 |
98 | + (id)fileRefWithFileURL:(NSURL *)url;
99 |
100 | + (id)fileRefWithDescriptor:(NSAppleEventDescriptor *)desc_;
101 |
102 | + (id)fileRefWithFSRef:(FSRef)fsRef;
103 |
104 | - (FSRef)fsRef;
105 |
106 | @end
107 |
108 |
109 | @interface ASFileSpec : ASFileBase
110 | /*
111 | * Provided solely for backward compatibility with unreformed
112 | * Classic-era applications that don't understand typeFileURL.
113 | *
114 | * Avoid using this class unless absolutely necessary as
115 | * FSSpecs are deprecated in OS X and absent in 64-bit.
116 | *
117 | * To quote AEDataModel.h:
118 | *
119 | * FSSpecs are deprecated on Mac OS X, and their use in AppleEvents
120 | * is discouraged. You should change your code to use FSRefs. In
121 | * __LP64__ code, coercions into typeFSS is not supported, and coercion
122 | * from typeFSS is not guaranteed to work correctly in all cases.
123 | */
124 |
125 | + (id)fileSpecWithPath:(NSString *)path;
126 |
127 | + (id)fileSpecWithFileURL:(NSURL *)url;
128 |
129 | + (id)fileSpecWithDescriptor:(NSAppleEventDescriptor *)desc_;
130 |
131 | @end
132 |
133 |
134 | /**********************************************************************/
135 |
136 | // abstract base class for AEMType, AEMEnum, AEMProperty, AEMKeyword
137 | @interface AEMTypeBase : NSObject {
138 | DescType type;
139 | OSType code;
140 | NSAppleEventDescriptor *cachedDesc;
141 | }
142 |
143 | // clients shouldn't call this next method directly; use subclasses' class/instance initialisers instead
144 | - (id)initWithDescriptorType:(DescType)type_
145 | code:(OSType)code_
146 | desc:(NSAppleEventDescriptor *)desc;
147 |
148 | - (id)initWithDescriptor:(NSAppleEventDescriptor *)desc; // normally called by AEMCodecs -unpack:, though clients could also use it to wrap any loose NSAppleEventDescriptor instances they might have. Note: doesn't verify descriptor's type before use; clients are responsible for providing an appropriate value.
149 |
150 | - (id)initWithCode:(OSType)code_; // stub method; subclasses will override this to provide concrete implementations
151 |
152 | - (OSType)fourCharCode;
153 |
154 | - (NSAppleEventDescriptor *)descriptor;
155 |
156 | @end
157 |
158 |
159 | /***********************************/
160 | // concrete classes representing AEDescs of typeType, typeEnumerator, typeProperty, typeKeyword
161 | // note: unlike NSAppleEventDescriptor instances, instances of these classes are fully hashable
162 | // and comparable, so suitable for use as NSDictionary keys.
163 |
164 | @interface AEMType : AEMTypeBase
165 |
166 | + (id)typeWithCode:(OSType)code_;
167 |
168 | @end
169 |
170 |
171 | @interface AEMEnum : AEMTypeBase
172 |
173 | + (id)enumWithCode:(OSType)code_;
174 |
175 | @end
176 |
177 |
178 | @interface AEMProperty : AEMTypeBase
179 |
180 | + (id)propertyWithCode:(OSType)code_;
181 |
182 | @end
183 |
184 |
185 | @interface AEMKeyword : AEMTypeBase
186 |
187 | + (id)keywordWithCode:(OSType)code_;
188 |
189 | @end
190 |
191 |
192 | /**********************************************************************/
193 | // Unit types
194 |
195 | @interface ASUnits : NSObject {
196 | NSNumber *value;
197 | NSString *units;
198 | }
199 |
200 | + (id)unitsWithNumber:(NSNumber *)value_ type:(NSString *)units_;
201 |
202 | + (id)unitsWithInt:(int)value_ type:(NSString *)units_;
203 |
204 | + (id)unitsWithDouble:(double)value_ type:(NSString *)units_;
205 |
206 | - (id)initWithNumber:(NSNumber *)value_ type:(NSString *)units_;
207 |
208 | - (NSNumber *)numberValue;
209 |
210 | - (int)intValue;
211 |
212 | - (double)doubleValue;
213 |
214 | - (NSString *)units;
215 |
216 | @end
217 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/unittype.h:
--------------------------------------------------------------------------------
1 | //
2 | // unittype.h
3 | // aem
4 | //
5 |
6 | #import "types.h"
7 | #import "utils.h"
8 |
9 |
10 | /**********************************************************************/
11 | // Unit type definition
12 |
13 | @interface AEMUnitTypeDefinition : NSObject {
14 | NSString *name;
15 | DescType code;
16 | }
17 |
18 | + (id)definitionWithName:(NSString *)name_ code:(DescType)code_;
19 |
20 | - (id)initWithName:(NSString *)name_ code:(DescType)code_;
21 |
22 | - (NSString *)name;
23 |
24 | - (DescType)code;
25 |
26 | /*
27 | * The default implementation packs and unpacks the descriptor's data
28 | * handle as a double. Override these methods to support other formats.
29 | */
30 | - (NSAppleEventDescriptor *)pack:(ASUnits *)obj;
31 |
32 | - (ASUnits *)unpack:(NSAppleEventDescriptor *)desc;
33 |
34 | @end
35 |
36 | /**********************************************************************/
37 | // called by -[AEMCodecs init]
38 |
39 | void AEMGetDefaultUnitTypeDefinitions(NSDictionary **definitionsByName,
40 | NSDictionary **definitionsByCode);
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Headers/utils.h:
--------------------------------------------------------------------------------
1 | //
2 | // utils.h
3 | // Appscript
4 | //
5 |
6 | #import
7 | #import
8 |
9 | /**********************************************************************/
10 | // Clang macros
11 |
12 | #ifndef NSINTEGER_DEFINED
13 |
14 | #if __LP64__ || NS_BUILD_32_LIKE_64
15 | typedef long NSInteger;
16 | typedef unsigned long NSUInteger;
17 | #else
18 | typedef int NSInteger;
19 | typedef unsigned int NSUInteger;
20 | #endif
21 |
22 |
23 | #define NSIntegerMax LONG_MAX
24 | #define NSIntegerMin LONG_MIN
25 | #define NSUIntegerMax ULONG_MAX
26 |
27 | #define NSINTEGER_DEFINED 1
28 |
29 | #endif
30 |
31 |
32 |
33 | #ifndef __has_feature
34 | #define __has_feature(x) 0
35 | #endif
36 |
37 | #ifndef NS_RETURNS_RETAINED
38 |
39 | #if __has_feature(attribute_ns_returns_retained)
40 | #define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))
41 | #else
42 | #define NS_RETURNS_RETAINED
43 | #endif
44 |
45 | #endif
46 |
47 |
48 | /**********************************************************************/
49 |
50 | #define AEMIsDescriptorEqualToObject(desc, obj) ( \
51 | [obj isKindOfClass: [NSAppleEventDescriptor class]] \
52 | && ([desc descriptorType] == [obj descriptorType]) \
53 | && [[desc data] isEqualToData: [obj data]])
54 |
55 |
56 | /**********************************************************************/
57 | // supported by all self-packing objects
58 |
59 | @protocol AEMSelfPackingProtocol
60 |
61 | - (NSAppleEventDescriptor *)packWithCodecs:(id)codecs;
62 |
63 | @end
64 |
65 |
66 | /**********************************************************************/
67 |
68 | @protocol AEMCodecsProtocol
69 |
70 | - (NSAppleEventDescriptor *)pack:(id)obj;
71 |
72 | - (NSAppleEventDescriptor *)applicationRootDescriptor;
73 |
74 | - (id)unpack:(NSAppleEventDescriptor *)desc;
75 |
76 | - (id)fullyUnpackObjectSpecifier:(NSAppleEventDescriptor *)desc;
77 |
78 | @end
79 |
80 |
81 | /**********************************************************************/
82 |
83 | typedef enum {
84 | kASRelaunchNever,
85 | kASRelaunchSpecial,
86 | kASRelaunchAlways
87 | } ASRelaunchMode;
88 |
89 |
90 | /**********************************************************************/
91 |
92 | NSString *ASDescriptionForError(OSStatus err);
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Resources/BridgeSupport/Appscript.bridgesupport:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildMachineOSBuild
6 | 11A511
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | Appscript
11 | CFBundleIdentifier
12 | net.sourceforge.appscript.objc-appscript
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | Appscript
17 | CFBundlePackageType
18 | FMWK
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 0.1.0
23 | DTCompiler
24 | com.apple.compilers.llvm.clang.1_0
25 | DTPlatformBuild
26 | 4B110
27 | DTPlatformVersion
28 | GM
29 | DTSDKBuild
30 | 10J567
31 | DTSDKName
32 | macosx10.6
33 | DTXcode
34 | 0410
35 | DTXcodeBuild
36 | 4B110
37 |
38 |
39 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/_CodeSignature/CodeResources:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | files
6 |
7 | Resources/BridgeSupport/Appscript.bridgesupport
8 |
9 | /FWzoiY7+H7PaavwSn5xyZgEJS4=
10 |
11 | Resources/Info.plist
12 |
13 | G/JFGsVyRRHss890XcHfxKf32HQ=
14 |
15 |
16 | rules
17 |
18 | ^Resources/
19 |
20 | ^Resources/.*\.lproj/
21 |
22 | optional
23 |
24 | weight
25 | 1000
26 |
27 | ^Resources/.*\.lproj/locversion.plist$
28 |
29 | omit
30 |
31 | weight
32 | 1100
33 |
34 | ^version.plist$
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/Current:
--------------------------------------------------------------------------------
1 | A
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildMachineOSBuild
6 | 12D78
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | JSON Helper
11 | CFBundleIconFile
12 | json.icns
13 | CFBundleIdentifier
14 | com.vidblishen.jsonhelper
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | JSON Helper
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.04
23 | CFBundleSignature
24 | DfaB
25 | CFBundleVersion
26 | 1.04
27 | DTCompiler
28 | com.apple.compilers.llvm.clang.1_0
29 | DTPlatformBuild
30 | 4H512
31 | DTPlatformVersion
32 | GM
33 | DTSDKBuild
34 | 12D75
35 | DTSDKName
36 | macosx10.8
37 | DTXcode
38 | 0461
39 | DTXcodeBuild
40 | 4H512
41 | LSApplicationCategoryType
42 | public.app-category.developer-tools
43 | LSBackgroundOnly
44 |
45 | NSAppleScriptEnabled
46 | YES
47 | NSMainNibFile
48 | MainMenu
49 | NSPrincipalClass
50 | NSApplication
51 | OSAScriptingDefinition
52 | JSON Helper.sdef
53 |
54 |
55 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/MacOS/JSON Helper:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qlassiqa/qWorkflow/3362aa4a42ab0fc28a9dcc03f0171362d94dec1c/compiled source/bin/q_json.helper/Contents/MacOS/JSON Helper
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPLDfaB
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Resources/English.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qlassiqa/qWorkflow/3362aa4a42ab0fc28a9dcc03f0171362d94dec1c/compiled source/bin/q_json.helper/Contents/Resources/English.lproj/InfoPlist.strings
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Resources/English.lproj/MainMenu.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qlassiqa/qWorkflow/3362aa4a42ab0fc28a9dcc03f0171362d94dec1c/compiled source/bin/q_json.helper/Contents/Resources/English.lproj/MainMenu.nib
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Resources/JSON Helper.sdef:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
93 |
94 |
95 |
96 |
98 |
99 |
100 |
101 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/Resources/json.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qlassiqa/qWorkflow/3362aa4a42ab0fc28a9dcc03f0171362d94dec1c/compiled source/bin/q_json.helper/Contents/Resources/json.icns
--------------------------------------------------------------------------------
/compiled source/bin/q_json.helper/Contents/_CodeSignature/CodeResources:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | files
6 |
7 | Resources/English.lproj/InfoPlist.strings
8 |
9 | hash
10 |
11 | d/1b591E9fsKr9ppvfN99e6s/9Y=
12 |
13 | optional
14 |
15 |
16 | Resources/English.lproj/MainMenu.nib
17 |
18 | hash
19 |
20 | qlaN3ODh2UX1vsT62p/DAPYZ/hw=
21 |
22 | optional
23 |
24 |
25 | Resources/JSON Helper.sdef
26 |
27 | 0N9Shz5x8RzkXicSZgqGQg7cDqc=
28 |
29 | Resources/json.icns
30 |
31 | SVXTiQESCWxAwFL5+DtxHMFd1p8=
32 |
33 |
34 | rules
35 |
36 | ^Resources/
37 |
38 | ^Resources/.*\.lproj/
39 |
40 | optional
41 |
42 | weight
43 | 1000
44 |
45 | ^Resources/.*\.lproj/locversion.plist$
46 |
47 | omit
48 |
49 | weight
50 | 1100
51 |
52 | ^version.plist$
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/compiled source/bin/q_notifier.helper:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qlassiqa/qWorkflow/3362aa4a42ab0fc28a9dcc03f0171362d94dec1c/compiled source/bin/q_notifier.helper
--------------------------------------------------------------------------------
/compiled source/q_workflow.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qlassiqa/qWorkflow/3362aa4a42ab0fc28a9dcc03f0171362d94dec1c/compiled source/q_workflow.scpt
--------------------------------------------------------------------------------
/documentation/Documentation.md:
--------------------------------------------------------------------------------
1 | #qWorkflow Library
2 |
3 | ##A. Introduction
4 | This is an AppleScript library for creating workflows with Alfred 2. This library provides an object-oriented class with functions for working with plist settings files, reading and writing data to files, generating Alfred feedback results, requesting remote data, and more.
5 |
6 | It was originally created by [David Ferguson using PHP](https://github.com/jdfwarrior/Workflows), and was entirely rewritten by me using AppleScript to provide the same functionality to all my fellow AppleScript lovers.
7 |
8 | So you may be asking yourself:
9 |
10 | * ***why on Earth would I use AppleScript when I already have PHP, Python, Ruby, Bash, etc.?*** - yes, it's true, Alfred can be scripted using all those languages, but ask yourself this: **are you able to control MacOS and its Apps using those languages?** I'm afraid not, and this is where AppleScript comes to help.
11 |
12 | * ***but isn't it simpler to use my PHP / Python / etc. skills and combine them with AppleScript inside Alfred?*** Actually no, it isn't simpler - I've tried it, and it becomes really messy, not to mention that Alfred's workflow system doesn't allow that much mixing.
13 |
14 | **NOTE:** the `compiled source` folder contains the ready-to-use library script (the files inside this folder should be put inside your Alfred workflow's folder); the `uncompiled source` folder contains the plain .applescript file that you can view online, and it contains fully commented code to better understand what I did there.
15 |
16 | ##B. Features
17 | There are a lot of things you can do with this library to make your life a lot easier when creating & programming your Alfred Workflows, so here's a list of the most important features (the list will grow while I improve the library):
18 |
19 | * **object-oriented approach** to write less & more readable code
20 | * internal **workflow introspection** (finding the bundle ID, cache & storage paths)
21 | * generate Alfred-compatible **XML feedback** with ease
22 | * saving & retrieving **workflow-related settings**
23 | * **remote data requests**, as well as **JSON support** (thanks to David @[Mousedown Software](http://www.mousedown.net/mouseware/index.html))
24 | * **sending notifications** through the Notification Center (thanks to [Daji-Djan](https://github.com/Daij-Djan/DDMountainNotifier))
25 | * various **internal utilities that improve AppleScript** (string and date manipulation, file system utilities)
26 |
27 | ##C. Known Limitations
28 | Now, because AppleScript is a bit limited in terms of capabilities, some functionality isn't available right now, but I will try to improve this library further.
29 |
30 | * **no JSONP support yet** - AppleScript doesn't know anything about JSON or JSONP, so I had to get help from [Mousedown Software](http://www.mousedown.net/mouseware/index.html), and they provided me with a fully functional and really fast JSON helper for which I've made a wrapper to embed it inside my library, and hopefully they will add JSONP support in the near feature; but until then you will have to make sure you're only working with JSON data
31 |
32 | * **strict syntax for accessing JSON properties** - the [JSON Helper](http://www.mousedown.net/mouseware/JSONHelper.html) that I'm using to add JSON capabilities to this library parses JSON data and converts it to native AppleScript lists and records, and it's obvious that some JSON properties will have the same name as AppleScript's reserved keywords, so to avoid any syntax issues it's highly recommended that you enclose all JSON property names in vertical bar characters, like so: `|text| of |result| of item 1 of json` (both `text` and `result` are reserved keywords in the AppleScript language, and not using the vertical bars would trigger errors in your code)
33 |
34 | * **bigger file size** - since AppleScript requires extra coding for text manipulation and object handling, the file size is a bit large compared to the PHP equivalent, and it will probably increase as I add new features to it (features that are totally worth the size increase)
35 |
36 | * **strict syntax for plist records** - it's known that AppleScript's records are a bit clumsy since they lack so many features, that's why when saving a list of records as a PList settings file you should adhere to the following strict record notation:
37 |
38 | ```
39 | {
40 | {theKey:"someKeyName", theValue: "textValue"},
41 | {theKey:"mynum", theValue: 2},
42 | {theKey: "booltest", theValue: false},
43 | {theKey:"na", theValue: missing value}
44 | }
45 | ```
46 |
47 | ##D. Initialization
48 | Before you write any code, it's imperative that you copy the `q_workflow.scpt` library file.
49 |
50 | **NOTE:** If you plan to use the NotificationCenter methods to trigger notifications or if you plan on using the JSON capabilities of this library, then it's vital that you also copy the `bin` folder to your Workflow folder "as is" since it contains the helper utilities that provide these extra features. Note that trying to send notifications or read JSON without having the bin folder in your Workflow folder will produce no result (and yes, the utilities have to stay inside the bin folder at all time with the current filenames for this to work).
51 |
52 | ```
53 | set workflowFolder to do shell script "pwd"
54 | set wlib to load script POSIX file (workflowFolder & "/q_workflow.scpt")
55 | set wf to wlib's new_workflow()
56 | ```
57 |
58 | or by specifying a bundle name:
59 |
60 | ```
61 | ...
62 | set wf to wlib's new_workflow_with_bundle("com.mycompany.mybundlename")
63 | ```
64 |
65 | **Explanations:**
66 | * the first line determines the Alfred workflow's bundle path because this is where the "q_workflow.scpt" library should be placed in order to work
67 |
68 | * the second line loads the library from the bundle's path assuming that you already placed it there
69 |
70 | * the last line creates a new script object (the equivalent of a class in other languages) with all the required functionality
71 |
72 | * since AppleScript doesn't support optional parameters, there are 2 constructors: `new_workflow()` with no parameters, which creates a new class that automatically fetches the bundle name from Alfred, and `new_workflow_with_bundle()`, which takes 1 parameter with the desired bundle name if none was specified in Alfred.
73 |
74 | ##E. Methods
75 | This library provides 2 categories of methods, namely **workflow methods** and **utility methods**. Workflow methods can be used only after creating a new workflow class (these are also known as instance methods), and provide basic handlers to deal with Alfred Workflows. Utility methods, on the other hand, contain handlers that are used internally by the workflow methods, as well as useful handlers for regular use that enhance AppleScript's capabilities (these include string and date manipulation, file system checks, sending notification, etc.)
76 |
77 | ### Workflow Methods
78 | ####1. get\_bundle()
79 | Takes no parameter and returns the value of the bundle id for the current workflow. If no value is available, then `missing value` is returned.
80 |
81 | *Example:*
82 | ```
83 | wf's get_bundle()
84 | ```
85 |
86 | output:
87 | ```
88 | com.qlassiqa.iTunesRatings
89 | ```
90 |
91 | ####2. get\_data()
92 | Takes no parameter and returns the value of the path to the storage directory for your workflow if it is available. Returns missing value if the value isn't available.
93 |
94 | *Example:*
95 | ```
96 | wf's get_data()
97 | ```
98 |
99 | output:
100 | ```
101 | /Users/qlassiqa/Library/Application Support/Alfred 2/Workflow Data/com.qlassiqa.iTunesRatings/
102 | ```
103 |
104 | ####3. get\_cache()
105 | Takes no parameter and returns the value of the path to the cache directory for your workflow if it is available. Returns missing value if the value isn't available.
106 |
107 | *Example:*
108 | ```
109 | wf's get_cache()
110 | ```
111 |
112 | output:
113 | ```
114 | /Users/qlassiq/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.qlassiqa.iTunesRatings/
115 | ```
116 |
117 | ####4. get\_path()
118 | Takes no parameter and returns the value of the path to the current folder for your workflow if it is available. Returns missing value if the value isn't available.
119 |
120 | *Example:*
121 | ```
122 | wf's get_path()
123 | ```
124 |
125 | output:
126 | ```
127 | /Users/qlassiqa/Dropbox/Public/Alfred2/Alfred.alfredpreferences/workflows/user.workflow.3BA9A8FC-75DB-494F-926A-CE19221E1211/
128 | ```
129 |
130 | ####5. get\_home()
131 | Takes no parameter and returns the value of the home path for the current user. Returns missing value if the value isn't available.
132 |
133 | *Example:*
134 | ```
135 | wf's get_path()
136 | ```
137 |
138 | output:
139 | ```
140 | /Users/qlassiqa
141 | ```
142 |
143 | ####6. set\_value(key, value, plistfile)
144 | Save values to a specified plist. If the plist file doesn't exist, it will be created in the workflow's data folder, and if the plistfile parameter is `missing value` or an empty string, a default "settings.plist" file will be created.
145 |
146 | If the first parameter is a record list then the second parameter becomes the plist file to save to. Or you could just ignore this and use the `set_values` method that takes only 2 parameters for this scenario (presented next).
147 |
148 | If the first parameter is text, then it is assumed that the first parameter is the key, the second parameter is the value, and the third parameter is the plist file to save the data to.
149 |
150 | *Example:*
151 | ```
152 | # add a username key with a text value to a default "settings.plist" file
153 | 1. wf's set_value("username", "mike", "")
154 |
155 | # add a key with a boolean value
156 | 2. wf's set_value("default", true, "")
157 |
158 | # add a key with a number value to a specific plist file
159 | 3. wf's set_value("age", 23, "settings.plist")
160 |
161 | # add a key with a real number value
162 | 4. wf's set_value("weight", 65.3, "settings.plist")
163 |
164 | # doesn't add anything since missing value was passed
165 | 5. wf's set_value("none", missing value, "settings.plist")
166 |
167 | # add a list with mixed values
168 | 6. wf's set_value("my first list", {1, 2, 3, "bob"}, "settings.plist")
169 |
170 | # add a list with values and a sublist
171 | 7. wf's set_value("my second list", {1, 2, 3, {"bob", "anne"}}, "settings.plist")
172 |
173 | # replace previously created key
174 | 8. wf's set_value("username", "john", "settings.plist")
175 | ```
176 |
177 | output:
178 | ```
179 |
180 |
181 |
182 | age
183 | 23
184 | default
185 |
186 | my first list
187 |
188 | 1
189 | 2
190 | 3
191 | bob
192 |
193 | my second list
194 |
195 | 1
196 | 2
197 | 3
198 |
199 | bob
200 | anne
201 |
202 |
203 | username
204 | john
205 | weight
206 | 65.299999999999997
207 |
208 |
209 | ```
210 |
211 | ####7. set\_values(listofrecords, plistfile)
212 | Save a list of records to a specified plist. If the plist file doesn't exist, it will be created in the workflow's data folder, and if the plistfile parameter is `missing value` or an empty string, a default "settings.plist" file will be created.
213 |
214 | Each record must adhere to the following notation:
215 |
216 | ```{theKey: "somekeyname", theValue: 13}```
217 |
218 | *Example:*
219 | ```
220 | set theList to {{theKey:"favcolor", theValue:"red"}, {theKey:"hobbies", theValue:{"sports", "music"}}}
221 | wf's set_values(theList, "settings.plist")
222 | ```
223 |
224 | output:
225 | ```
226 |
227 |
228 |
229 | favcolor
230 | red
231 | hobbies
232 |
233 | sports
234 | music
235 |
236 |
237 |
238 | ```
239 |
240 | ####8. get\_value(key, plistfile)
241 | Read a value from the specified plist. Note that if the plist file cannot be located, the script will automatically create an empty plist file in the data folder of the workflow. Also, if the plistfile parameter is `missing value` or an empty string, a default "settings.plist" file will be created.
242 |
243 | *Example:*
244 | ```
245 | # get a simple value from the default "settings.plist" file
246 | 1. wf's get_value("username", "")
247 |
248 | # get a simple list (see example plist on method [5])
249 | 2. wf's get_value("my first list", "settings.plist")
250 |
251 | # get a list containing a sublist (see example plist on method [5])
252 | 3. wf's get_value("my second list", "settings.plist")
253 | ```
254 |
255 | output:
256 | ```
257 | 1. mike
258 | 2. {1,2,3,"bob"}
259 | 3. {1,2,3,{"bob","anne"}}
260 | ```
261 |
262 | ####9. request(url)
263 | Read data from a remote file/url, essentially a shortcut for curl
264 |
265 | *Example:*
266 | ```
267 | # get a json file from twitter
268 | 1. wf's request("http://mysite.com/search.json?q=json&rpp=5")
269 |
270 | # get the contents of a website
271 | 2. wf's request("http://www.adobe.com/")
272 | ```
273 |
274 | output:
275 | ```
276 | 1. "{
277 | "name": "JSON.sh",
278 | "version": "0.1.4",
279 | "description": "JSON parser written in bash",
280 | "homepage": "http://github.com/dominictarr/JSON.sh",
281 | "repository": {
282 | "type": "git",
283 | "url": "https://github.com/dominictarr/JSON.sh.git"
284 | },
285 | "bin": {
286 | "JSON": "./JSON.sh"
287 | },
288 | "dependencies": {},
289 | "devDependencies": {},
290 | "author": "Dominic Tarr",
291 | "scripts": { "test": "./all-tests.sh" }
292 | }"
293 |
294 | 2. the raw html contents of Adobe's website
295 | ```
296 |
297 | ####10. request\_json(url)
298 | Read & parse raw JSON data from a remote file/url, and converts it to native AppleScript records and lists (or missing value if an invalid JSON or URL). Note that this will \*NOT\* work with JSONP data, but only with JSON.
299 |
300 | *Example:*
301 | ```
302 | 1. set json to wf's request_json("http://mysite.com/search.json?q=json&rpp=5")
303 | ```
304 |
305 | output:
306 | ```
307 | {
308 | name: "JSON.sh",
309 | version: "0.1.4",
310 | description: "JSON parser written in bash",
311 | homepage: "http://github.com/dominictarr/JSON.sh",
312 | repository: {
313 | type: "git",
314 | url: "https://github.com/dominictarr/JSON.sh.git"
315 | },
316 | bin: {
317 | JSON: "./JSON.sh"
318 | },
319 | dependencies: {},
320 | devDependencies: {},
321 | author: "Dominic Tarr",
322 | scripts: {
323 | test: "./all-tests.sh"
324 | }
325 | }
326 | ```
327 |
328 | accessing individual JSON data:
329 | ```
330 | 1. |name| of json
331 | 2. count of |repository| of json
332 | 3. |JSON| of |bin| of json
333 | ```
334 |
335 | ####11. mdfind(query)
336 | Allows searching the local hard drive using mdfind, and returns a list of all found paths.
337 |
338 | *Example:*
339 | ```
340 | wf's mdfind("php.ini")
341 | ```
342 |
343 | output:
344 | ```
345 | {
346 | "/private/etc/php.ini.default",
347 | "/usr/local/php/lib/php.ini",
348 | ...
349 | }
350 | ```
351 |
352 | ####12. write\_file(textorlist, cachefile)
353 | Accepts data and a string file name to store data to local file. Each call to this method will overwrite the file if it already exists.
354 |
355 | **Note:** due to AppleScript's lack of JSON support, this method can write to file only a piece of text, a value that can be converted to text, or a list that doesn't contain sublists or records.
356 |
357 | *Example:*
358 | ```
359 | 1. wf's write_file("testing" & return & "string", "test.dat")
360 | 2. wf's write_file(12.5, "test.dat")
361 | ```
362 |
363 | output:
364 | ```
365 | 1. testing
366 | string
367 |
368 | 2. 12.5
369 | ```
370 |
371 | ####13. read\_file(cachefile)
372 | Returns data from a local cache file, or missing value if the file doesn't exist. Note that if the file exists but is empty, it will be automatically deleted to clean up the workflow folder.
373 |
374 | *Example:*
375 | ```
376 | wf's write_file(12.5, "test.dat")
377 | wf's read_file("test.dat")
378 | ```
379 |
380 | output:
381 | ```
382 | "12.5"
383 | ```
384 |
385 | ####14. add\_result with(out) isValid given theUid, theArg, theTitle, theSubtitle, theAutocomplete, theIcon, theType
386 | Creates a new result item that is cached within the class object. This set of results is available via the get_results() functions, or, can be formatted and returned as XML via the to_xml() function.
387 |
388 | **Note:** this method uses the labeled parameter syntax in AppleScript (see example), and takes the following 'camelCase' parameters:
389 |
390 | * **theUid**: the uid attribute is a value that is used to help Alfred learn about your results. You know that Alfred learns based on the items you use the most. That same mechanism can be used in feedback results. Give your results a unique identifier and Alfred will learn which ones you use the most and prioritize them by moving them up in the result list (or omit this attribute to show the results in the preferred order)
391 |
392 | * **theArg**: the arg attribute is the value that is passed to the next portion of the workflow when the result item is selected in the Alfred results list. So if you pressed enter on a result, the arg value would be passed to a shell script, applescript, or any of the other Action items
393 |
394 | * **theTitle**: the title element is the value that is shown in large text as the title for the result item. This is the main text/title shown in the results list
395 |
396 | * **theSubtitle**: the subtitle element is the value shown under the title in the results list. When performing normal searches within Alfred, this is the area where you would normally see the file path
397 |
398 | * **theAutocomplete**: the autocomplete attribute is only used when the valid attribute has been set to `false`. When attempting to action an item that has the valid attribute set to 'no' and an autocomplete value is specified, the autocomplete value is inserted into the Alfred window. When using this attribute, the arg attribute is ignored
399 |
400 | * **theType**: the type attribute allows you to specify what type of result you are generating. Currently, the only value available for this attribute is "file". This will allow you to specify that the feedback item is a file and allows you to use Result Actions on the feedback item
401 |
402 | * **theIcon**: the icon element allows you to specify the icon to use for your result item. This can be a file located in your workflow directory, an icon of a file type on your local machine, or the icon of a specific file on your system. To use the icons of a specific file type you use this syntax `"filetype:public.folder"`. To use the icons of another folder/file you use this syntax `"fileicon:/Applications"`. To use an icon inside a subfolder located within the workflow you use this syntax `"subfolder/icon.png"` (omitting this attribute will search for the default `icon.png` file in the workflow folder).
403 |
404 | *Example:* (the following code was separated on different lines for easier reading, but should be written on a single line or separated using the "¬" AppleScript reserverd character.
405 | ```
406 | 1. add_result of wf without isValid given
407 | theUid:"alfred",
408 | theArg:"alfredapp",
409 | theTitle:"Alfred",
410 | theAutocomplete:"Alfred",
411 | theSubtitle:"/Applications/Alfred.app",
412 | theIcon:"fileicon:/Applications/Alfred 2.app",
413 | theType:"Alfredapp"
414 |
415 | 2. add_result of wf with isValid given
416 | theUid:"r9996",
417 | theArg:5,
418 | theTitle:"Alfred",
419 | theSubtitle:"",
420 | theAutocomplete:missing value,
421 | theIcon:"icon.png",
422 | theType:missing value
423 | ```
424 |
425 | output:
426 | ```
427 | 1. {theUid:"alfred", theArg:"alfredapp", theTitle:"Alfred", theSubtitle:"/Applications/Alfred.app", theIcon:"fileicon:/Applications/Alfred 2.app", isValid:false, theAutocomplete:"Alfred", theType:"Alfredapp"}
428 |
429 | 2. {theUid:"r9996", theArg:5, theTitle:"Alfred", theSubtitle:"", theIcon:"icon.png", isValid:true, theAutocomplete:"", theType:missing value}
430 | ```
431 |
432 | **Note:** any of the above parameters can accept empty strings or missing values.
433 |
434 | ####15. get\_results()
435 | Returns a list of available result items from the class' internal cache.
436 |
437 | *Example:*
438 | ```
439 | add_result of wf without isValid given theUid:"alfred", theArg:"alfredapp", theTitle:"Alfred", theAutocomplete:"Alfred", theSubtitle:"/Applications/Alfred.app", theIcon:"fileicon:/Applications/Alfred 2.app", theType:"Alfredapp"
440 |
441 | add_result of wf with isValid given theUid:"r9996", theArg:5, theTitle:"Alfred", theSubtitle:"", theAutocomplete:missing value, theIcon:"icon.png", theType:missing value
442 |
443 | wf's get_results()
444 | ```
445 |
446 | output:
447 | ```
448 | {
449 | {theUid:"alfred", theArg:"alfredapp", theTitle:"Alfred", theSubtitle:"/Applications/Alfred.app", theIcon:"fileicon:/Applications/Alfred 2.app", isValid:false, theAutocomplete:"Alfred", theType:"Alfredapp"},
450 | {theUid:"r9996", theArg:5, theTitle:"Alfred", theSubtitle:"", theIcon:"icon.png", isValid:true, theAutocomplete:"", theType:missing value}
451 | }
452 | ```
453 |
454 | ####16. to\_xml(listofrecords)
455 | Convert a list of records into XML format. Passing an empty string or `missing value` as the parameter will make the method use the class' internal cache results as the list of records (this is built using the `add_result` method).
456 |
457 | *Example:*
458 | ```
459 | add_result of wf without isValid given theUid:"alfred", theArg:"alfredapp", theTitle:"Alfred", theAutocomplete:"Alfred", theSubtitle:"/Applications/Alfred.app", theIcon:"fileicon:/Applications/Alfred 2.app", theType:"Alfredapp"
460 |
461 | add_result of wf with isValid given theUid:"r9996", theArg:5, theTitle:"Alfred", theSubtitle:"", theAutocomplete:missing value, theIcon:"icon.png", theType:missing value
462 |
463 | wf's to_xml("")
464 | ```
465 |
466 | output:
467 | ```
468 |
469 |
470 | -
471 | Alfred
472 | /Applications/Alfred.app
473 | /Applications/Alfred 2.app
474 |
475 | -
476 | Alfred
477 |
478 | icon.png
479 |
480 |
481 | ```
482 |
483 | ### Utility Methods
484 | ####1. q\_trim(text)
485 | Removes any whitespace characters from the start and end of a given text.
486 |
487 | *Example:*
488 | ```
489 | wlib's q_trim(" abc " & return & " def")
490 | ```
491 |
492 | output:
493 | ```
494 | abc
495 | def
496 | ```
497 |
498 | ####2. q\_join(list, delimiter or string of delimiters)
499 | Takes the elements of a list and returns a text with the joined elements using the specified delimiter or string of delimiters.
500 |
501 | *Example:*
502 | ```
503 | 1. q_join({"Test", "me", "now"}, ".")
504 | 2. q_join({"Test", "me", "now"}, ". ")
505 | ```
506 |
507 | output:
508 | ```
509 | 1. Test.me.now
510 | 2. Test. me. now
511 | ```
512 |
513 | ####3. q\_split(text, delimiter or string of delimiters or list of delimiters)
514 | Takes a piece of text and splits it into smaller pieces based on specific delimiters that will be ignored. The resulting pieces are put in a list.
515 |
516 | *Example:*
517 | ```
518 | 1. q_split("Test. Me. Now", ".")
519 | 2. q_split("Test. Me, now", {". ", ","})
520 | ```
521 |
522 | output:
523 | ```
524 | 1. {"Test", " Me", " Now"}
525 | 2. {"Test", "Me", " now"}
526 | ```
527 |
528 | ####4. q\_is\_empty(string or list)
529 | Takes a text or list and checks if it's empty. An empty text is one that, when trimmed at both ends, has a length of 0. A list is empty when it has no elements. Also, `missing value` is also considered an empty value, so it will return true.
530 |
531 | *Example:*
532 | ```
533 | 1. q_is_empty("")
534 | 2. q_is_empty(" ")
535 | 3. q_is_empty(" a ")
536 | 4. q_is_empty({})
537 | 5. q_is_empty({"a"})
538 | ```
539 |
540 | output:
541 | ```
542 | 1. true
543 | 2. true
544 | 3. false
545 | 4. true
546 | 5. false
547 | ```
548 |
549 | ####5/6/7. q\_file\_exists, q\_folder\_exists, q\_path\_exists
550 | All methods are used to check if a given file or folder exists. The `q_file_exists` checks if a file path exists, the `q_folder_exists` checks if a folder or volume path exists, while the `q_path_exists` checks if a file/folder/volume path exists.
551 |
552 | All three methods work with both HFS and Unix path styles, but none of them expand the tilde character (~).
553 |
554 | *Example:*
555 | ```
556 | 1. q_file_exists("MacHD:Users:mike:Desktop:test.txt")
557 | 2. q_file_exists("MacHD:Users:mike:")
558 | 3. q_folder_exists("MacHD:Users:mike:")
559 | 4. q_folder_exists("MacHD:Users:mike")
560 | 5. q_folder_exists("Users/mike")
561 | 6. q_folder_exists("/Users/mike")
562 | 7. q_folder_exists("MacHD")
563 | 8. q_folder_exists("MacHD:")
564 | 9. q_path_exists("MacHD:Users:mike:Desktop:test.txt")
565 | 10. q_path_exists("MacHD:")
566 | ```
567 |
568 | output:
569 | ```
570 | 1. true
571 | 2. false
572 | 3. true
573 | 4. true
574 | 5. true
575 | 6. true
576 | 7. false
577 | 8. true
578 | 9. true
579 | 10. true
580 | ```
581 |
582 | ####8. q\_clean\_list(list)
583 | Takes a list and removes all `missing value` elements from it and its sublists, if any (recursively)
584 |
585 | *Example:*
586 | ```
587 | 1. q_clean_list({1, missing value, 2})
588 | 2. q_clean_list({1, missing value, {2, missing value}})
589 | ```
590 |
591 | output:
592 | ```
593 | 1. {1, 2}
594 | 2. {1, {2}}
595 | ```
596 |
597 | ####9. q\_encode(text)
598 | Encodes a given text to valid XML text.
599 |
600 | *Example:*
601 | ```
602 | q_encode("testing \" and &")
603 | ```
604 |
605 | output:
606 | ```
607 | testing " and &
608 | ```
609 |
610 | ####10. q\_date\_to\_unixdate(date)
611 | Takes a native AppleScript date value and converts it to a Unix formatted date.
612 |
613 | *Example:*
614 | ```
615 | q_date_to_unixdate(current date)
616 | ```
617 |
618 | output:
619 | ```
620 | 03/22/2013 11:47:33 PM
621 | ```
622 |
623 | ####11. q\_unixdate\_to\_date(text)
624 | Takes a Unix formatted date and converts it to a native AppleScript date value.
625 |
626 | *Example:*
627 | ```
628 | q_unixdate_to_date("03/22/2013 11:47:33 PM")
629 | ```
630 |
631 | output:
632 | ```
633 | date "Friday, March 22, 2013 11:47:33 PM"
634 | ```
635 |
636 | ####12. q\_date\_to\_timestamp(date)
637 | Takes a native AppleScript date value and converts it to an epoch timestamp.
638 |
639 | *Example:*
640 | ```
641 | q_date_to_timestamp(current date)
642 | ```
643 |
644 | output:
645 | ```
646 | 1363988971
647 | ```
648 |
649 | ####13. q\_timestamp\_to\_date(text)
650 | Takes an epoch timestamp and converts it to a native AppleScript date value.
651 |
652 | *Example:*
653 | ```
654 | 1. q_timestamp_to_date("1363988971")
655 | 2. q_timestamp_to_date("1363988971000")
656 | ```
657 |
658 | output:
659 | ```
660 | 1. date "Friday, March 22, 2013 11:49:31 PM"
661 | 2. date "Friday, March 22, 2013 11:49:31 PM"
662 | ```
663 |
664 | ####14. q\_send\_notification(message, details, extra)
665 | Displays a notification through MacOS's Notification Center system. A notification is made out of 3 parts: the top message text which appears in bold, the middle detailed information text, and the bottom extra information text - a notification must have at least a message or an extra text.
666 |
667 | ####15. q\_notify()
668 | Takes no parameters and displays a generic notification through MacOS's Notification Center system.
669 |
670 | ####16. q\_encode\_url(str)
671 | Encodes a string for passing it to a URL without breaking the URL.
672 |
673 | *Example:*
674 | ```
675 | q_encode_url("search=a&b=c")
676 | ```
677 |
678 | output:
679 | ```
680 | search%3Da%26b%3Dc
681 | ```
682 |
683 | ####17. q\_decode\_url(str)
684 | Decodes a URL formatted string into a regular text.
685 |
686 | *Example:*
687 | ```
688 | q_decode_url("search%3Da%26b%3Dc")
689 | ```
690 |
691 | output:
692 | ```
693 | search=a&b=c
694 | ```
695 |
696 | ##F. Licensing
697 | This library is free to use, copy and modify, and is provided "AS IS", without warranty of any kind. However, I will greatly appreciate it if you'd give me credit and mention me in your works or anywhere you use this library.
698 |
699 | The use of the helper utilities shipped with this library is subject to each author's license, which can be read at the links provided in [section B].
--------------------------------------------------------------------------------
/example workflows/README.md:
--------------------------------------------------------------------------------
1 | #Example Alfred Workflows
2 |
3 | ###iTunes Ratings
4 | An example Alfred workflow file that uses my AppleScript qWorkflow library to show iTunes's rating for the currently playing song and also provides options to rate it differently (and in a funny way).
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | ###Twitter Search
18 | An example Alfred workflow that uses the same qWorkflow library to find the latest world wide tweets in real-time for a given search query using the JSON capabilities provided by this library (note the support for unicode character output).
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/example workflows/Search Twitter.alfredworkflow:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qlassiqa/qWorkflow/3362aa4a42ab0fc28a9dcc03f0171362d94dec1c/example workflows/Search Twitter.alfredworkflow
--------------------------------------------------------------------------------
/example workflows/iTunes Ratings.alfredworkflow:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qlassiqa/qWorkflow/3362aa4a42ab0fc28a9dcc03f0171362d94dec1c/example workflows/iTunes Ratings.alfredworkflow
--------------------------------------------------------------------------------
/example workflows/screenshots/screenshot.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qlassiqa/qWorkflow/3362aa4a42ab0fc28a9dcc03f0171362d94dec1c/example workflows/screenshots/screenshot.jpg
--------------------------------------------------------------------------------
/example workflows/screenshots/screenshot2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qlassiqa/qWorkflow/3362aa4a42ab0fc28a9dcc03f0171362d94dec1c/example workflows/screenshots/screenshot2.jpg
--------------------------------------------------------------------------------
/example workflows/screenshots/screenshot3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qlassiqa/qWorkflow/3362aa4a42ab0fc28a9dcc03f0171362d94dec1c/example workflows/screenshots/screenshot3.jpg
--------------------------------------------------------------------------------
/example workflows/screenshots/screenshot4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qlassiqa/qWorkflow/3362aa4a42ab0fc28a9dcc03f0171362d94dec1c/example workflows/screenshots/screenshot4.jpg
--------------------------------------------------------------------------------
/example workflows/screenshots/screenshot5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qlassiqa/qWorkflow/3362aa4a42ab0fc28a9dcc03f0171362d94dec1c/example workflows/screenshots/screenshot5.jpg
--------------------------------------------------------------------------------
/uncompiled source/q_workflow.applescript:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qlassiqa/qWorkflow/3362aa4a42ab0fc28a9dcc03f0171362d94dec1c/uncompiled source/q_workflow.applescript
--------------------------------------------------------------------------------