From 292e81df230c75ba0b6f1d6c9018a040750b96f1 Mon Sep 17 00:00:00 2001 From: Steven Zemelka Date: Sat, 15 Jun 2024 08:08:02 +0200 Subject: [PATCH] Script is no longer dependend on the OS language, fixed starting issues and updated readme --- HideMyMail-DE.scpt | 57 ----- HideMyMail.scpt | 17 +- README.md | 13 +- info.plist | 587 +++++++-------------------------------------- 4 files changed, 93 insertions(+), 581 deletions(-) delete mode 100644 HideMyMail-DE.scpt diff --git a/HideMyMail-DE.scpt b/HideMyMail-DE.scpt deleted file mode 100644 index a11a5f2..0000000 --- a/HideMyMail-DE.scpt +++ /dev/null @@ -1,57 +0,0 @@ -on run argv - tell application "System Settings" - activate - reveal pane id "com.apple.systempreferences.AppleIDSettings*AppleIDSettings" - end tell - tell application "System Events" - tell application process "System Settings" - tell splitter group 1 of group 1 of window 1 - tell group 2 to tell group 1 to tell scroll area 1 to tell group 3 - repeat until UI element 1 exists - delay 0 - end repeat - click UI element 1 - repeat until UI element 2 exists - delay 0 - end repeat - click UI element 2 - end tell - end tell - repeat until group 1 of group 1 of UI element 1 of scroll area 1 of sheet 1 of window 1 exists - delay 0 - end repeat - tell window 1 to tell sheet 1 to tell scroll area 1 to tell UI element 1 - tell group 1 of group 1 - click UI element 4 of group 1 - repeat until text field 1 of group 4 exists - delay 0 - end repeat - click text field 1 of group 4 - set value of text field 1 of group 4 to argv - end tell - tell group 1 to tell group 2 to tell group 1 - repeat until UI element "Fortfahren" of group 2 exists - delay 0 - end repeat - click UI element "Fortfahren" of group 2 - repeat until UI element "Adresse kopieren" of group 1 exists - delay 0 - end repeat - click UI element "Adresse kopieren" of group 1 - repeat until UI element "Fertig" of group 2 exists - delay 0 - end repeat - click UI element "Fertig" of group 2 - repeat until UI element "Fertig" of group 1 exists - delay 0 - end repeat - click UI element "Fertig" of group 1 - end tell - end tell - end tell - end tell - tell application "System Settings" - delay 1 - quit - end tell -end run diff --git a/HideMyMail.scpt b/HideMyMail.scpt index 075ffe0..e6ebf2d 100644 --- a/HideMyMail.scpt +++ b/HideMyMail.scpt @@ -1,6 +1,7 @@ on run argv tell application "System Settings" activate + delay 0.5 reveal pane id "com.apple.systempreferences.AppleIDSettings*AppleIDSettings" end tell tell application "System Events" @@ -30,22 +31,22 @@ on run argv set value of text field 1 of group 4 to argv end tell tell group 1 to tell group 2 to tell group 1 - repeat until UI element "Continue" of group 2 exists + repeat until UI element 1 of group 2 exists delay 0 end repeat - click UI element "Fortfahren" of group 2 - repeat until UI element "Copy address" of group 1 exists + click UI element 1 of group 2 + repeat until UI element 1 of group 1 exists delay 0 end repeat - click UI element "Adresse kopieren" of group 1 - repeat until UI element "Done" of group 2 exists + click UI element 1 of group 1 + repeat until UI element 1 of group 2 exists delay 0 end repeat - click UI element "Fertig" of group 2 - repeat until UI element "Done" of group 1 exists + click UI element 1 of group 2 + repeat until UI element 1 of group 1 exists delay 0 end repeat - click UI element "Done" of group 1 + click UI element 1 of group 1 end tell end tell end tell diff --git a/README.md b/README.md index 96a698e..7981596 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Hide My Mail Logo

