From c6a0ebe551752a9011dc043c925ffb7484e7c5db Mon Sep 17 00:00:00 2001 From: Michael Bianco Date: Sat, 29 Oct 2022 09:49:06 -0600 Subject: [PATCH 1/2] Adding python config via asdf --- .tool-versions | 1 + requirements.txt | 1 + 2 files changed, 2 insertions(+) create mode 100644 .tool-versions create mode 100644 requirements.txt diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..95e5e2f --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +python 2.7.18 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e671fa2 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +clang From 85d16ca61718e1c3fabebe0fcf0d738c80a2d8e1 Mon Sep 17 00:00:00 2001 From: Michael Bianco Date: Sat, 29 Oct 2022 09:49:18 -0600 Subject: [PATCH 2/2] Adding google chrome definitions --- .../GoogleChromeScripting/Google Chrome.h | 129 +++++++ .../GoogleChromeScripting/Google Chrome.sdef | 344 ++++++++++++++++++ .../GoogleChromeScripting/Google Chrome.swift | 111 ++++++ 3 files changed, 584 insertions(+) create mode 100644 Frameworks/GoogleChromeScripting/GoogleChromeScripting/Google Chrome.h create mode 100644 Frameworks/GoogleChromeScripting/GoogleChromeScripting/Google Chrome.sdef create mode 100644 Frameworks/GoogleChromeScripting/GoogleChromeScripting/Google Chrome.swift diff --git a/Frameworks/GoogleChromeScripting/GoogleChromeScripting/Google Chrome.h b/Frameworks/GoogleChromeScripting/GoogleChromeScripting/Google Chrome.h new file mode 100644 index 0000000..e56d11d --- /dev/null +++ b/Frameworks/GoogleChromeScripting/GoogleChromeScripting/Google Chrome.h @@ -0,0 +1,129 @@ +/* + * Google Chrome.h + */ + +#import +#import + + +@class GoogleChromeApplication, GoogleChromeWindow, GoogleChromeTab, GoogleChromeBookmarkFolder, GoogleChromeBookmarkItem; + +@protocol Google ChromeGenericMethods + +- (void) saveIn:(NSURL *)in_ as:(NSString *)as; // Save an object. +- (void) close; // Close a window. +- (void) delete; // Delete an object. +- (SBObject *) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties; // Copy object(s) and put the copies at a new location. +- (SBObject *) moveTo:(SBObject *)to; // Move object(s) to a new location. +- (void) print; // Print an object. +- (void) reload; // Reload a tab. +- (void) goBack; // Go Back (If Possible). +- (void) goForward; // Go Forward (If Possible). +- (void) selectAll; // Select all. +- (void) cutSelection; // Cut selected text (If Possible). +- (void) copySelection NS_RETURNS_NOT_RETAINED; // Copy text. +- (void) pasteSelection; // Paste text (If Possible). +- (void) undo; // Undo the last change. +- (void) redo; // Redo the last change. +- (void) stop; // Stop the current tab from loading. +- (void) viewSource; // View the HTML source of the tab. +- (id) executeJavascript:(NSString *)javascript; // Execute a piece of javascript. + +@end + + + +/* + * Standard Suite + */ + +// The application's top-level scripting object. +@interface GoogleChromeApplication : SBApplication + +- (SBElementArray *) windows; + +@property (copy, readonly) NSString *name; // The name of the application. +@property (readonly) BOOL frontmost; // Is this the frontmost (active) application? +@property (copy, readonly) NSString *version; // The version of the application. + +- (void) open:(NSArray *)x; // Open a document. +- (void) quit; // Quit the application. +- (BOOL) exists:(id)x; // Verify if an object exists. + +@end + +// A window. +@interface GoogleChromeWindow : SBObject + +- (SBElementArray *) tabs; + +@property (copy) NSString *givenName; // The given name of the window. +@property (copy, readonly) NSString *name; // The full title of the window. +- (NSInteger) id; // The unique identifier of the window. +@property NSInteger index; // The index of the window, ordered front to back. +@property NSRect bounds; // The bounding rectangle of the window. +@property (readonly) BOOL closeable; // Whether the window has a close box. +@property (readonly) BOOL minimizable; // Whether the window can be minimized. +@property BOOL minimized; // Whether the window is currently minimized. +@property (readonly) BOOL resizable; // Whether the window can be resized. +@property BOOL visible; // Whether the window is currently visible. +@property (readonly) BOOL zoomable; // Whether the window can be zoomed. +@property BOOL zoomed; // Whether the window is currently zoomed. +@property (copy, readonly) GoogleChromeTab *activeTab; // Returns the currently selected tab +@property (copy) NSString *mode; // Represents the mode of the window which can be 'normal' or 'incognito', can be set only once during creation of the window. +@property NSInteger activeTabIndex; // The index of the active tab. + + +@end + + + +/* + * Chromium Suite + */ + +// The application's top-level scripting object. +@interface GoogleChromeApplication (ChromiumSuite) + +- (SBElementArray *) bookmarkFolders; + +@property (copy, readonly) GoogleChromeBookmarkFolder *bookmarksBar; // The bookmarks bar bookmark folder. +@property (copy, readonly) GoogleChromeBookmarkFolder *otherBookmarks; // The other bookmarks bookmark folder. + +@end + +// A tab. +@interface GoogleChromeTab : SBObject + +- (NSInteger) id; // Unique ID of the tab. +@property (copy, readonly) NSString *title; // The title of the tab. +@property (copy) NSString *URL; // The url visible to the user. +@property (readonly) BOOL loading; // Is loading? + + +@end + +// A bookmarks folder that contains other bookmarks folder and bookmark items. +@interface GoogleChromeBookmarkFolder : SBObject + +- (SBElementArray *) bookmarkFolders; +- (SBElementArray *) bookmarkItems; + +- (NSNumber *) id; // Unique ID of the bookmark folder. +@property (copy) NSString *title; // The title of the folder. +@property (copy, readonly) NSNumber *index; // Returns the index with respect to its parent bookmark folder. + + +@end + +// An item consists of an URL and the title of a bookmark +@interface GoogleChromeBookmarkItem : SBObject + +- (NSInteger) id; // Unique ID of the bookmark item. +@property (copy) NSString *title; // The title of the bookmark item. +@property (copy) NSString *URL; // The URL of the bookmark. +@property (copy, readonly) NSNumber *index; // Returns the index with respect to its parent bookmark folder. + + +@end + diff --git a/Frameworks/GoogleChromeScripting/GoogleChromeScripting/Google Chrome.sdef b/Frameworks/GoogleChromeScripting/GoogleChromeScripting/Google Chrome.sdef new file mode 100644 index 0000000..5a9e19e --- /dev/null +++ b/Frameworks/GoogleChromeScripting/GoogleChromeScripting/Google Chrome.sdef @@ -0,0 +1,344 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Frameworks/GoogleChromeScripting/GoogleChromeScripting/Google Chrome.swift b/Frameworks/GoogleChromeScripting/GoogleChromeScripting/Google Chrome.swift new file mode 100644 index 0000000..3270041 --- /dev/null +++ b/Frameworks/GoogleChromeScripting/GoogleChromeScripting/Google Chrome.swift @@ -0,0 +1,111 @@ +import AppKit +import ScriptingBridge + +@objc public protocol SBObjectProtocol: NSObjectProtocol { + func get() -> Any! +} + +@objc public protocol SBApplicationProtocol: SBObjectProtocol { + func activate() + var delegate: SBApplicationDelegate! { get set } + var isRunning: Bool { get } +} + +// MARK: Google +@objc public protocol Google { + @objc optional func saveIn(_ in_: URL!, as: String!) // Save an object. + @objc optional func close() // Close a window. + @objc optional func delete() // Delete an object. + @objc optional func duplicateTo(_ to: SBObject!, withProperties: [AnyHashable : Any]!) -> SBObject // Copy object(s) and put the copies at a new location. + @objc optional func moveTo(_ to: SBObject!) -> SBObject // Move object(s) to a new location. + @objc optional func print() // Print an object. + @objc optional func reload() // Reload a tab. + @objc optional func goBack() // Go Back (If Possible). + @objc optional func goForward() // Go Forward (If Possible). + @objc optional func selectAll() // Select all. + @objc optional func cutSelection() // Cut selected text (If Possible). + @objc optional func copySelection() // Copy text. + @objc optional func pasteSelection() // Paste text (If Possible). + @objc optional func undo() // Undo the last change. + @objc optional func redo() // Redo the last change. + @objc optional func stop() // Stop the current tab from loading. + @objc optional func viewSource() // View the HTML source of the tab. + @objc optional func executeJavascript(_ javascript: String!) -> Any // Execute a piece of javascript. +} + +// MARK: GoogleChromeApplication +@objc public protocol GoogleChromeApplication: SBApplicationProtocol { + @objc optional func windows() -> SBElementArray + @objc optional var name: String { get } // The name of the application. + @objc optional var frontmost: Bool { get } // Is this the frontmost (active) application? + @objc optional var version: String { get } // The version of the application. + @objc optional func `open`(_ x: [URL]!) // Open a document. + @objc optional func quit() // Quit the application. + @objc optional func exists(_ x: Any!) -> Bool // Verify if an object exists. + @objc optional func bookmarkFolders() -> SBElementArray + @objc optional var bookmarksBar: GoogleChromeBookmarkFolder { get } // The bookmarks bar bookmark folder. + @objc optional var otherBookmarks: GoogleChromeBookmarkFolder { get } // The other bookmarks bookmark folder. +} +extension SBApplication: GoogleChromeApplication {} + +// MARK: GoogleChromeWindow +@objc public protocol GoogleChromeWindow: SBObjectProtocol { + @objc optional func tabs() -> SBElementArray + @objc optional var givenName: String { get } // The given name of the window. + @objc optional var name: String { get } // The full title of the window. + @objc optional func id() -> Int // The unique identifier of the window. + @objc optional var index: Int { get } // The index of the window, ordered front to back. + @objc optional var bounds: NSRect { get } // The bounding rectangle of the window. + @objc optional var closeable: Bool { get } // Whether the window has a close box. + @objc optional var minimizable: Bool { get } // Whether the window can be minimized. + @objc optional var minimized: Bool { get } // Whether the window is currently minimized. + @objc optional var resizable: Bool { get } // Whether the window can be resized. + @objc optional var visible: Bool { get } // Whether the window is currently visible. + @objc optional var zoomable: Bool { get } // Whether the window can be zoomed. + @objc optional var zoomed: Bool { get } // Whether the window is currently zoomed. + @objc optional var activeTab: GoogleChromeTab { get } // Returns the currently selected tab + @objc optional var mode: String { get } // Represents the mode of the window which can be 'normal' or 'incognito', can be set only once during creation of the window. + @objc optional var activeTabIndex: Int { get } // The index of the active tab. + @objc optional func setGivenName(_ givenName: String!) // The given name of the window. + @objc optional func setIndex(_ index: Int) // The index of the window, ordered front to back. + @objc optional func setBounds(_ bounds: NSRect) // The bounding rectangle of the window. + @objc optional func setMinimized(_ minimized: Bool) // Whether the window is currently minimized. + @objc optional func setVisible(_ visible: Bool) // Whether the window is currently visible. + @objc optional func setZoomed(_ zoomed: Bool) // Whether the window is currently zoomed. + @objc optional func setMode(_ mode: String!) // Represents the mode of the window which can be 'normal' or 'incognito', can be set only once during creation of the window. + @objc optional func setActiveTabIndex(_ activeTabIndex: Int) // The index of the active tab. +} +extension SBObject: GoogleChromeWindow {} + +// MARK: GoogleChromeTab +@objc public protocol GoogleChromeTab: SBObjectProtocol { + @objc optional func id() -> Int // Unique ID of the tab. + @objc optional var title: String { get } // The title of the tab. + @objc optional var URL: String { get } // The url visible to the user. + @objc optional var loading: Bool { get } // Is loading? + @objc optional func setURL(_ URL: String!) // The url visible to the user. +} +extension SBObject: GoogleChromeTab {} + +// MARK: GoogleChromeBookmarkFolder +@objc public protocol GoogleChromeBookmarkFolder: SBObjectProtocol { + @objc optional func bookmarkFolders() -> SBElementArray + @objc optional func bookmarkItems() -> SBElementArray + @objc optional func id() -> NSNumber // Unique ID of the bookmark folder. + @objc optional var title: String { get } // The title of the folder. + @objc optional var index: NSNumber { get } // Returns the index with respect to its parent bookmark folder. + @objc optional func setTitle(_ title: String!) // The title of the folder. +} +extension SBObject: GoogleChromeBookmarkFolder {} + +// MARK: GoogleChromeBookmarkItem +@objc public protocol GoogleChromeBookmarkItem: SBObjectProtocol { + @objc optional func id() -> Int // Unique ID of the bookmark item. + @objc optional var title: String { get } // The title of the bookmark item. + @objc optional var URL: String { get } // The URL of the bookmark. + @objc optional var index: NSNumber { get } // Returns the index with respect to its parent bookmark folder. + @objc optional func setTitle(_ title: String!) // The title of the bookmark item. + @objc optional func setURL(_ URL: String!) // The URL of the bookmark. +} +extension SBObject: GoogleChromeBookmarkItem {} +