├── README.md ├── Skimmer.alfredworkflow ├── dev ├── action_copy-skimmer-url.scpt ├── action_export-notes.scpt ├── action_export_notes_chunked.scpt ├── action_skim_to_devon.scpt ├── 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 ├── get_config.scpt ├── info.plist ├── json.scpt ├── pdf_splitter.app │ └── Contents │ │ ├── Info.plist │ │ ├── MacOS │ │ └── applet │ │ ├── PkgInfo │ │ └── Resources │ │ ├── Scripts │ │ └── main.scpt │ │ ├── _ui-helpers.scpt │ │ ├── applet.icns │ │ ├── applet.rsrc │ │ └── description.rtfd │ │ └── TXT.rtf ├── test.py ├── test.scpt └── testing.scpt ├── screenshots ├── skimmer_extract.png ├── skimmer_final.png ├── skimmer_original.png └── skimmer_split.png └── source ├── _config.applescript ├── _skimmer.app ├── Contents │ ├── Info.plist │ ├── MacOS │ │ └── applet │ ├── PkgInfo │ └── Resources │ │ ├── Scripts │ │ └── main.scpt │ │ ├── applet.icns │ │ ├── applet.rsrc │ │ └── description.rtfd │ │ └── TXT.rtf ├── Icon └── Icon ├── action_copy-skimmer-url.applescript ├── action_export-notes.applescript ├── action_pdf-splitter.applescript ├── action_search-gscholar.applescript ├── 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 ├── dep_extract-data.py ├── dep_pdftotext ├── export.applescript ├── filter_debug.py ├── filter_pdf-query.py ├── helpers ├── _magic-args.py ├── _ui-helpers.applescript └── _wf-helpers.applescript ├── icon.png ├── icons ├── n_folder.png ├── n_pdf.png └── skimIcon.png ├── info.plist ├── set_highlight.applescript └── workflow ├── __init__.py └── workflow.py /README.md: -------------------------------------------------------------------------------- 1 | # Skimmer 2 | 3 | ### PDF Actions for [Skim](http://skim-app.sourceforge.net/) ### 4 | 5 | #### Version 1.3 6 | 7 | To **download**, visit the [page on Packal](http://www.packal.org/workflow/skimmer), the workflow aggregator for Alfred, where you will be able to update to the newest versions. 8 | 9 | ## Description 10 | This is a fairly simple workflow that works with the free [Mac PDF app Skim](http://skim-app.sourceforge.net/). Skim is a fantastic app with great Applescript support. This workflow provides quick, easy access to a few custom Applescripts that I've written to deal with certain pesky problems I come across when dealing with PDFs. In this initial release, there are only 2 actions: 11 | 12 | * Crop and Split PDF 13 | * Extract Data and Search Google Scholar 14 | 15 | First, `Skimmer` allows you to properly format those darned scanned PDFs. You know the ones I'm talking about, 2 books pages scanned into one, landscape-oriented PDF page. I want all of my PDFs in pretty, proper format with one PDF page corresponding to one portrait-oriented book/article page. In the past, it was quite the ordeal to crop the PDF so that the right- and left-hand margins were equal, and then to split each individual page and finally reconstruct the entire PDF. `Skimmer` makes this whole process as simple as π. You can use either a Hotkey or the Keyword `split` to activate this feature. 16 | 17 | ![split](screenshots/skimmer_split.png) 18 | 19 | `Skimmer` then does 3 things: 20 | 21 | * Crop the PDF using a user-inserted Line Annotation (if necessary) (see image below) 22 | * Split the two-page PDF into individual pages 23 | * Re-assemble everything and clean up 24 | 25 | Let me walk you thru the process. To begin, you will need to ensure that the two scanned book pages have equal margins. `Skimmer` will split the PDF page right down the middle, so we want the middle of the PDF to be the middle of the two pages. If the margins are unequal, you only need to use Skim's Line Annotation to create a border for `Skimmer`. Here's an example: 26 | 27 | ![original](screenshots/skimmer_original.png) 28 | 29 | Note the small, vertical line at the bottom of the page. `Skimmer` will crop off everything to the left of this line. You could put the line anywhere on the page. If you the right-hand margin were too big, you could put it to the right, and `Skimmer` would automatically crop the excess stuff to the right of that line. If both margins are too big, you can put two lines on each side and `Skimmer` will take care of the rest. **Note**, `Skimmer` will crop *every* page at this point, so find the farthest extremity on any page and use that as your guide. `Skimmer` can tell what page you are looking at, so it'll make things work (note that in the image above, this is one of the middle pages being used as the cropping template). `Skimmer` does not crop Top or Bottom Margins, so you will need to manually crop PDFs with wacky top and/or bottom margins. 30 | 31 | Once `Skimmer` has cropped the PDF, it will go thru and split each page into two separate pages. Depending on the length of the PDF, this can take a bit (appr. 0.33 seconds per original PDF page). This is all done invisibly tho, so that's a bonus. In order to ensure that `Skimmer` splits the PDF properly, regardless of orientation, the script will split the first page and ask you what portion of the page you are seeing (left-hand, right-hand, top-half, or bottom-half). Your choice will ensure that `Skimmer` does the splitting just so. 32 | 33 | After it splits all the pages, `Skimmer` will save a copy of your original PDF and then close it as it opens the new, split PDF. This new PDF will be properly formatted and saved in the same folder as the original PDF. Here's an example of the PDF above after it was automatically cropped and split: 34 | 35 | ![final](screenshots/skimmer_final.png) 36 | 37 | For anyone who deals with lots of scanned PDFs, I can promise you, this is a godsend. 38 | 39 | - - - 40 | 41 | The second feature will take OCR'd PDFs and try to extract relevant search information and then search Google Scholar (which will make it easy to then add citation information to your citation manager of choice. Users of [ZotQuery](http://hackademic.postach.io/zotquery-an-alfred-workflow-for-zotero) will immediately see where I'm going with this...). This feature can be activated by a user-assigned Hotkey or by the Keyword `extract` when the desired PDF is open in Skim. 42 | 43 | ![extract](screenshots/skimmer_extract.png) 44 | 45 | This feature will look for three possible things in the currently viewed page: 46 | 47 | * a [DOI](http://www.doi.org/) (Digital Object Identifier) 48 | * an ISBN (for books) 49 | * JSTOR title page 50 | 51 | If it cannot find any of these things, it will present the user with a list of Capitalized Words from the currently viewed page. You then select whichever words you want to be the Google Scholar query. Once the query is chosen (whether automatically as one of the 3 types above, or user-chosen keywords), `Skimmer` will automatically launch your default browser to Google Scholar using the query. What you do from there is up to you. 52 | 53 | - - - 54 | 55 | As I said, these are the only two functions for `Skimmer` currently, but I will be adding at least one more (for exporting notes) soon enough. If you have any killer Applescripts for Skim app, let me know and maybe we can add them in. 56 | 57 | Here's to PDF management, 58 | stephen 59 | 60 | 61 | -------------------------------------------------------------------------------- /Skimmer.alfredworkflow: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/Skimmer.alfredworkflow -------------------------------------------------------------------------------- /dev/action_copy-skimmer-url.scpt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/dev/action_copy-skimmer-url.scpt -------------------------------------------------------------------------------- /dev/action_export-notes.scpt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/dev/action_export-notes.scpt -------------------------------------------------------------------------------- /dev/action_export_notes_chunked.scpt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/dev/action_export_notes_chunked.scpt -------------------------------------------------------------------------------- /dev/action_skim_to_devon.scpt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/dev/action_skim_to_devon.scpt -------------------------------------------------------------------------------- /dev/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Appscript: -------------------------------------------------------------------------------- 1 | Versions/Current/Appscript -------------------------------------------------------------------------------- /dev/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Headers: -------------------------------------------------------------------------------- 1 | Versions/Current/Headers -------------------------------------------------------------------------------- /dev/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Resources: -------------------------------------------------------------------------------- 1 | Versions/Current/Resources -------------------------------------------------------------------------------- /dev/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Appscript: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/dev/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Appscript -------------------------------------------------------------------------------- /dev/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" -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/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); -------------------------------------------------------------------------------- /dev/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); -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/Current: -------------------------------------------------------------------------------- 1 | A -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/bin/q_json.helper/Contents/MacOS/JSON Helper: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/dev/bin/q_json.helper/Contents/MacOS/JSON Helper -------------------------------------------------------------------------------- /dev/bin/q_json.helper/Contents/PkgInfo: -------------------------------------------------------------------------------- 1 | APPLDfaB -------------------------------------------------------------------------------- /dev/bin/q_json.helper/Contents/Resources/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/dev/bin/q_json.helper/Contents/Resources/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /dev/bin/q_json.helper/Contents/Resources/English.lproj/MainMenu.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/dev/bin/q_json.helper/Contents/Resources/English.lproj/MainMenu.nib -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/bin/q_json.helper/Contents/Resources/json.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/dev/bin/q_json.helper/Contents/Resources/json.icns -------------------------------------------------------------------------------- /dev/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 | -------------------------------------------------------------------------------- /dev/bin/q_notifier.helper: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/dev/bin/q_notifier.helper -------------------------------------------------------------------------------- /dev/get_config.scpt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/dev/get_config.scpt -------------------------------------------------------------------------------- /dev/json.scpt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/dev/json.scpt -------------------------------------------------------------------------------- /dev/pdf_splitter.app/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleAllowMixedLocalizations 6 | 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | applet 11 | CFBundleIconFile 12 | applet 13 | CFBundleIdentifier 14 | com.apple.ScriptEditor.id.pdf-splitter 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | pdf_splitter 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | aplt 25 | LSMinimumSystemVersionByArchitecture 26 | 27 | x86_64 28 | 10.6 29 | 30 | LSRequiresCarbon 31 | 32 | WindowState 33 | 34 | dividerCollapsed 35 | 36 | eventLogLevel 37 | -1 38 | name 39 | ScriptWindowState 40 | positionOfDivider 41 | 333 42 | savedFrame 43 | 7 281 602 597 0 0 1440 878 44 | selectedTabView 45 | event log 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /dev/pdf_splitter.app/Contents/MacOS/applet: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/dev/pdf_splitter.app/Contents/MacOS/applet -------------------------------------------------------------------------------- /dev/pdf_splitter.app/Contents/PkgInfo: -------------------------------------------------------------------------------- 1 | APPLaplt -------------------------------------------------------------------------------- /dev/pdf_splitter.app/Contents/Resources/Scripts/main.scpt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/dev/pdf_splitter.app/Contents/Resources/Scripts/main.scpt -------------------------------------------------------------------------------- /dev/pdf_splitter.app/Contents/Resources/_ui-helpers.scpt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/dev/pdf_splitter.app/Contents/Resources/_ui-helpers.scpt -------------------------------------------------------------------------------- /dev/pdf_splitter.app/Contents/Resources/applet.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/dev/pdf_splitter.app/Contents/Resources/applet.icns -------------------------------------------------------------------------------- /dev/pdf_splitter.app/Contents/Resources/applet.rsrc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/dev/pdf_splitter.app/Contents/Resources/applet.rsrc -------------------------------------------------------------------------------- /dev/pdf_splitter.app/Contents/Resources/description.rtfd/TXT.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf210 2 | {\fonttbl} 3 | {\colortbl;\red255\green255\blue255;} 4 | } -------------------------------------------------------------------------------- /dev/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # encoding: utf-8 3 | import sys 4 | import os 5 | import subprocess 6 | from workflow import Workflow 7 | 8 | from dependencies import html2text 9 | 10 | GET_EN_DATA = """ 11 | tell application id "com.evernote.Evernote" 12 | set _sel to selection 13 | if _sel is {} then error "Please select a note." 14 | 15 | repeat with i from 1 to the count of _sel 16 | --get note title and notebook name 17 | set _title to title of item i of _sel 18 | set _notebook to name of notebook of item i of _sel 19 | 20 | --get list of tags into comma-separated string 21 | set _tags to tags of item i of _sel 22 | set tags_lst to {} 23 | repeat with j from 1 to count of _tags 24 | copy (name of item j of _tags) to the end of tags_lst 25 | end repeat 26 | set _tags to my join_list(tags_lst, ", ") 27 | 28 | --get note HTML 29 | set note_html to HTML content of item i of _sel 30 | end repeat 31 | end tell 32 | 33 | set {tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return & "||" & return} 34 | set l to {_title, _notebook, _tags, note_html} as string 35 | set AppleScript's text item delimiters to tid 36 | return l 37 | 38 | to join_list(aList, delimiter) 39 | set retVal to "" 40 | set prevDelimiter to AppleScript's text item delimiters 41 | set AppleScript's text item delimiters to delimiter 42 | set retVal to aList as string 43 | set AppleScript's text item delimiters to prevDelimiter 44 | return retVal 45 | end join_list 46 | """ 47 | 48 | def _unify(obj, encoding='utf-8'): 49 | """Ensure passed text is Unicode""" 50 | if isinstance(obj, basestring): 51 | if not isinstance(obj, unicode): 52 | obj = unicode(obj, encoding) 53 | return obj 54 | 55 | ################################################## 56 | ### AppleScript Functions 57 | ################################################## 58 | 59 | def _applescriptify_str(text): 60 | """Replace double quotes in text for Applescript string""" 61 | text = _unify(text) 62 | return text.replace('"', '" & quote & "') 63 | 64 | def _applescriptify_list(_list): 65 | """Convert Python list to Applescript list""" 66 | quoted_list = [] 67 | for item in _list: 68 | if type(item) is unicode: # unicode string to AS string 69 | _new = '"' + item + '"' 70 | quoted_list.append(_new) 71 | elif type(item) is str: # string to AS string 72 | _new = '"' + item + '"' 73 | quoted_list.append(_new) 74 | elif type(item) is int: # int to AS number 75 | _new = str(item) 76 | quoted_list.append(_new) 77 | elif type(item) is bool: # bool to AS Boolean 78 | _new = str(item).lower() 79 | quoted_list.append(_new) 80 | quoted_str = ', '.join(quoted_list) 81 | return '{' + quoted_str + '}' 82 | 83 | def as_run(ascript): 84 | """Run the given AppleScript and return the standard output and error.""" 85 | ascript = _unify(ascript) 86 | osa = subprocess.Popen(['osascript', '-'], 87 | stdin=subprocess.PIPE, 88 | stdout=subprocess.PIPE) 89 | return osa.communicate(ascript.encode('utf-8'))[0].strip() 90 | 91 | def main(wf): 92 | """""" 93 | en_data = as_run(GET_EN_DATA) 94 | (en_title, en_notebook, en_tags, en_html) = en_data.split('\r||\r') 95 | print html2text.html2text(en_html) 96 | 97 | 98 | 99 | if __name__ == '__main__': 100 | wf = Workflow() 101 | sys.exit(wf.run(main)) 102 | -------------------------------------------------------------------------------- /dev/test.scpt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/dev/test.scpt -------------------------------------------------------------------------------- /dev/testing.scpt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/dev/testing.scpt -------------------------------------------------------------------------------- /screenshots/skimmer_extract.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/screenshots/skimmer_extract.png -------------------------------------------------------------------------------- /screenshots/skimmer_final.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/screenshots/skimmer_final.png -------------------------------------------------------------------------------- /screenshots/skimmer_original.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/screenshots/skimmer_original.png -------------------------------------------------------------------------------- /screenshots/skimmer_split.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/screenshots/skimmer_split.png -------------------------------------------------------------------------------- /source/_config.applescript: -------------------------------------------------------------------------------- 1 | on run 2 | --get path to workflow root folder 3 | set {tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ":"} 4 | set base_path to (((text items 1 thru -2 of ((path to me) as string)) as string) & ":") as string 5 | set AppleScript's text item delimiters to tid 6 | 7 | --load UI and Workflow helper scripts 8 | set ui to load script ((base_path & "_ui-helpers.scpt") as alias) 9 | set wf to load script ((base_path & "_wf-helpers.scpt") as alias) 10 | 11 | -- Ensure storage and cache folders are created 12 | wf's init_paths() 13 | 14 | set _icon to base_path & "icon.png" 15 | 16 | set _bundle to wf's get_bundle() 17 | set settings_path to (path to "cusr" as text) & "Library:Application Support:Alfred 2:Workflow Data:" & _bundle & ":settings.json" as text 18 | 19 | try 20 | --- try to open the file and read it 21 | set the file_ to open for access file settings_path 22 | set json_ to (read file_) 23 | close access file_ 24 | 25 | set rec to wf's read_json(json_, {"style", "destination"}) 26 | set export_style to rec's _style 27 | set export_destination to rec's _destination 28 | on error 29 | set export_style to "Markdown" 30 | set export_destination to "Clipboard" 31 | end try 32 | 33 | -- Get user preferences 34 | set style_dialog to (ui's display_dialog({z_text:"Export notes as Markdown or HTML?", z_buttons:{"Markdown", "HTML", "Cancel"}, z_ok:export_style, z_cancel:"Cancel", z_title:"Skimmer", z_icon:_icon})) 35 | try 36 | set export_style to button returned of style_dialog 37 | on error msg 38 | return msg 39 | end try 40 | 41 | set dest_dialog to (ui's display_dialog({z_text:"Send exported notes to Evernote or copy to Clipboard?", z_buttons:{"Evernote", "Clipboard", "Cancel"}, z_ok:export_destination, z_cancel:"Cancel", z_title:"Skimmer", z_icon:_icon})) 42 | try 43 | set export_destination to button returned of dest_dialog 44 | on error msg 45 | return msg 46 | end try 47 | 48 | -- Prepare JSON 49 | set json to "{" & return & tab & "\"style\": \"" & export_style & "\"," & return & tab & "\"destination\": \"" & export_destination & "\"" & return & "}" 50 | 51 | try 52 | -- Write the data to the settings file 53 | set the file_ to open for access file settings_path with write permission 54 | set eof of file_ to 0 55 | write json to file_ 56 | close access the file_ 57 | return "Configuration Success!" 58 | on error msg 59 | return "Failed... " & msg 60 | end try 61 | end run -------------------------------------------------------------------------------- /source/_skimmer.app/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleAllowMixedLocalizations 6 | 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | applet 11 | CFBundleIconFile 12 | applet 13 | CFBundleIdentifier 14 | com.hackademic.AppleScript.URL_Handler 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | Skimmer 19 | CFBundlePackageType 20 | APPL 21 | CFBundleSignature 22 | aplt 23 | CFBundleURLTypes 24 | 25 | 26 | CFBundleURLName 27 | Skimmer 28 | CFBundleURLSchemes 29 | 30 | skimmer 31 | 32 | 33 | 34 | LSRequiresCarbon 35 | 36 | WindowState 37 | 38 | dividerCollapsed 39 | 40 | eventLogLevel 41 | -1 42 | name 43 | ScriptWindowState 44 | positionOfDivider 45 | 0.0 46 | savedFrame 47 | 4 56 503 822 0 0 1440 878 48 | selectedTabView 49 | event log 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /source/_skimmer.app/Contents/MacOS/applet: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/source/_skimmer.app/Contents/MacOS/applet -------------------------------------------------------------------------------- /source/_skimmer.app/Contents/PkgInfo: -------------------------------------------------------------------------------- 1 | APPLaplt -------------------------------------------------------------------------------- /source/_skimmer.app/Contents/Resources/Scripts/main.scpt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/source/_skimmer.app/Contents/Resources/Scripts/main.scpt -------------------------------------------------------------------------------- /source/_skimmer.app/Contents/Resources/applet.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/source/_skimmer.app/Contents/Resources/applet.icns -------------------------------------------------------------------------------- /source/_skimmer.app/Contents/Resources/applet.rsrc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/source/_skimmer.app/Contents/Resources/applet.rsrc -------------------------------------------------------------------------------- /source/_skimmer.app/Contents/Resources/description.rtfd/TXT.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf390 2 | {\fonttbl} 3 | {\colortbl;\red255\green255\blue255;} 4 | } -------------------------------------------------------------------------------- /source/_skimmer.app/Icon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/source/_skimmer.app/Icon -------------------------------------------------------------------------------- /source/_skimmer.app/Icon : -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/source/_skimmer.app/Icon -------------------------------------------------------------------------------- /source/action_copy-skimmer-url.applescript: -------------------------------------------------------------------------------- 1 | on run 2 | tell application "Skim" 3 | set pdf_name to name of front document 4 | set _file to (path of front document) 5 | set file_url to my encode_text(_file, false, false) 6 | set _page to index of current page of document 1 7 | set skimmer_url to "skimmer://" & file_url & "?page=" & _page 8 | set the clipboard to skimmer_url 9 | end tell 10 | return pdf_name 11 | end run 12 | 13 | --URL encode text 14 | on encode_text(this_text, encode_URL_A, encode_URL_B) 15 | set the standard_characters to "abcdefghijklmnopqrstuvwxyz0123456789" 16 | set the URL_A_chars to "$+!'/?;&@=#%><{}[]\"~`^\\|*" 17 | set the URL_B_chars to ".-_:" 18 | set the acceptable_characters to the standard_characters 19 | if encode_URL_A is false then set the acceptable_characters to the acceptable_characters & the URL_A_chars 20 | if encode_URL_B is false then set the acceptable_characters to the acceptable_characters & the URL_B_chars 21 | set the encoded_text to "" 22 | repeat with this_char in this_text 23 | if this_char is in the acceptable_characters then 24 | set the encoded_text to (the encoded_text & this_char) 25 | else 26 | set the encoded_text to (the encoded_text & encode_char(this_char)) as string 27 | end if 28 | end repeat 29 | return the encoded_text 30 | end encode_text 31 | 32 | on encode_char(this_char) 33 | set the ASCII_num to (the ASCII number this_char) 34 | set the hex_list to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"} 35 | set x to item ((ASCII_num div 16) + 1) of the hex_list 36 | set y to item ((ASCII_num mod 16) + 1) of the hex_list 37 | return ("%" & x & y) as string 38 | end encode_char 39 | -------------------------------------------------------------------------------- /source/action_search-gscholar.applescript: -------------------------------------------------------------------------------- 1 | --get path to workflow root folder 2 | set {tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ":"} 3 | set base_path to (((text items 1 thru -2 of ((path to me) as string)) as string) & ":") as string 4 | set AppleScript's text item delimiters to tid 5 | 6 | --load UI and Workflow helper scripts 7 | set ui to load script ((base_path & "_ui-helpers.scpt") as alias) 8 | 9 | tell application "Skim" 10 | set _path to path of front document 11 | set _page to index of current page of front document 12 | 13 | set python_path to (POSIX path of base_path) & "dep_extract-data.py" 14 | set pdf2text_path to (POSIX path of base_path) & "dep_pdftotext" 15 | 16 | set input to _path & "zzz" & (_page as string) & "zzz" & pdf2text_path 17 | 18 | set python_path to quoted form of python_path 19 | set command to "python " & python_path & " " & quoted form of input 20 | set command to command as «class utf8» 21 | set _res to do shell script command 22 | 23 | if not _res = "[]" then 24 | if _res contains "[" and _res contains "]" then 25 | set {tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, {"[", "]", "'", ","}} 26 | set l to text items of _res 27 | set AppleScript's text item delimiters to tid 28 | set final to {} 29 | repeat with i from 1 to count of l 30 | if not item i of l = "" then 31 | if not item i of l = " " then 32 | copy item i of l to end of final 33 | end if 34 | end if 35 | end repeat 36 | set query_list to ui's choose_from_list({z_list:final, z_title:"Skim Splitter", z_prompt:"Choose keywords to search", z_def:1, z_multiple:true}) 37 | set {tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, " "} 38 | set _res to query_list as string 39 | set AppleScript's text item delimiters to tid 40 | end if 41 | 42 | --encode query 43 | set query to my encode_text(_res, true, true) 44 | 45 | set base_url to "http://scholar.google.com/scholar?hl=en&q=" & query 46 | tell application id "sevs" to open location base_url 47 | 48 | else 49 | set _icon to base_path & "icon.png" 50 | ui's display_dialog({z_text:"PDF isn't OCR'd. So Skimer cannot extract data.", z_title:"Skim Splitter", z_icon:_icon}) 51 | end if 52 | end tell 53 | 54 | (* HANDLERS *) 55 | 56 | on encode_text(this_text, encode_URL_A, encode_URL_B) 57 | set the standard_characters to "abcdefghijklmnopqrstuvwxyz0123456789" 58 | set the URL_A_chars to "$+!'/?;&@=#%><{}[]\"~`^\\|*" 59 | set the URL_B_chars to ".-_:" 60 | set the acceptable_characters to the standard_characters 61 | if encode_URL_A is false then set the acceptable_characters to the acceptable_characters & the URL_A_chars 62 | if encode_URL_B is false then set the acceptable_characters to the acceptable_characters & the URL_B_chars 63 | set the encoded_text to "" 64 | repeat with this_char in this_text 65 | if this_char is in the acceptable_characters then 66 | set the encoded_text to (the encoded_text & this_char) 67 | else 68 | set the encoded_text to (the encoded_text & encode_char(this_char)) as string 69 | end if 70 | end repeat 71 | return the encoded_text 72 | end encode_text 73 | 74 | on encode_char(this_char) 75 | set the ASCII_num to (the ASCII number this_char) 76 | set the hex_list to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"} 77 | set x to item ((ASCII_num div 16) + 1) of the hex_list 78 | set y to item ((ASCII_num mod 16) + 1) of the hex_list 79 | return ("%" & x & y) as string 80 | end encode_char -------------------------------------------------------------------------------- /source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Appscript: -------------------------------------------------------------------------------- 1 | Versions/Current/Appscript -------------------------------------------------------------------------------- /source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Headers: -------------------------------------------------------------------------------- 1 | Versions/Current/Headers -------------------------------------------------------------------------------- /source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Resources: -------------------------------------------------------------------------------- 1 | Versions/Current/Resources -------------------------------------------------------------------------------- /source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Appscript: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/A/Appscript -------------------------------------------------------------------------------- /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" -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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); -------------------------------------------------------------------------------- /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); -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /source/bin/q_json.helper/Contents/Frameworks/Appscript.framework/Versions/Current: -------------------------------------------------------------------------------- 1 | A -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /source/bin/q_json.helper/Contents/MacOS/JSON Helper: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/source/bin/q_json.helper/Contents/MacOS/JSON Helper -------------------------------------------------------------------------------- /source/bin/q_json.helper/Contents/PkgInfo: -------------------------------------------------------------------------------- 1 | APPLDfaB -------------------------------------------------------------------------------- /source/bin/q_json.helper/Contents/Resources/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/source/bin/q_json.helper/Contents/Resources/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /source/bin/q_json.helper/Contents/Resources/English.lproj/MainMenu.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/source/bin/q_json.helper/Contents/Resources/English.lproj/MainMenu.nib -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /source/bin/q_json.helper/Contents/Resources/json.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/source/bin/q_json.helper/Contents/Resources/json.icns -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /source/bin/q_notifier.helper: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/source/bin/q_notifier.helper -------------------------------------------------------------------------------- /source/dep_extract-data.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | import subprocess 4 | import re 5 | import sys 6 | 7 | """ 8 | This script extracts relevant metadata from PDF 9 | """ 10 | 11 | # Get user input 12 | _input = sys.argv[1].split(u'zzz') 13 | #_input = "/Users/smargheim/Documents/PDFs/Zotero/griffiths_1999_how epistemology matters to theology_journal article.pdfzzz3zzz/Users/smargheim/Desktop/test.scptd/Contents/Resources/pdftotext".split('zzz') 14 | pdf_path = _input[0] 15 | pdf_page = _input[1] 16 | _path = _input[2] 17 | 18 | # Extract text of PDF page 19 | pdf_txt = subprocess.Popen([_path, "-q", "-f", str(pdf_page), "-l", str(pdf_page), pdf_path, "-"], stdout=subprocess.PIPE).communicate()[0] 20 | 21 | def get_doi(pdf_txt): 22 | # DOI regex 23 | # (http://stackoverflow.com/questions/27910/finding-a-doi-in-a-document-or-page) 24 | doi_re = re.compile(r'\b(10[.][0-9]{4,}(?:[.][0-9]+)*/(?:(?!["&\'<>])\S)+)\b') 25 | # try to get DOI 26 | doi = re.search(doi_re, pdf_txt) 27 | if doi != None: 28 | return doi.group(1).strip() 29 | else: 30 | return None 31 | 32 | def get_isbn(pdf_txt): 33 | # ISBN regex 34 | isbn_re = re.compile(r"ISBN((-1(?:(0)|3))?:?\x20(\s)*[0-9]+[- ][0-9]+[- ][0-9]+[- ][0-9]*[- ]*[xX0-9])") 35 | # try to get ISBN 36 | isbn = re.search(isbn_re, pdf_txt) 37 | if isbn != None: 38 | return isbn.group(1).strip() 39 | else: 40 | return None 41 | 42 | # Use this to have user select keywords 43 | def cap2keywords(pdf_txt): 44 | cap_words = re.findall(r"\b[A-Z].*?\b", pdf_txt, re.M) 45 | cap_words = list(set(cap_words)) 46 | poss_search_terms = [x for x in cap_words if len(x) >= 4] 47 | return poss_search_terms 48 | 49 | 50 | # First, check if title page of JSTOR pdf 51 | if 'JSTOR' in pdf_txt: 52 | jstor_regex = re.compile("^(.*?)Author\\(s\\):\\s(.*?)Source:\\s(.*?)Published by:\\s(.*?)Stable URL:\\s(.*?)Accessed:\\s(.*?)(?:\\n|\\r)", re.S) 53 | res = re.search(jstor_regex, pdf_txt) 54 | 55 | if res != None: 56 | try: 57 | title = re.search(r"^(.*?)(?=Author)", pdf_txt).group(1).strip() 58 | except: 59 | title = u'missing value' 60 | try: 61 | creator = re.search(r"Author\(s\):\s(.*?)(?=Reviewed|Source)", pdf_txt).group(1).strip() 62 | except: 63 | creator = u'missing value' 64 | 65 | final_res = title + u' ' + creator 66 | 67 | # If no JSTOR data 68 | else: 69 | # try DOI 70 | final_res = get_doi(pdf_txt) 71 | if final_res == None: 72 | # try ISBN 73 | final_res = get_isbn(pdf_txt) 74 | if final_res == None: 75 | final_res = cap2keywords(pdf_txt) 76 | 77 | # If no JSTOR on page 78 | else: 79 | # try DOI 80 | final_res = get_doi(pdf_txt) 81 | 82 | if final_res == None: 83 | # try ISBN 84 | final_res = get_isbn(pdf_txt) 85 | if final_res == None: 86 | final_res = cap2keywords(pdf_txt) 87 | 88 | print final_res 89 | -------------------------------------------------------------------------------- /source/dep_pdftotext: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/source/dep_pdftotext -------------------------------------------------------------------------------- /source/filter_debug.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # encoding: utf-8 3 | import sys 4 | import os.path 5 | from workflow import Workflow 6 | 7 | def main(wf): 8 | wf.add_item(u"Root", u"Open Skimmer's Root Folder?", valid=True, arg='workflow:openworkflow', icon='icons/n_folder.png') 9 | wf.add_item(u"Storage", u"Open Skimmer's Storage Folder?", valid=True, arg='workflow:opendata', icon='icons/n_folder.png') 10 | wf.add_item(u"Cache", u"Open Skimmer's Cache Folder?", valid=True, arg='workflow:opencache', icon='icons/n_folder.png') 11 | wf.add_item(u"Logs", u"Open Skimmer's Logs?", valid=True, arg='workflow:openlog', icon='icons/n_folder.png') 12 | wf.add_item(u"Info", u"Info for Skimmer's Cache?", valid=True, arg='workflow:infocache', icon='icons/n_folder.png') 13 | 14 | wf.send_feedback() 15 | 16 | if __name__ == '__main__': 17 | wf = Workflow() 18 | sys.exit(wf.run(main)) 19 | -------------------------------------------------------------------------------- /source/filter_pdf-query.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # encoding: utf-8 3 | import sys 4 | from workflow import Workflow 5 | 6 | def main(wf): 7 | import subprocess 8 | 9 | query = wf.args[0] 10 | #query = 'galen' 11 | 12 | pdf_query = """mdfind "(kMDItemKind == 'PDF') && (kMDItemTitle == '*{0}*'c)" 13 | """.format(query) 14 | output = subprocess.check_output(pdf_query, shell=True) 15 | 16 | returnList = output.split("\n") 17 | if returnList[-1] == "": 18 | returnList = returnList[:-1] 19 | 20 | for item in returnList: 21 | title = item.split("/")[-1] 22 | sub = "/".join(item.split("/")[:-1]) 23 | wf.add_item(title, sub, 24 | arg=item, 25 | valid=True, 26 | type='file', 27 | icon='icons/n_pdf.png') 28 | 29 | wf.send_feedback() 30 | 31 | if __name__ == '__main__': 32 | wf = Workflow() 33 | sys.exit(wf.run(main)) -------------------------------------------------------------------------------- /source/helpers/_magic-args.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # encoding: utf-8 3 | import sys 4 | import os.path 5 | from workflow import Workflow 6 | 7 | def main(wf): 8 | args = wf.args 9 | 10 | if __name__ == '__main__': 11 | wf = Workflow() 12 | sys.exit(wf.run(main)) -------------------------------------------------------------------------------- /source/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/source/icon.png -------------------------------------------------------------------------------- /source/icons/n_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/source/icons/n_folder.png -------------------------------------------------------------------------------- /source/icons/n_pdf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/source/icons/n_pdf.png -------------------------------------------------------------------------------- /source/icons/skimIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fractaledmind/alfred_skimmer/3a5cc106bec490c64b674e8b580fcdd9fd22ea1c/source/icons/skimIcon.png -------------------------------------------------------------------------------- /source/set_highlight.applescript: -------------------------------------------------------------------------------- 1 | on run 2 | --load Workflow helper scripts 3 | set wf to load script ((get_path() & "_wf-helpers.scpt") as alias) 4 | 5 | -- Ensure storage and cache folders are created 6 | wf's init_paths() 7 | 8 | set annotations_path to wf's get_storage() & "annotations_config.json" 9 | 10 | --Prepare dictionaries for each possible highlight color 11 | set one to {} 12 | set two to {} 13 | set three to {} 14 | set four to {} 15 | set five to {} 16 | set six to {} 17 | 18 | tell application "Skim" 19 | set all_notes to every note of page 2 of front document 20 | 21 | repeat with i from 1 to count of all_notes 22 | set _note to item i of all_notes 23 | 24 | if type of _note is text note then 25 | set note_text to text of _note 26 | set note_title to (text items 4 thru -1 of note_text) as string 27 | 28 | --Save each highlight title 29 | if (text of _note) contains "1." then 30 | set end of one to "_title:" & "\"" & note_title & "\"" 31 | else if (text of _note) contains "2." then 32 | set end of two to "_title:" & "\"" & note_title & "\"" 33 | else if (text of _note) contains "3." then 34 | set end of three to "_title:" & "\"" & note_title & "\"" 35 | else if (text of _note) contains "4." then 36 | set end of four to "_title:" & "\"" & note_title & "\"" 37 | else if (text of _note) contains "5." then 38 | set end of five to "_title:" & "\"" & note_title & "\"" 39 | else if (text of _note) contains "6." then 40 | set end of six to "_title:" & "\"" & note_title & "\"" 41 | end if 42 | 43 | else if type of _note is highlight note then 44 | set rgba to color of _note 45 | set colour to wf's as_string(rgba) 46 | 47 | --Save each highlight color 48 | if (text of _note) contains "One" then 49 | set end of one to "_color:" & colour 50 | else if (text of _note) contains "Two" then 51 | set end of two to "_color:" & colour 52 | else if (text of _note) contains "Three" then 53 | set end of three to "_color:" & colour 54 | else if (text of _note) contains "Four" then 55 | set end of four to "_color:" & colour 56 | else if (text of _note) contains "Five" then 57 | set end of five to "_color:" & colour 58 | else if (text of _note) contains "Six" then 59 | set end of six to "_color:" & colour 60 | end if 61 | 62 | end if 63 | end repeat 64 | end tell 65 | 66 | set one to "{" & my implode(", ", one) & "}" 67 | set two to "{" & my implode(", ", two) & "}" 68 | set three to "{" & my implode(", ", three) & "}" 69 | set four to "{" & my implode(", ", four) & "}" 70 | set five to "{" & my implode(", ", five) & "}" 71 | set six to "{" & my implode(", ", six) & "}" 72 | 73 | set {one_rec, two_rec, three_rec, four_rec, five_rec, six_rec} to {(run script one), (run script two), (run script three), (run script four), (run script five), (run script six)} 74 | --Group dicts into one list 75 | set json_list to {one_rec, two_rec, three_rec, four_rec, five_rec, six_rec} 76 | 77 | --Create JSON string 78 | set json to wf's make_json(json_list) 79 | 80 | --Write JSON to file 81 | set annotations_file to (POSIX file annotations_path) as string 82 | write_to_file(json, annotations_file, false) 83 | return "true" 84 | end run 85 | 86 | (* HANDLERS *) 87 | 88 | on write_to_file(this_data, target_file, append_data) 89 | try 90 | set the target_file to the target_file as string 91 | set the open_target_file to open for access file target_file with write permission 92 | if append_data is false then set eof of the open_target_file to 0 93 | write this_data to the open_target_file starting at eof 94 | close access the open_target_file 95 | return true 96 | on error msg 97 | try 98 | close access file target_file 99 | end try 100 | return msg 101 | end try 102 | end write_to_file 103 | 104 | on get_path() 105 | set {tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ":"} 106 | set base_path to (((text items 1 thru -2 of ((path to me) as string)) as string) & ":") as string 107 | set AppleScript's text item delimiters to tid 108 | return base_path 109 | end get_path 110 | 111 | on implode(delimiter, pieces) 112 | local delimiter, pieces, ASTID 113 | set ASTID to AppleScript's text item delimiters 114 | try 115 | set AppleScript's text item delimiters to delimiter 116 | set pieces to "" & pieces 117 | set AppleScript's text item delimiters to ASTID 118 | return pieces --> text 119 | on error eMsg number eNum 120 | set AppleScript's text item delimiters to ASTID 121 | error "Can't implode: " & eMsg number eNum 122 | end try 123 | end implode -------------------------------------------------------------------------------- /source/workflow/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | # 4 | # Copyright (c) 2014 Dean Jackson 5 | # 6 | # MIT Licence. See http://opensource.org/licenses/MIT 7 | # 8 | # Created on 2014-02-15 9 | # 10 | 11 | """ 12 | A Python helper library for `Alfred 2 `_ Workflow 13 | authors. 14 | 15 | Alfred Workflows typically take user input, fetch data from the Web or 16 | elsewhere, filter them and display results to the user. **Alfred-Workflow** 17 | helps you do these things. 18 | 19 | There are convenience methods for: 20 | 21 | - Parsing script arguments. 22 | - Text decoding/normalisation. 23 | - Storing data and settings. 24 | - Caching data from, e.g., web services with a simple API for updating expired 25 | data. 26 | - Securely storing (and syncing) passwords using OS X Keychain. 27 | - Generating XML output for Alfred. 28 | - Including external libraries (adding directories to ``sys.path``). 29 | - Filtering results using an Alfred-like, fuzzy search algorithm. 30 | - Generating log output for debugging. 31 | - Running background processes to keep your workflow responsive. 32 | - Capturing errors, so the workflow doesn't fail silently. 33 | 34 | Quick Example 35 | ============= 36 | 37 | Here's how to show recent `Pinboard.in `_ posts in Alfred. 38 | 39 | Create a new Workflow in Alfred's preferences. Add a **Script Filter** with 40 | Language ``/usr/bin/python`` and paste the following into the **Script** field 41 | (changing ``API_KEY``): 42 | 43 | .. code-block:: python 44 | :emphasize-lines: 4 45 | 46 | import sys 47 | from workflow import Workflow, ICON_WEB, web 48 | 49 | API_KEY = 'your-pinboard-api-key' 50 | 51 | def main(wf): 52 | url = 'https://api.pinboard.in/v1/posts/recent' 53 | params = dict(auth_token=API_KEY, count=20, format='json') 54 | r = web.get(url, params) 55 | r.raise_for_status() 56 | for post in r.json()['posts']: 57 | wf.add_item(post['description'], post['href'], arg=post['href'], 58 | uid=post['hash'], valid=True, icon=ICON_WEB) 59 | wf.send_feedback() 60 | 61 | 62 | if __name__ == u"__main__": 63 | wf = Workflow() 64 | sys.exit(wf.run(main)) 65 | 66 | 67 | Add an **Open URL** action to your Workflow with ``{query}`` as the **URL**, 68 | connect your **Script Filter** to it, and you can now hit **ENTER** on a 69 | Pinboard item in Alfred to open it in your browser. 70 | 71 | Installation 72 | ============ 73 | 74 | With pip 75 | -------- 76 | 77 | You can install **Alfred-Workflow** directly into your workflow with:: 78 | 79 | pip install --target=/path/to/my/workflow Alfred-Workflow 80 | 81 | 82 | **Note**: If you intend to distribute your workflow to other users, you should 83 | include **Alfred-Workflow** (and other Python libraries your workflow requires) 84 | within your workflow as described. Do not ask users to install anything into 85 | their system Python. 86 | 87 | From source 88 | ----------- 89 | 90 | Download the ``alfred-workflow-X.X.zip`` file from the 91 | `GitHub releases page `_ 92 | and either extract the ZIP to the root directory of your workflow (where 93 | ``info.plist`` is) or place the ZIP in the root directory and add 94 | ``sys.path.insert(0, 'alfred-workflow-X.X.zip')`` to the top of your 95 | Python scripts. 96 | 97 | Alternatively, you can download 98 | `the source code `_ 99 | from the `GitHub repository `_ and 100 | copy the ``workflow`` subfolder to the root directory of your Workflow. 101 | 102 | Your Workflow directory should look something like this (where 103 | ``yourscript.py`` contains your Workflow code and ``info.plist`` is 104 | the Workflow information file generated by Alfred):: 105 | 106 | Your Workflow/ 107 | info.plist 108 | icon.png 109 | workflow/ 110 | __init__.py 111 | background.py 112 | workflow.py 113 | web.py 114 | yourscript.py 115 | etc. 116 | 117 | 118 | Or like this:: 119 | 120 | Your Workflow/ 121 | info.plist 122 | icon.png 123 | workflow-1.X.X.zip 124 | yourscript.py 125 | etc. 126 | 127 | 128 | """ 129 | 130 | __version__ = '1.8.5' 131 | 132 | 133 | from .workflow import Workflow, PasswordNotFound, KeychainError 134 | from .workflow import (ICON_ERROR, ICON_WARNING, ICON_NOTE, ICON_INFO, 135 | ICON_FAVORITE, ICON_FAVOURITE, ICON_USER, ICON_GROUP, 136 | ICON_HELP, ICON_NETWORK, ICON_WEB, ICON_COLOR, 137 | ICON_COLOUR, ICON_SYNC, ICON_SETTINGS, ICON_TRASH, 138 | ICON_MUSIC, ICON_BURN, ICON_ACCOUNT, ICON_ERROR) 139 | from .workflow import (MATCH_ALL, MATCH_ALLCHARS, MATCH_ATOM, 140 | MATCH_CAPITALS, MATCH_INITIALS, 141 | MATCH_INITIALS_CONTAIN, MATCH_INITIALS_STARTSWITH, 142 | MATCH_STARTSWITH, MATCH_SUBSTRING) --------------------------------------------------------------------------------