-### 🎩 Create a new iCloud Hide My Mail address with a specified label via Alfred and have it copied to your clipboard. +### 🎩 Create a new iCloud Hide My Mail address automatically with an specified label via Alfred and have it copied to your clipboard. ## Showcase > The whole shown process is completed within a couple seconds. @@ -16,7 +16,6 @@ ## Installation 1. Download the latest `.alfredworkflow` file from the [releases page](https://github.com/Klizzy/alfred-hide-my-mail/releases). 2. Double-click the downloaded file to import it into Alfred 5. -3. Configure the workflow, if your MacOS system language is not set to English. ## Usage 1. Open Alfred (default shortcut: `Option + Space`). @@ -31,17 +30,11 @@ The workflow will open the MacOS System Settings, navigate to the appropriate se 1. Alfred 5.1 or later 2. Active [iCloud+](https://support.apple.com/guide/icloud/mm9d9012c9e8/icloud) subscription 3. MacOS 14.1 or later -4. Your MacOS system language is supported by the workflow ## Configuration -The workflow currently supports the following languages and config values: -- English - - `EN` -- German - - `DE` - -The default setting is `EN`. To change the language, open the Alfred Preferences, navigate to the `Workflows` tab, select the `Hide My Mail` workflow, and click on the `Configure Workflow` button. Here you can change the language setting to `DE` and save the configuration. +You can change the keyword to trigger the workflow by opening the Alfred Preferences, navigating to the `Workflows` tab, selecting the `Hide My Mail` workflow, and clicking on the `Configure Workflow` button. Here you can change the keyword to your desired value. +- The default keyword is `hide`. ## Why? diff --git a/info.plist b/info.plist index 7a63c4e..0d078a6 100644 --- a/info.plist +++ b/info.plist @@ -8,11 +8,11 @@ Productivity connections - 1F7A821B-A31C-4324-97D2-527A2122A0A5 + 945D000B-B6C8-4E7F-8C2C-26AF2A880B0F destinationuid - 3C4D1533-066A-44DD-8D10-2D58CEB9F486 + AC04F4E8-31B4-482D-A1BA-FADCC7CCDC77 modifiers 0 modifiersubtext @@ -21,11 +21,11 @@ - 3BA55F86-8A4D-4179-A06B-0BD1A289DB87 + AC04F4E8-31B4-482D-A1BA-FADCC7CCDC77 destinationuid - D38E1A0C-88F1-41B6-8C60-616E475C7572 + 36478728-1765-4DAA-9749-69D0E88C2B3B modifiers 0 modifiersubtext @@ -34,124 +34,6 @@ - 3C4D1533-066A-44DD-8D10-2D58CEB9F486 - - - destinationuid - 8B5FE991-43A8-420E-8EB0-F99126332A50 - modifiers - 0 - modifiersubtext - - sourceoutputuid - E5950789-89C4-472A-A9A5-EC50CEB910D6 - vitoclose - - - - destinationuid - 8B5FE991-43A8-420E-8EB0-F99126332A50 - modifiers - 0 - modifiersubtext - - sourceoutputuid - 4D727EA0-A3C4-4B0B-A805-9148C12B7E4E - vitoclose - - - - destinationuid - 4CDB0F68-080E-41D9-AD6D-39E69585E5B5 - modifiers - 0 - modifiersubtext - - vitoclose - - - - 3E851897-CFD4-4689-8541-85E1EDAF1147 - - - destinationuid - 1F7A821B-A31C-4324-97D2-527A2122A0A5 - modifiers - 0 - modifiersubtext - - vitoclose - - - - 7804CD9C-CC9E-46DA-87C0-70EF1FF5BB95 - - - destinationuid - E31033E5-DA73-40A8-A6AE-D84C10AE7827 - modifiers - 0 - modifiersubtext - - vitoclose - - - - 8B5FE991-43A8-420E-8EB0-F99126332A50 - - - destinationuid - 3BA55F86-8A4D-4179-A06B-0BD1A289DB87 - modifiers - 0 - modifiersubtext - - vitoclose - - - - A6780C8C-DA29-4337-9F49-685D444BF086 - - - destinationuid - E31033E5-DA73-40A8-A6AE-D84C10AE7827 - modifiers - 0 - modifiersubtext - - vitoclose - - - - D38E1A0C-88F1-41B6-8C60-616E475C7572 - - - destinationuid - A6780C8C-DA29-4337-9F49-685D444BF086 - modifiers - 0 - modifiersubtext - - sourceoutputuid - E5950789-89C4-472A-A9A5-EC50CEB910D6 - vitoclose - - - - destinationuid - 7804CD9C-CC9E-46DA-87C0-70EF1FF5BB95 - modifiers - 0 - modifiersubtext - - sourceoutputuid - 4D727EA0-A3C4-4B0B-A805-9148C12B7E4E - vitoclose - - - - E31033E5-DA73-40A8-A6AE-D84C10AE7827 - createdby Klizzy @@ -163,133 +45,13 @@ Hide My Maill objects - - config - - concurrently - - escaping - 76 - script - on run argv - tell application "System Settings" - activate - reveal pane id "com.apple.systempreferences.AppleIDSettings*AppleIDSettings" - -end tell - tell application "System Events" - tell application process "System Settings" - tell splitter group 1 of group 1 of window 1 - tell group 2 to tell group 1 to tell scroll area 1 to tell group 3 - repeat until UI element 1 exists - delay 0 - end repeat - click UI element 1 - repeat until UI element 2 exists - delay 0 - end repeat - click UI element 2 - end tell - end tell - repeat until group 1 of group 1 of UI element 1 of scroll area 1 of sheet 1 of window 1 exists - delay 0 - end repeat - tell window 1 to tell sheet 1 to tell scroll area 1 to tell UI element 1 - tell group 1 of group 1 - click UI element 4 of group 1 - repeat until text field 1 of group 4 exists - delay 0 - end repeat - click text field 1 of group 4 - set value of text field 1 of group 4 to argv - end tell - tell group 1 to tell group 2 to tell group 1 - repeat until UI element "Continue" of group 2 exists - delay 0 - end repeat - click UI element "Fortfahren" of group 2 - repeat until UI element "Copy address" of group 1 exists - delay 0 - end repeat - click UI element "Adresse kopieren" of group 1 - repeat until UI element "Done" of group 2 exists - delay 0 - end repeat - click UI element "Fertig" of group 2 - repeat until UI element "Done" of group 1 exists - delay 0 - end repeat - click UI element "Done" of group 1 - end tell - end tell - end tell - end tell - tell application "System Settings" - delay 1 quit end tell -end run - scriptargtype - 1 - scriptfile - - type - 6 - - type - alfred.workflow.action.script - uid - A6780C8C-DA29-4337-9F49-685D444BF086 - version - 2 - - - config - - lastpathcomponent - - onlyshowifquerypopulated - - removeextension - - text - iCloud mail has been added to your clipboard - title - Success! - - type - alfred.workflow.output.notification - uid - E31033E5-DA73-40A8-A6AE-D84C10AE7827 - version - 1 - - - config - - browser - - skipqueryencode - - skipvarencode - - spaces - - url - x-apple.systempreferences:com.apple.preference.security - - type - alfred.workflow.action.openurl - uid - 8B5FE991-43A8-420E-8EB0-F99126332A50 - version - 1 - config argumenttype 0 keyword - hide + {var:trigger_keyword} subtext Pass your wanted label as argument text @@ -300,136 +62,7 @@ end run type alfred.workflow.input.keyword uid - 3E851897-CFD4-4689-8541-85E1EDAF1147 - version - 1 - - - config - - conditions - - - inputstring - {var:lang} - matchcasesensitive - - matchmode - 0 - matchstring - EN - outputlabel - EN workflow config - uid - E5950789-89C4-472A-A9A5-EC50CEB910D6 - - - inputstring - {var:lang} - matchcasesensitive - - matchmode - 0 - matchstring - DE - outputlabel - DE workflow config - uid - 4D727EA0-A3C4-4B0B-A805-9148C12B7E4E - - - elselabel - else - hideelse - - - type - alfred.workflow.utility.conditional - uid - 3C4D1533-066A-44DD-8D10-2D58CEB9F486 - version - 1 - - - config - - conditions - - - inputstring - {var:lang} - matchcasesensitive - - matchmode - 0 - matchstring - EN - outputlabel - EN workflow config - uid - E5950789-89C4-472A-A9A5-EC50CEB910D6 - - - inputstring - {var:lang} - matchcasesensitive - - matchmode - 0 - matchstring - DE - outputlabel - DE workflow config - uid - 4D727EA0-A3C4-4B0B-A805-9148C12B7E4E - - - elselabel - else - hideelse - - - type - alfred.workflow.utility.conditional - uid - D38E1A0C-88F1-41B6-8C60-616E475C7572 - version - 1 - - - config - - argument - {var:emailAlias} - passthroughargument - - variables - - - type - alfred.workflow.utility.argument - uid - 3BA55F86-8A4D-4179-A06B-0BD1A289DB87 - version - 1 - - - config - - argument - {query} - passthroughargument - - variables - - emailAlias - {query} - - - type - alfred.workflow.utility.argument - uid - 1F7A821B-A31C-4324-97D2-527A2122A0A5 + 945D000B-B6C8-4E7F-8C2C-26AF2A880B0F version 1 @@ -442,60 +75,62 @@ end run 76 script on run argv - tell application "System Settings" - activate - reveal pane id "com.apple.systempreferences.AppleIDSettings*AppleIDSettings" - -end tell - tell application "System Events" - tell application process "System Settings" - tell splitter group 1 of group 1 of window 1 - tell group 2 to tell group 1 to tell scroll area 1 to tell group 3 - repeat until UI element 1 exists - delay 0 - end repeat - click UI element 1 - repeat until UI element 2 exists - delay 0 - end repeat - click UI element 2 - end tell - end tell - repeat until group 1 of group 1 of UI element 1 of scroll area 1 of sheet 1 of window 1 exists - delay 0 - end repeat - tell window 1 to tell sheet 1 to tell scroll area 1 to tell UI element 1 - tell group 1 of group 1 - click UI element 4 of group 1 - repeat until text field 1 of group 4 exists - delay 0 - end repeat - click text field 1 of group 4 - set value of text field 1 of group 4 to argv - end tell - tell group 1 to tell group 2 to tell group 1 - repeat until UI element "Fortfahren" of group 2 exists - delay 0 - end repeat - click UI element "Fortfahren" of group 2 - repeat until UI element "Adresse kopieren" of group 1 exists - delay 0 - end repeat - click UI element "Adresse kopieren" of group 1 - repeat until UI element "Fertig" of group 2 exists - delay 0 - end repeat - click UI element "Fertig" of group 2 - repeat until UI element "Fertig" of group 1 exists - delay 0 - end repeat - click UI element "Fertig" of group 1 - end tell - end tell + tell application "System Settings" + activate + delay 0.5 + reveal pane id "com.apple.systempreferences.AppleIDSettings*AppleIDSettings" + end tell + tell application "System Events" + tell application process "System Settings" + tell splitter group 1 of group 1 of window 1 + tell group 2 to tell group 1 to tell scroll area 1 to tell group 3 + repeat until UI element 1 exists + delay 0 + end repeat + click UI element 1 + repeat until UI element 2 exists + delay 0 + end repeat + click UI element 2 end tell + end tell + repeat until group 1 of group 1 of UI element 1 of scroll area 1 of sheet 1 of window 1 exists + delay 0 + end repeat + tell window 1 to tell sheet 1 to tell scroll area 1 to tell UI element 1 + tell group 1 of group 1 + click UI element 4 of group 1 + repeat until text field 1 of group 4 exists + delay 0 + end repeat + click text field 1 of group 4 + set value of text field 1 of group 4 to argv + end tell + tell group 1 to tell group 2 to tell group 1 + repeat until UI element 1 of group 2 exists + delay 0 + end repeat + click UI element 1 of group 2 + repeat until UI element 1 of group 1 exists + delay 0 + end repeat + click UI element 1 of group 1 + repeat until UI element 1 of group 2 exists + delay 0 + end repeat + click UI element 1 of group 2 + repeat until UI element 1 of group 1 exists + delay 0 + end repeat + click UI element 1 of group 1 + end tell + end tell end tell - tell application "System Settings" - delay 1 quit end tell + end tell + tell application "System Settings" + delay 1 + quit + end tell end run scriptargtype 1 @@ -507,7 +142,7 @@ end run type alfred.workflow.action.script uid - 7804CD9C-CC9E-46DA-87C0-70EF1FF5BB95 + AC04F4E8-31B4-482D-A1BA-FADCC7CCDC77 version 2 @@ -521,14 +156,14 @@ end run removeextension text - The configured language "{var:lang}" is currently not supported + iCloud mail has been added to your clipboard title - Execution failed! + Success! type alfred.workflow.output.notification uid - 4CDB0F68-080E-41D9-AD6D-39E69585E5B5 + 36478728-1765-4DAA-9749-69D0E88C2B3B version 1 @@ -556,7 +191,6 @@ end run --- 1. Download the latest `.alfredworkflow` file from the [releases page](https://github.com/Klizzy/alfred-hide-my-mail/releases). 2. Double-click the downloaded file to import it into Alfred 5. -3. Configure the workflow, if your MacOS system language is not set to English. ## Usage @@ -574,18 +208,12 @@ The workflow will open the MacOS System Settings, navigate to the appropriate se 1. Alfred 5.1 or later 2. Active [iCloud+](https://support.apple.com/guide/icloud/mm9d9012c9e8/icloud) subscription 3. MacOS 14.1 or later -4. Your MacOS system language is supported by the workflow ## Configuration --- -The workflow currently supports the following languages and config values: -- English - - `EN` -- German - - `DE` - -The default setting is `EN`. To change the language, open the Alfred Preferences, navigate to the `Workflows` tab, select the `Hide My Mail` workflow, and click on the `Configure Workflow` button. Here you can change the language setting to `DE` and save the configuration. +You can change the keyword to trigger the workflow by opening the Alfred Preferences, navigating to the `Workflows` tab, selecting the `Hide My Mail` workflow, and clicking on the `Configure Workflow` button. Here you can change the keyword to your desired value. +- The default keyword is `hide`. ## Why? @@ -605,79 +233,28 @@ The complete process is automated with this workflow, so you don't have to click The main script is heavily inspired by a created Shortcut from [this reddit thread](https://www.reddit.com/r/shortcuts/comments/yp5817/comment/je8o0or/) uidata - 1F7A821B-A31C-4324-97D2-527A2122A0A5 + 36478728-1765-4DAA-9749-69D0E88C2B3B xpos - 245 + 1020 ypos - 335 + 355 - 3BA55F86-8A4D-4179-A06B-0BD1A289DB87 + 945D000B-B6C8-4E7F-8C2C-26AF2A880B0F xpos - 710 + 365 ypos - 325 + 355 - 3C4D1533-066A-44DD-8D10-2D58CEB9F486 - - xpos - 340 - ypos - 310 - - 3E851897-CFD4-4689-8541-85E1EDAF1147 - - xpos - 70 - ypos - 305 - - 4CDB0F68-080E-41D9-AD6D-39E69585E5B5 - - xpos - 545 - ypos - 450 - - 7804CD9C-CC9E-46DA-87C0-70EF1FF5BB95 - - note - Script for DE MacOS system language - xpos - 1040 - ypos - 390 - - 8B5FE991-43A8-420E-8EB0-F99126332A50 - - xpos - 545 - ypos - 295 - - A6780C8C-DA29-4337-9F49-685D444BF086 + AC04F4E8-31B4-482D-A1BA-FADCC7CCDC77 note - Script for EN MacOS system language - xpos - 1035 - ypos - 220 - - D38E1A0C-88F1-41B6-8C60-616E475C7572 - + Applescript - GUI Scripting xpos - 790 + 695 ypos - 315 - - E31033E5-DA73-40A8-A6AE-D84C10AE7827 - - xpos - 1290 - ypos - 290 + 355 userconfigurationconfig @@ -686,26 +263,24 @@ The main script is heavily inspired by a created Shortcut from [this reddit thre config default - EN + hide placeholder - Type "DE" or "EN" + required trim description - Set the language of your system, so the UI buttons are correctly identified and clicked + Keyword to start the execution label - MacOS System Language + Trigger Keyword type textfield variable - lang + trigger_keyword - variablesdontexport - version 1.0 webaddress