{"id":260962,"date":"2024-05-28T08:41:55","date_gmt":"2024-05-28T08:41:55","guid":{"rendered":"https:\/\/www.ninjaone.com\/?post_type=script_hub&#038;p=260962"},"modified":"2024-05-28T08:41:55","modified_gmt":"2024-05-28T08:41:55","slug":"custom-popup-messages-for-macos","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/de\/script-hub\/custom-popup-messages-for-macos\/","title":{"rendered":"Ein umfassender Leitfaden f\u00fcr benutzerdefinierte Popup-Meldungen f\u00fcr macOS"},"content":{"rendered":"<h2>Die wichtigsten Erkenntnisse<\/h2>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\">Das Skript erstellt anpassbare Popup-Meldungen unter macOS und verbessert so die direkte Kommunikation zwischen IT-Experten und Endbenutzer:innen.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"2\" data-aria-level=\"1\">Es bietet umfangreiche Anpassungsoptionen f\u00fcr Popup-Titel, Nachricht, Schaltfl\u00e4chen, Symbole und Aktionen.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"3\" data-aria-level=\"1\">Die Benutzer:innen k\u00f6nnen bestimmte Aktionen festlegen, die bei Tastendruck oder nach Ablauf der Popup-Zeit ausgef\u00fchrt werden sollen, um automatisierte IT-Verwaltungsaufgaben zu erleichtern.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"4\" data-aria-level=\"1\">Das Skript enth\u00e4lt Fehlerpr\u00fcfungen f\u00fcr h\u00e4ufige Konfigurationsfehler, die einen zuverl\u00e4ssigen und sicheren Betrieb gew\u00e4hrleisten.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"5\" data-aria-level=\"1\">Im Vergleich zu herk\u00f6mmlichen Methoden wie E-Mails bietet dieses Skript eine direktere und interaktivere Art der \u00dcbermittlung von Nachrichten.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"6\" data-aria-level=\"1\">Da das Skript in der Lage ist, den Benutzer zu direkten Aktionen aufzufordern, sind eine ethische Nutzung und Transparenz unerl\u00e4sslich.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"7\" data-aria-level=\"1\">Gr\u00fcndliche Tests und eine klare Kommunikation mit den Nutzern werden f\u00fcr eine effektive Einf\u00fchrung empfohlen.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"8\" data-aria-level=\"1\">Dieses Skript erg\u00e4nzt Tools wie NinjaOne und verbessert die Effizienz und Kontrolle im IT-Management.<\/li>\n<\/ul>\n<h2>Vorwort<\/h2>\n<p>Die F\u00e4higkeit, Benutzeraktionen effektiv zu kommunizieren und zu verwalten, ist ein entscheidender Aspekt des <a href=\"https:\/\/www.ninjaone.com\/de\/it-management-fuer-unternehmen\/infrastruktur\/\">IT-Infrastrukturmanagements.<\/a> Ein Skript, das anpassbare Popup-Meldungen auf macOS-Ger\u00e4ten erstellt, verk\u00f6rpert diese Notwendigkeit und bietet ein vielseitiges Tool f\u00fcr Systemadministratoren und <a href=\"https:\/\/www.ninjaone.com\/what-is-an-msp\/\">Managed Service Provider (MSPs).\u00a0<\/a><\/p>\n<h2>Hintergrund<\/h2>\n<p>Die Hauptfunktion dieses Bash-Skripts besteht darin, anpassbare Popup-Meldungen unter macOS zu erzeugen, wobei eine Vielzahl von Parametern zur Anpassung zur Verf\u00fcgung steht. Diese Funktion ist besonders n\u00fctzlich f\u00fcr IT-Experten und MSPs, die auf kontrollierte und effiziente Weise Aktionen veranlassen oder Informationen direkt an Endbenutzer weitergeben m\u00fcssen. Ihre Bedeutung ergibt sich aus der Notwendigkeit, die Kommunikation auf eine nicht aufdringliche, aber direkte Weise zu rationalisieren.<\/p>\n<h2>Das Skript:<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">#!\/usr\/bin\/env bash\r\n#\r\n# Description: Creates a popup window on the user's screen. Use Restart Reminder to display a request to the end user to restart their computer. Please run as 'System'.\r\n# By using this script, you indicate your acceptance of the following legal terms as well as our Terms of Use at https:\/\/www.ninjaone.com\/terms-of-use.\r\n# Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms. \r\n# Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party. \r\n# Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library or website belonging to or under the control of any other software provider. \r\n# Warranty Disclaimer: The script is provided \u201cas is\u201d and \u201cas available\u201d, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations. \r\n# Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks. \r\n# Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script. \r\n# EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).\r\n#\r\n# Preset Parameter: --restartreminder\r\n#   Displays a generic restart PopUp. Can be overridden with parameters. Equivalent to the below parameters.\r\n#   --title 'NinjaOne Rmm'\r\n#   --message 'Your IT Administrator is requesting that you restart your computer. Click \"Restart Now\" after saving your work.'\r\n#   --buttonltext 'Restart Now'\r\n#   --buttonrtext 'Ignore'\r\n#   --buttonlaction 'shutdown -r now'\r\n#   --timeout 900\r\n#\r\n# Preset Parameter: --title 'ReplaceWithYourDesiredHeader'\r\n#   Replace the text encased in quotes to replace the text in the title bar of the popup window (defaults to 'NinjaOne RMM').\r\n#\r\n# Preset Parameter: --message 'ReplaceWithYourPopUpMessage'\r\n#   Replace the text encased in quotes to put some text inside of the PopUp Window.\r\n#\r\n# Preset Parameter: --iconpath 'A URL or \/a\/path\/to\/an\/image.png'\r\n#   Replace the text encased in quotes with either a url to an image or a filepath to an icon. The script uses the NinjaOne Logo by default.\r\n#   For best results use a 512px x 512px png. Though other formats and sizes will work.\r\n#   Highly recommend keeping a 1:1 ratio for the width and height.\r\n#   Supported formats: png, jpg, jpeg, webp, bmp, ico and gif (will not be animated in popup)\r\n#   If you have a base64 encoding of your image you could also replace the default base64 on line 46.\r\n#\r\n# Preset Parameter: --buttonltext 'ReplaceWithNameOfButton'\r\n#   Replace the text encased in quotes with the name\/text inside the left button.\r\n#\r\n# Preset Parameter: --buttonrtext 'ReplaceWithNameOfButton'\r\n#   Replace the text encased in quotes with the name\/text inside the right button.\r\n#\r\n# Preset Parameter: --timeout 'ReplaceWithAnumberofSeconds'\r\n#   Replace the text encased in quotes with the number of seconds you'd like the PopUp to display for. 0 never times out.\r\n#\r\n# Preset Parameter: --buttonlaction 'ReplaceWithYourDesiredAction(Executes in Bash)'\r\n#   Replace the text encased in quotes with the command you'd like to run when the left button is clicked by the user (executes in bash).\r\n#\r\n# Preset Parameter: --buttonraction 'ReplaceWithYourDesiredAction(Executes in Bash)'\r\n#   Replace the text encased in quotes with the command you'd like to run when the right button is clicked by the user (executes in bash).\r\n#\r\n# Preset Parameter: --timeoutaction 'ReplaceWithYourDesiredAction(Executes in Bash)'\r\n#   Replace the text encased in quotes with the command you'd like to run when the dialog box times out (executes in bash).\r\n\r\n# You can replace the below line with iconbase64='ReplaceThisWithYourBase64encodedimageEncasedInQuotes' and the script will decode the image and use it in the popup window.\r\niconbase64='iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAAJFBMVEUARF0Apc0AmL8ApM0Aos0Aps7\/\/\/8Am8ia1ug9rtLd8\/jw+\/2tMDHwAAAABXRSTlMBrBTIcce4nvwAAAIeSURBVHic7dvrcoMgEAXgiOAivv\/7Fm+JBpCLwk7bsz86rcNkPw+Y0Gl5vd4lGtbLKSG7vmF18mwQnWpe3YcghP2Z1svU8OtbIOihm8op25M2gWBov9UqYJj\/vSRzAGsEkhMglxngWINbdbxLAAAAAAAAAAAAAKAI8Oz2KRtApPWThEyAbT8NZwDZGpeav6sLIKXNMBwAtuGotTGTvTpMRms9qkxEBsDe\/dz+A7B3rufeS\/utrCKPkAywzfYmK8BeOHY+lBkzBImALfwDgA4XnNLphCTA4e43AKmL9vNMJD8pCQAna20nP5D+SfkQgJyp1qS9PYsEKQDnpVP627WYJCgBmGj+GRmUAFIraSXWBAwDcwJJk1AXMIzcgHgElQHxCGoDohHcBsybgIvPpei70S2A0csuaNkTBRBTbA7uAOb271E0+gWxOSgHfG87yD+wGsCz7fGONNf9iwGTb89DnlkwkUVQCPD2t1sXz9A6gMDT5YsgsggKARljI\/vTMkDo7cU3B1USCL+oOwdVAMGF5RlcAxB+tBoBwq\/JDlDcAPYEAGgDuPiNBwkgASSABJAAEkACSAAJIAEkgASQABL4JwlcA9w\/9N4GTOZcl1OQMTgRoEannhv9O\/+PCAAAAAAAAAAAAACAPwhgP+7HeOCR1jOfjBHI9dBrz9W\/34\/d9jyHLvvPweP2GdCx\/3zyvLlAfZ8+l13LktJzAJ+nfgAP50EVLvPsRgAAAABJRU5ErkJggg=='\r\nworkingdir=\"\/tmp\/ninjaone-rmm-popup\"\r\n\r\ndie() {\r\n  local _ret=\"${2:-1}\"\r\n  test \"${_PRINT_HELP:-no}\" = yes &amp;&amp; print_help &gt;&amp;2\r\n  echo \"$1\" &gt;&amp;2\r\n  exit \"${_ret}\"\r\n}\r\n\r\n# THE DEFAULTS INITIALIZATION - OPTIONALS\r\n_arg_title=\"NinjaOne RMM\"\r\n_arg_message=\r\n_arg_iconpath=\r\n_arg_buttonrtext=\r\n_arg_buttonraction=\r\n_arg_buttonltext=\r\n_arg_buttonlaction=\r\n_arg_timeoutaction=\r\n_arg_timeout=900\r\n_arg_restartreminder=\"off\"\r\n\r\n# This function will print out some help text if the user entered something wrong\r\nprint_help() {\r\n  printf '\\t%s\\n\\n' 'Usage: [-t|--title &lt;arg&gt;] [-m|-msg|--message &lt;arg&gt;] [-i|-icon|--iconpath &lt;arg&gt;] [-blt|-btnltxt|--buttonltext &lt;arg&gt;] [-brt|-btnrtxt|--buttonrtext &lt;arg&gt;] [-bla|-btnlact|--buttonlaction &lt;arg&gt;] [-bra|-btnract|--buttonraction &lt;arg&gt;] [-to|--timeout &lt;arg&gt;] [-toa|-toact|--timeoutaction &lt;arg&gt;] [-restart|--restartreminder] [-h|--help]'\r\n  printf '\\t%s\\n' \"Preset Parameter: --restartreminder\"\r\n  printf '\\t\\t%s\\n' \"Displays a generic restart PopUp. Can be overridden with parameters. Equivalent to the below parameters.\"\r\n  printf '\\t\\t%s\\n' \"--title 'NinjaOne RMM'\"\r\n  printf '\\t\\t%s\\n' \"--message 'Your IT Administrator is requesting that you restart your computer. Click 'Restart Now' after saving your work.'\"\r\n  printf '\\t\\t%s\\n' \"--buttonltext 'Restart Now'\"\r\n  printf '\\t\\t%s\\n' \"--buttonrtext 'Ignore'\"\r\n  printf '\\t\\t%s\\n' \"--buttonlaction 'shutdown -r now'\"\r\n  printf '\\t\\t%s\\n' \"--timeout '900'\"\r\n  printf '\\t%s\\n' \"Preset Parameter: --title 'ReplaceWithYourDesiredHeader'\"\r\n  printf '\\t\\t%s\\n' \"Replace the text encased in quotes to replace the text in the title bar of the popup window (defaults to 'NinjaOne RMM')\"\r\n  printf '\\t%s\\n' \"Preset Parameter: --message 'ReplaceWithYourPopUpMessage'\"\r\n  printf '\\t\\t%s\\n' \"Replace the text encased in quotes to put some text inside of the PopUp Window\"\r\n  printf '\\t%s\\n' \"Preset Parameter: --iconpath 'A URL or \/a\/path\/to\/an\/image.png'\"\r\n  printf '\\t\\t%s\\n' \"Replace the text encased in quotes with either a url to an image or a filepath to an icon. The script uses the NinjaOne Logo by default.\"\r\n  printf '\\t%s\\n' \"Preset Parameter: --buttonltext 'ReplaceWithNameOfButton'\"\r\n  printf '\\t\\t%s\\n' \"Replace the text encased in quotes with the name\/text inside the left button.\"\r\n  printf '\\t%s\\n' \"Preset Parameter: --buttonrtext 'ReplaceWithNameOfButton'\"\r\n  printf '\\t\\t%s\\n' \"Replace the text encased in quotes with the name\/text inside the right button.\"\r\n  printf '\\t%s\\n' \"Preset Parameter: --timeout 'ReplaceWithAnumberofSeconds'\"\r\n  printf '\\t\\t%s\\n' \"Replace the text encased in quotes with the number of seconds you'd like the PopUp to display for. 0 never times out.\"\r\n  printf '\\t%s\\n' \"Preset Parameter: --buttonlaction 'ReplaceWithYourDesiredAction(Executes in Bash)'\"\r\n  printf '\\t\\t%s\\n' \"Replace the text encased in quotes with the command you'd like to run when the left button is clicked by the user (executes in bash).\"\r\n  printf '\\t%s\\n' \"Preset Parameter: --buttonraction 'ReplaceWithYourDesiredAction(Executes in Bash)'\"\r\n  printf '\\t\\t%s\\n' \"Replace the text encased in quotes with the command you'd like to run when the right button is clicked by the user (executes in bash).\"\r\n  printf '\\t%s\\n' \"Preset Parameter: --timeoutaction 'ReplaceWithYourDesiredAction(Executes in Bash)'\"\r\n  printf '\\t\\t%s\\n' \"Replace the text encased in quotes with the command you'd like to run when the dialog box times out (executes in bash).\"\r\n}\r\n\r\n# Deciphers the parameters given and stores them as variables\r\nparse_commandline() {\r\n  while test $# -gt 0; do\r\n    _key=\"$1\"\r\n    case \"$_key\" in\r\n    -t | --title)\r\n      test $# -lt 2 &amp;&amp; die \"Missing value for the optional argument '$_key'.\" 1\r\n      _arg_title=\"$2\"\r\n      shift\r\n      ;;\r\n    --title=*)\r\n      _arg_title=\"${_key##--title=}\"\r\n      ;;\r\n    -m | -msg | --message)\r\n      test $# -lt 2 &amp;&amp; die \"Missing value for the optional argument '$_key'.\" 1\r\n      _arg_message=\"$2\"\r\n      shift\r\n      ;;\r\n    --message=*)\r\n      _arg_message=\"${_key##--message=}\"\r\n      ;;\r\n    --msg=*)\r\n      _arg_message=\"${_key##--msg=}\"\r\n      ;;\r\n    -i | -icon | --iconpath)\r\n      test $# -lt 2 &amp;&amp; die \"Missing value for the optional argument '$_key'.\" 1\r\n      _arg_iconpath=\"$2\"\r\n      shift\r\n      ;;\r\n    --iconpath=*)\r\n      _arg_iconpath=\"${_key##--iconpath=}\"\r\n      ;;\r\n    --icon=*)\r\n      _arg_iconpath=\"${_key##--icon=}\"\r\n      ;;\r\n    -blt | -btnltxt | --buttonltext)\r\n      test $# -lt 2 &amp;&amp; die \"Missing value for the optional argument '$_key'.\" 1\r\n      _arg_buttonltext=\"$2\"\r\n      shift\r\n      ;;\r\n    --buttonltext=*)\r\n      _arg_buttonltext=\"${_key##--buttonltext=}\"\r\n      ;;\r\n    -bla | -btnlact | -btnlaction | --buttonlaction)\r\n      test $# -lt 2 &amp;&amp; die \"Missing value for the optional argument '$_key'.\" 1\r\n      _arg_buttonlaction=\"$2\"\r\n      shift\r\n      ;;\r\n    --buttonlaction=*)\r\n      _arg_buttonlaction=\"${_key##--buttonlaction=}\"\r\n      ;;\r\n    -brt | -btnrtxt | -btnrtext | --buttonrtext)\r\n      test $# -lt 2 &amp;&amp; die \"Missing value for the optional argument '$_key'.\" 1\r\n      _arg_buttonrtext=\"$2\"\r\n      shift\r\n      ;;\r\n    --buttonrtext=*)\r\n      _arg_buttonrtext=\"${_key##--buttonrtext=}\"\r\n      ;;\r\n    -bra | -btnract | -btnraction | --buttonraction)\r\n      test $# -lt 2 &amp;&amp; die \"Missing value for the optional argument '$_key'.\" 1\r\n      _arg_buttonraction=\"$2\"\r\n      shift\r\n      ;;\r\n    --buttonraction=*)\r\n      _arg_buttonraction=\"${_key##--buttonraction=}\"\r\n      ;;\r\n    -to | --timeout)\r\n      test $# -lt 2 &amp;&amp; die \"Missing value for the optional argument '$_key'.\" 1\r\n      _arg_timeout=\"$2\"\r\n      shift\r\n      ;;\r\n    --timeout=*)\r\n      _arg_timeout=\"${_key##--timeout=}\"\r\n      ;;\r\n    -toa | -toact | --timeoutaction | --timeoutAction)\r\n      test $# -lt 2 &amp;&amp; die \"Missing value for the optional argument '$_key'.\" 1\r\n      _arg_timeoutaction=\"$2\"\r\n      shift\r\n      ;;\r\n    --timeoutaction=*)\r\n      _arg_timeoutaction=\"${_key##--timeoutaction=}\"\r\n      ;;\r\n    -restart | --restartreminder | --restartReminder)\r\n      _arg_restartreminder=\"on\"\r\n      ;;\r\n    -h | --help)\r\n      print_help\r\n      exit 0\r\n      ;;\r\n    -h*)\r\n      print_help\r\n      exit 0\r\n      ;;\r\n    *)\r\n      _PRINT_HELP=yes die \"FATAL ERROR: Got an unexpected argument '$1'\" 1\r\n      ;;\r\n    esac\r\n    shift\r\n  done\r\n}\r\n\r\nparse_commandline \"$@\"\r\n\r\n# This function will be used to download an image file if requested.\r\ndownloadFile() {\r\n  i=1\r\n  while [[ $i -lt 4 ]]; do\r\n    if [[ ! $_arg_skipsleep == \"on\" ]]; then\r\n      sleepTime=$((1 + RANDOM % 7))\r\n      echo \"Sleeping for $sleepTime seconds.\"\r\n      sleep $sleepTime\r\n    fi\r\n\r\n    echo \"Download Attempt $i\"\r\n    curl -L \"$url\" -o \"$_arg_destfolder\/$_arg_filename\" -s -f\r\n\r\n    file=$_arg_destfolder\/$_arg_filename\r\n    if [[ -f $file ]]; then\r\n      echo 'Download was successful!'\r\n      i=4\r\n    else\r\n      echo 'Attempt Failed!'\r\n      ((i += 1))\r\n    fi\r\n  done\r\n}\r\n\r\nif [[ -n $title ]]; then\r\n  _arg_title=$title\r\nfi\r\n\r\nif [[ -n $message ]]; then\r\n  _arg_message=$message\r\nfi\r\n\r\nif [[ -n $iconPath ]]; then\r\n  _arg_iconpath=$iconPath\r\nfi\r\n\r\nif [[ -n $buttonLeftText ]]; then\r\n  _arg_buttonltext=$buttonLeftText\r\nfi\r\n\r\nif [[ -n $buttonLeftAction ]]; then\r\n  _arg_buttonlaction=$buttonLeftAction\r\nfi\r\n\r\nif [[ -n $buttonRightText ]]; then\r\n  _arg_buttonrtext=$buttonRightText\r\nfi\r\n\r\nif [[ -n $buttonRightAction ]]; then\r\n  _arg_buttonraction=$buttonRightAction\r\nfi\r\n\r\nif [[ -n $timeout ]]; then\r\n  _arg_timeout=$timeout\r\nfi\r\n\r\nif [[ -n $timeoutAction ]]; then\r\n  _arg_timeoutaction=$timeoutAction\r\nfi\r\n\r\nif [[ -n $restartReminder &amp;&amp; $restartReminder == \"true\" ]]; then\r\n  _arg_restartreminder=\"on\"\r\nfi\r\n\r\n# If --restartreminder was selected we'll want to preset some of the parameters.\r\nif [[ $_arg_restartreminder == \"on\" ]]; then\r\n  if [[ -z $_arg_buttonltext ]]; then\r\n    _arg_buttonltext=\"Restart Now\"\r\n  fi\r\n\r\n  if [[ -z $_arg_buttonrtext ]]; then\r\n    _arg_buttonrtext=\"Ignore\"\r\n  fi\r\n\r\n  if [[ -z $_arg_message ]]; then\r\n    _arg_message=\"Your IT Administrator is requesting that you restart your computer. Click 'Restart Now' after saving your work.\"\r\n  fi\r\n\r\n  if [[ -z $_arg_buttonlaction ]]; then\r\n    _arg_buttonlaction='shutdown -r $(date -v +30S \"+%H%M\")'\r\n  fi\r\n\r\n  if [[ -z $_arg_timeout ]]; then\r\n    _arg_timeout=900\r\n  fi\r\nfi\r\n\r\n# Cannot name the button cancel.\r\nif [[ $_arg_buttonltext == \"Cancel\" || $_arg_buttonrtext == \"Cancel\" ]]; then\r\n  _PRINT_HELP=no die \"FATAL ERROR: Cannot name the button 'Cancel' or we'll be unable to check the dialog response.\" 1\r\nfi\r\n\r\n# Must give a number\r\npattern='^[0-9]+$'\r\nif [[ ! $_arg_timeout =~ $pattern ]]; then\r\n  _PRINT_HELP=no die \"FATAL ERROR: --timeout requires a number of seconds in order to work. ex. '60' for 60 seconds.\" 1\r\nfi\r\n\r\n# Creates a working directory that we'll use for our icons\r\nif [[ ! -d \"$workingdir\" ]]; then\r\n  mkdir $workingdir\r\nfi\r\n\r\n# If we were given a url we'll want to download it. Since we don't really know the file we'll just not give it an extension.\r\npattern='^http(.?):\/\/(.*)'\r\nif [[ $_arg_iconpath =~ $pattern ]]; then\r\n  echo \"URL Given, downloading image...\"\r\n\r\n  url=$_arg_iconpath\r\n  _arg_destfolder=$workingdir\r\n  _arg_filename=\"downloadedimg\"\r\n\r\n  downloadFile\r\n  _arg_iconpath=$workingdir\/downloadedimg\r\nfi\r\n\r\n# If the script was given an iconpath as a parameter we'll want to use that instead.\r\nif [[ -n $iconbase64 &amp;&amp; -z $_arg_iconpath ]]; then\r\n  base64 -D &lt;&lt;&lt;$iconbase64 &gt;$workingdir\/base64img\r\n  _arg_iconpath=$workingdir\/base64img\r\nelif [[ ! $_arg_iconpath == \"$workingdir\/downloadedimg\" ]]; then\r\n  cp \"$_arg_iconpath\" \"$workingdir\"\r\nfi\r\n\r\n# This will be used to check that the file is an image or something else\r\nmimetype=$(file --mime-type -b \"$_arg_iconpath\" | grep \"image\" | sed 's\/image\\\/\/\/g')\r\nif [[ -z $mimetype ]]; then\r\n  _PRINT_HELP=no die \"FATAL ERROR: File was either not an image or does not exist!\" 1\r\nfi\r\n\r\n# Convert whatever we were given into a png (so we can later turn that into an icon file)\r\nif [[ ! $mimetype == \"png\" ]]; then\r\n  sips -s format png \"$_arg_iconpath\" --out \"$workingdir\/img.png\" &gt;\/dev\/null\r\n  rm \"$_arg_iconpath\"\r\nelse\r\n  mv \"$_arg_iconpath\" \"$workingdir\/img.png\"\r\nfi\r\n\r\n# Working folder for the iconset\r\nif [[ ! -d \"$workingdir\/$_arg_title.iconset\" ]]; then\r\n  mkdir \"$workingdir\/$_arg_title.iconset\"\r\nfi\r\n\r\n# If the file was successfully converted we'll turn it into an icon file\r\nfile=$workingdir\/img.png\r\nif [[ -f $file ]]; then\r\n  sips -z 16 16 \"${workingdir}\/img.png\" --out \"${workingdir}\/${_arg_title}.iconset\/icon_16x16.png\" &gt;\/dev\/null\r\n  sips -z 32 32 \"${workingdir}\/img.png\" --out \"${workingdir}\/${_arg_title}.iconset\/icon_16x16@2x.png\" &gt;\/dev\/null\r\n  sips -z 32 32 \"${workingdir}\/img.png\" --out \"${workingdir}\/${_arg_title}.iconset\/icon_32x32.png\" &gt;\/dev\/null\r\n  sips -z 64 64 \"${workingdir}\/img.png\" --out \"${workingdir}\/${_arg_title}.iconset\/icon_32x32@2x.png\" &gt;\/dev\/null\r\n  sips -z 128 128 \"${workingdir}\/img.png\" --out \"${workingdir}\/${_arg_title}.iconset\/icon_128x128.png\" &gt;\/dev\/null\r\n  sips -z 256 256 \"${workingdir}\/img.png\" --out \"${workingdir}\/${_arg_title}.iconset\/icon_128x128@2x.png\" &gt;\/dev\/null\r\n  sips -z 256 256 \"${workingdir}\/img.png\" --out \"${workingdir}\/${_arg_title}.iconset\/icon_256x256.png\" &gt;\/dev\/null\r\n  sips -z 512 512 \"${workingdir}\/img.png\" --out \"${workingdir}\/${_arg_title}.iconset\/icon_256x256@2x.png\" &gt;\/dev\/null\r\n  sips -z 512 512 \"${workingdir}\/img.png\" --out \"${workingdir}\/${_arg_title}.iconset\/icon_512x512.png\" &gt;\/dev\/null\r\n\r\n  rm \"$workingdir\/img.png\"\r\n\r\n  cd \"$workingdir\" &gt;\/dev\/null || _PRINT_HELP=no die \"FATAL ERROR: Unable to access $workingdir\" 1\r\n  iconutil -c icns \"$_arg_title.iconset\"\r\n  cd - &gt;\/dev\/null || _PRINT_HELP=no die \"FATAL ERROR: Unable to access previous working directory?\" 1\r\n\r\n  rm -R \"$workingdir\/$_arg_title.iconset\"\r\n  _arg_iconpath=$workingdir\/$_arg_title.icns\r\nelse\r\n  _PRINT_HELP=no die \"FATAL ERROR: Looks like the image failed to convert to a png?\" 1\r\nfi\r\n\r\n# If no button text was given these will be the defaults\r\nif [[ -z $_arg_buttonltext ]]; then\r\n  _arg_buttonltext=\"Ignore\"\r\nfi\r\n\r\nif [[ -z $_arg_buttonrtext ]]; then\r\n  _arg_buttonrtext=\"Accept\"\r\nfi\r\n\r\n# osascript actually creates the dialog box we'll need all the variables from earlier for that.\r\ndialog=\"$(\r\n  osascript - \"$_arg_message\" \"$_arg_title\" \"$_arg_iconpath\" \"$_arg_buttonltext\" \"$_arg_buttonrtext\" \"$_arg_timeout\" &lt;&lt;EOF\r\n  on run argv\r\n    display dialog item 1 of argv with title item 2 of argv \\\r\n    with icon POSIX file { item 3 of argv } \\\r\n    buttons { item 4 of argv , item 5 of argv } default button 2 \\\r\n    giving up after { item 6 of argv }\r\n  end run\r\nEOF\r\n)\"\r\n\r\n# These three if statements check what the response to the PopUp was and performs an action based on that if requested.\r\nif [[ $dialog == *\"gave up:true\" ]]; then\r\n  echo \"PopUp message timed out (the user ignored it).\"\r\n  if [[ -n $_arg_timeoutaction ]]; then\r\n    eval \"$_arg_timeoutaction\"\r\n  fi\r\n  exit 0\r\nfi\r\n\r\nif [[ $dialog == \"button returned:$_arg_buttonltext\"* ]]; then\r\n  echo \"$_arg_buttonltext Button Clicked!\"\r\n  if [[ -n $_arg_buttonlaction ]]; then\r\n    eval \"$_arg_buttonlaction\"\r\n  fi\r\n  exit 0\r\nfi\r\n\r\nif [[ $dialog == \"button returned:$_arg_buttonrtext\"* ]]; then\r\n  echo \"$_arg_buttonrtext Button Clicked!\"\r\n  if [[ -n $_arg_buttonraction ]]; then\r\n    eval \"$_arg_buttonraction\"\r\n  fi\r\n  exit 0\r\nfi\r\n\r\n_PRINT_HELP=no die \"FATAL ERROR: Did the PopUp display? Failed to check the dialog response.\" 1<\/pre>\n<p>&nbsp;<\/p>\n\n<div class=\"in-context-cta\"><p>Zugriff auf \u00fcber 300 Skripte im NinjaOne Dojo<\/p>\n<p><a href=\"https:\/\/www.ninjaone.com\/freetrialform\/\">Zugang erhalten<\/a><\/p>\n<\/div>\n<h2>Detaillierte Aufschl\u00fcsselung<\/h2>\n<p>Das Skript beginnt mit der Initialisierung von Standardwerten und der Analyse von Befehlszeilenargumenten, um verschiedene Elemente des Popup-Fensters anzupassen, z. B. den Titel, die Nachricht, die Schaltfl\u00e4chen und die mit diesen Schaltfl\u00e4chen verbundenen Aktionen. Parameter erm\u00f6glichen die Anpassung des Erscheinungsbildes und des Verhaltens des Popup-Fensters, z. B. die Festlegung eines Symbols, der Timeout-Dauer und der Aktionen, die bei Tastendruck oder Timeout ausgef\u00fchrt werden sollen.<\/p>\n<p>Eine der Funktionen des Skripts ist das Herunterladen und Einstellen eines benutzerdefinierten Symbols f\u00fcr das Popup, was seine Vielseitigkeit verdeutlicht. Dar\u00fcber hinaus werden verschiedene Szenarien behandelt, z. B. wenn ein Benutzer das Popup ignoriert oder eine der Schaltfl\u00e4chen dr\u00fcckt, wobei jeweils bestimmte Aktionen ausgel\u00f6st werden.<\/p>\n<p>Das Skript ist robust und pr\u00fcft auf Fehler wie die falsche Benennung von Schaltfl\u00e4chen oder ung\u00fcltige Timeout-Werte. Diese Sicherheitsvorkehrungen gew\u00e4hrleisten eine reibungslose Ausf\u00fchrung und verhindern h\u00e4ufige Fehler bei der Konfiguration.<\/p>\n<h2>M\u00f6gliche Anwendungsf\u00e4lle<\/h2>\n<p>Ein IT-Experte in einem Unternehmen k\u00f6nnte dieses Skript verwenden, um Mitarbeiter:innen daran zu erinnern, ihre Computer f\u00fcr Software-Updates neu zu starten. Die F\u00e4higkeit des Skripts, Neustarts zu planen und Optionen zum Aufschieben oder sofortigen Ausl\u00f6sen anzubieten, macht es ideal f\u00fcr die Aufrechterhaltung einer aktuellen und sicheren IT-Umgebung.<\/p>\n<h2>Vergleiche<\/h2>\n<p>In der Regel verlassen sich IT-Abteilungen bei solchen Aufgaben auf E-Mail-Benachrichtigungen oder manuelle Eingriffe. Dieses Skript bietet einen direkteren und benutzerfreundlicheren Ansatz, der eine Interaktion in Echtzeit und eine sofortige Einhaltung der Vorschriften erm\u00f6glicht, was sowohl die Effizienz als auch die Einhaltungsquote erh\u00f6ht.<\/p>\n<h2>FAQs<\/h2>\n<p><strong>F: L\u00e4sst sich das Skript leicht f\u00fcr verschiedene Szenarien anpassen? \u00a0<\/strong><br \/>\nA: Ja, die Parameter des Skripts sind so konzipiert, dass sie sich leicht an verschiedene Anwendungsf\u00e4lle anpassen lassen.<\/p>\n<p><strong>F: Kann das Skript Aktionen auf dem Rechner des Benutzers erzwingen? \u00a0<\/strong><br \/>\nA: Das Skript kann zwar zu Aktionen auffordern, ist aber auf die Interaktion des Benutzers angewiesen und respektiert dessen Kontrolle \u00fcber sein Ger\u00e4t.<\/p>\n<p><strong>F: Ist es mit allen macOS-Versionen kompatibel? \u00a0<\/strong><br \/>\nA: Es wurde f\u00fcr macOS entwickelt, aber es wird empfohlen, es mit den spezifischen Versionen in Ihrer Umgebung zu testen.<\/p>\n<h2>Auswirkungen<\/h2>\n<p>Dieses Skript verbessert zwar die IT-Verwaltung, wirft aber auch Bedenken hinsichtlich der Benutzerautonomie und des Datenschutzes auf. Es muss sichergestellt werden, dass sie transparent und ethisch einwandfrei verwendet werden.<\/p>\n<h2>Empfehlungen<\/h2>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\">Testen Sie das Skript vor dem Einsatz gr\u00fcndlich in einer kontrollierten Umgebung.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"2\" data-aria-level=\"1\">Kommunizieren Sie mit den Nutzern klar und deutlich \u00fcber den Zweck und die Funktion von Popups.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"3\" data-aria-level=\"1\">Nutzen Sie dieses Instrument verantwortungsbewusst und stellen Sie sicher, dass es mit den Unternehmensrichtlinien und ethischen Leitlinien \u00fcbereinstimmt.<\/li>\n<\/ul>\n<h2>Abschlie\u00dfende \u00dcberlegungen<\/h2>\n<p>Im Kontext von NinjaOne, einer Plattform, die f\u00fcr die <a href=\"https:\/\/www.ninjaone.com\/de\/rmm\/it-automatisierung\/\">Verbesserung der IT-Verwaltung<\/a> und -Sicherheit bekannt ist, f\u00fcgt sich dieses Skript nahtlos in die Ziele ein. Es stellt einen kleinen, aber bedeutenden Teil eines umfassenderen Toolkits dar, mit dem IT-Experten ihre Umgebungen effektiver verwalten k\u00f6nnen. Die Integration solcher anpassbaren Skripte in IT-Workflows kann die <a href=\"https:\/\/www.ninjaone.com\/de\/effizienz\/\">Effizienz und Reaktionsf\u00e4higkeit von IT-Systemen<\/a> erheblich steigern &#8211; ein Eckpfeiler des modernen IT-Managements, f\u00fcr den NinjaOne eintritt.<\/p>\n","protected":false},"author":35,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_relevanssi_hide_post":"","_relevanssi_hide_content":"","_relevanssi_pin_for_all":"","_relevanssi_pin_keywords":"","_relevanssi_unpin_keywords":"","_relevanssi_related_keywords":"","_relevanssi_related_include_ids":"","_relevanssi_related_exclude_ids":"","_relevanssi_related_no_append":"","_relevanssi_related_not_related":"","_relevanssi_related_posts":"","_relevanssi_noindex_reason":"","_lmt_disableupdate":"no","_lmt_disable":""},"operating_system":[4210],"use_cases":[4309],"class_list":["post-260962","script_hub","type-script_hub","status-publish","hentry","script_hub_category-macos"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/script_hub\/260962","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/script_hub"}],"about":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/types\/script_hub"}],"author":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/comments?post=260962"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/media?parent=260962"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/operating_system?post=260962"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/use_cases?post=260962"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}