Created
January 28, 2014 01:12
-
-
Save rolandwalker/8660683 to your computer and use it in GitHub Desktop.
Uninstall Logitech Harmony Remote Software.app/Contents/Resources/Scripts/main.scpt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Uninstall Logitech Harmony Client Software - Version 0.3 | |
| -- Coded by: Ben De Silva | |
| -- Date modified: 06/06/2008 | |
| property filesToDelete : {"/Applications/Logitech\\ Harmony\\ Remote\\ Software.app", "/Applications/remotecore.app", "/Library/Receipts/logitech.pkg", "/Library/Receipts/core.pkg", "/System/Library/Extensions/Belcarra.USBLAN_netpart.kext", "/System/Library/Extensions/Belcarra.USBLAN_usbpart.kext", "/System/Library/Extensions/RemoteControl.USBLAN_usbpart.kext", "/Library/Receipts/RemoteControlUsbKext.pkg", "/Library/Preferences/com.apple.java.util.prefs.plist", "/Library/Preferences/com.logitech.harmony.plist", "~/Library/Preferences/com.apple.java.util.prefs.plist", "~/Library/Preferences/com.logitech.harmony.plist", "~/Library/Preferences/com.logitech.harmony.cappuccino.client.logitech.plist", "~/Logitech", "~/Logitech/Prefs", "~/Logitech/Monitor", "~/Logitech/remote", "~/Logitech/usblan", "~/browser\\ -\\ logitech/", "~/Library/Application\\ Support/Logitech"} | |
| property theApplication : "Logitech Harmony Remote Software" | |
| property langAbbrev : {"en", "fr", "es", "de", "it", "nl", "sv", "da", "fi", "pt", "ru", "pl", "nb"} | |
| property displayLocale : {"Are you sure you want to uninstall the Logitech Harmony Remote Software?", "Etes-vous sûr de vouloir désinstaller Logitech Harmony Remote Software?", "¿Confirma que desea desinstalar Logitech Harmony Remote Software?", "Soll Logitech Harmony Remote Software wirklich deinstalliert werden?", "Disinstallare Logitech Harmony Remote Software?", "Weet u zeker dat u Logitech Harmony Remote Software wilt verwijderen?", "Vill du avinstallera Logitech Harmony Remote Software?", "Er du sikker på at du vil afinstallere Logitech Harmony Remote Software?", "Haluatko varmasti poistaa Logitech Harmony Remote Software -tuotteen?", "Tem a certeza de que deseja desinstalar o Logitech Harmony Remote Software?", "Are you sure you want to uninstall the Logitech Harmony Remote Software?", "Czy na pewno chcesz odinstalowaç produkt Logitech Harmony Remote Software?", "Er du sikker på at du vil avinstallere Logitech Harmony Remote Software?"} | |
| property localeCompleted : {"Uninstall Completed", "Désinstallation terminée", "Desinstalación completada", "Deinstallation abgeschlossen", "Disinstallazione completata", "Verwijdering voltooid", "Avinstallationen slutförd", "Afinstallationen er gennemført", "Poistaminen on suoritettu loppuun", "Desinstalação concluída", "Uninstall Completed", "Odinstalowywanie zakoƒczone", "Avinstalleringen er fullført"} | |
| property buttonYes : {"Yes", "Oui", "Sí", "Ja", "Sì", "Ja", "Ja", "Ja", "Kyllä", "Sim", "Yes", "Tak", "Ja"} | |
| property buttonNo : {"No", "Non", "No", "Nein", "No ", "Nee", "Nej", "Nej", "Ei", "Não", "No", "Nie", "Nei"} | |
| property buttonClose : {"Close", "Fermer", "Cerrar", "Schließen", "Chiudi", "Sluiten", "Stäng", "Luk", "Sulje", "Fechar", "Close", "Zamknij", "Lukk"} | |
| on closeSoftware() | |
| tell application "System Events" to set AppIsRunning to exists process theApplication | |
| if AppIsRunning then quit application theApplication | |
| end closeSoftware | |
| on DisplayMessage(textToDisplay, btnYes, btnNo) | |
| set macOS to (do shell script "sw_vers -productVersion") | |
| if macOS contains 10.3 then | |
| set path_to_me to path to me as Unicode text | |
| if path_to_me does not end with ":" then | |
| set path_to_me to path_to_me & ":" | |
| end if | |
| set icon_alias to (path_to_me & "Contents:Resources:applet.icns") as alias | |
| display dialog textToDisplay buttons {btnYes, btnNo} default button btnYes with icon icon_alias | |
| if button returned of result is btnNo then error number -128 | |
| else if macOS is greater than or equal to 10.4 then | |
| display dialog textToDisplay buttons {btnYes, btnNo} default button btnYes with icon 1 | |
| if button returned of result is btnNo then error number -128 | |
| else | |
| display dialog "Mac OS " & macOS & " is not supported" with icon 2 | |
| error number -128 | |
| end if | |
| end DisplayMessage | |
| -- This method is to check the user entered password for OS X 10.3.9 | |
| on checkAdminPassword(pass) | |
| do shell script "sudo -k" | |
| delay 1 | |
| try | |
| do shell script "sudo -s" password pass with administrator privileges | |
| on error | |
| return false | |
| end try | |
| return true | |
| do shell script "exit" | |
| end checkAdminPassword | |
| -- This method is to get the user entered password for OS X 10.3.9 | |
| on getAdminPassword() | |
| set initial_pass to (display dialog "Please enter your computer administrator password. Your password will not be hidden." default answer "") | |
| set newPass to text returned of initial_pass | |
| set checker to checkAdminPassword(newPass) | |
| if checker is false then | |
| display dialog "Invalid password, exiting Logitech Harmony Remote Software uninstaller." | |
| delay 1 | |
| error number -128 | |
| end if | |
| do shell script "sudo -k" | |
| return newPass | |
| end getAdminPassword | |
| on Deleter(displayCompleted, btnClose) | |
| set macOS to (do shell script "sw_vers -productVersion") | |
| if macOS contains 10.3 then | |
| set newValue to getAdminPassword() | |
| repeat with oneFile in filesToDelete | |
| try | |
| do shell script "rm -R " & oneFile password newValue with administrator privileges | |
| on error number n | |
| if n is -128 then | |
| error number -128 | |
| else if n = 1 then | |
| else | |
| error number -128 | |
| end if | |
| end try | |
| end repeat | |
| set path_to_me to path to me as Unicode text | |
| if path_to_me does not end with ":" then | |
| set path_to_me to path_to_me & ":" | |
| end if | |
| set icon_alias to (path_to_me & "Contents:Resources:applet.icns") as alias | |
| display dialog displayCompleted buttons {btnClose} default button btnClose with icon icon_alias | |
| error number -128 | |
| else if macOS is greater than or equal to 10.4 then | |
| repeat with oneFile in filesToDelete | |
| try | |
| do shell script "rm -R " & oneFile with administrator privileges | |
| on error number n | |
| if n is -128 then | |
| error number -128 | |
| else if n = 1 then | |
| else | |
| error number -128 | |
| end if | |
| end try | |
| end repeat | |
| display dialog displayCompleted buttons {btnClose} default button btnClose with icon (path to resource "applet.icns" in bundle (path to me)) with title "Uninstall Logitech Harmony Remote Software" | |
| else | |
| display dialog "Mac OS " & macOS & " is not supported" with icon 2 | |
| end if | |
| end Deleter | |
| ignoring case | |
| set SystemLanguage to do shell script "defaults read .GlobalPreferences AppleLanguages | tr -d [:space:] | cut -c2-3" | |
| set textToDisplay to item 1 of displayLocale | |
| set displayCompleted to item 1 of localeCompleted | |
| repeat with i from 1 to count langAbbrev | |
| if SystemLanguage is item i of langAbbrev then | |
| set textToDisplay to item i of displayLocale | |
| set displayCompleted to item i of localeCompleted | |
| set btnYes to item i of buttonYes | |
| set btnNo to item i of buttonNo | |
| set btnClose to item i of buttonClose | |
| exit repeat | |
| end if | |
| end repeat | |
| DisplayMessage(textToDisplay, btnYes, btnNo) | |
| closeSoftware() | |
| Deleter(displayCompleted, btnClose) | |
| end ignoring |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment