Do Shell Script with Admin Privileges Custom IconApplescript with optional administrator privilegesOS X: equivalent of Linux's wgetCalling applescript from shell script using admin previlegesHow to “do shell script with administrator privileges” as a regular user and not as root?Call a Python script from a ApplescriptRunning a shell script through AppleScriptHow do I run a shell script with administrator privileges through AppleScript without prompting for a password?Applescript administrator privledges but *not* running a shell scriptIs there a way to enter a response for a shell script in AppleScript?osx - Permission denied (126) using AppleScript with Administrator Privileges

Do I have to know the General Relativity theory to understand the concept of inertial frame?

Typing CO_2 easily

Language involving irrational number is not a CFL

Sigmoid with a slope but no asymptotes?

El Dorado Word Puzzle II: Videogame Edition

Why is the Sun approximated as a black body at ~ 5800 K?

Deciphering cause of death?

Given this phrasing in the lease, when should I pay my rent?

Why would five hundred and five be same as one?

Is there a reason to prefer HFS+ over APFS for disk images in High Sierra and/or Mojave?

Difference between shutdown options

Has the laser at Magurele, Romania reached a tenth of the Sun's power?

How do I fix the group tension caused by my character stealing and possibly killing without provocation?

I'm just a whisper. Who am I?

ContourPlot — How do I color by contour curvature?

Isometric embedding of a genus g surface

Should I warn a new PhD Student?

Ways of geometrical multiplication

Check if object is null and return null

What's the name of the logical fallacy where a debater extends a statement far beyond the original statement to make it true?

Unable to disable Microsoft Store in domain environment

Is there a RAID 0 Equivalent for RAM?

How to preserve electronics (computers, iPads and phones) for hundreds of years

What should be the ideal length of sentences in a blog post for ease of reading?



Do Shell Script with Admin Privileges Custom Icon


Applescript with optional administrator privilegesOS X: equivalent of Linux's wgetCalling applescript from shell script using admin previlegesHow to “do shell script with administrator privileges” as a regular user and not as root?Call a Python script from a ApplescriptRunning a shell script through AppleScriptHow do I run a shell script with administrator privileges through AppleScript without prompting for a password?Applescript administrator privledges but *not* running a shell scriptIs there a way to enter a response for a shell script in AppleScript?osx - Permission denied (126) using AppleScript with Administrator Privileges













0















I am using AppleScript to run a shell script as admin.



do shell script custom_command with prompt custom_prompt with administrator privileges


which gives me this prompt that is fine, but I would like to be able to change the icon to something other than a terminal icon. Any help would be appreciated.



prompt










share|improve this question






















  • The badge icon comes from whatever application is using the command.

    – red_menace
    Mar 7 at 3:03











  • @red_menace I am using osascript -e is there no way to change it?

    – Aidan H
    Mar 7 at 3:06











  • No, the shell is what is ultimately running the script, so that is the icon the system uses. You can call a helper app that does the shell script, but that seems like a bit of a runaround.

    – red_menace
    Mar 7 at 3:16











  • @red_menace I would actually be interested in this. How would I do this?

    – Aidan H
    Mar 7 at 17:40















0















I am using AppleScript to run a shell script as admin.



do shell script custom_command with prompt custom_prompt with administrator privileges


which gives me this prompt that is fine, but I would like to be able to change the icon to something other than a terminal icon. Any help would be appreciated.



prompt










share|improve this question






















  • The badge icon comes from whatever application is using the command.

    – red_menace
    Mar 7 at 3:03











  • @red_menace I am using osascript -e is there no way to change it?

    – Aidan H
    Mar 7 at 3:06











  • No, the shell is what is ultimately running the script, so that is the icon the system uses. You can call a helper app that does the shell script, but that seems like a bit of a runaround.

    – red_menace
    Mar 7 at 3:16











  • @red_menace I would actually be interested in this. How would I do this?

    – Aidan H
    Mar 7 at 17:40













0












0








0


1






I am using AppleScript to run a shell script as admin.



do shell script custom_command with prompt custom_prompt with administrator privileges


which gives me this prompt that is fine, but I would like to be able to change the icon to something other than a terminal icon. Any help would be appreciated.



prompt










share|improve this question














I am using AppleScript to run a shell script as admin.



do shell script custom_command with prompt custom_prompt with administrator privileges


which gives me this prompt that is fine, but I would like to be able to change the icon to something other than a terminal icon. Any help would be appreciated.



prompt







macos applescript






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 2:38









Aidan HAidan H

627




627












  • The badge icon comes from whatever application is using the command.

    – red_menace
    Mar 7 at 3:03











  • @red_menace I am using osascript -e is there no way to change it?

    – Aidan H
    Mar 7 at 3:06











  • No, the shell is what is ultimately running the script, so that is the icon the system uses. You can call a helper app that does the shell script, but that seems like a bit of a runaround.

    – red_menace
    Mar 7 at 3:16











  • @red_menace I would actually be interested in this. How would I do this?

    – Aidan H
    Mar 7 at 17:40

















  • The badge icon comes from whatever application is using the command.

    – red_menace
    Mar 7 at 3:03











  • @red_menace I am using osascript -e is there no way to change it?

    – Aidan H
    Mar 7 at 3:06











  • No, the shell is what is ultimately running the script, so that is the icon the system uses. You can call a helper app that does the shell script, but that seems like a bit of a runaround.

    – red_menace
    Mar 7 at 3:16











  • @red_menace I would actually be interested in this. How would I do this?

    – Aidan H
    Mar 7 at 17:40
















The badge icon comes from whatever application is using the command.

– red_menace
Mar 7 at 3:03





The badge icon comes from whatever application is using the command.

– red_menace
Mar 7 at 3:03













@red_menace I am using osascript -e is there no way to change it?

– Aidan H
Mar 7 at 3:06





@red_menace I am using osascript -e is there no way to change it?

– Aidan H
Mar 7 at 3:06













No, the shell is what is ultimately running the script, so that is the icon the system uses. You can call a helper app that does the shell script, but that seems like a bit of a runaround.

– red_menace
Mar 7 at 3:16





No, the shell is what is ultimately running the script, so that is the icon the system uses. You can call a helper app that does the shell script, but that seems like a bit of a runaround.

– red_menace
Mar 7 at 3:16













@red_menace I would actually be interested in this. How would I do this?

– Aidan H
Mar 7 at 17:40





@red_menace I would actually be interested in this. How would I do this?

– Aidan H
Mar 7 at 17:40












1 Answer
1






active

oldest

votes


















1














The badge on the authentication dialog comes from the application that is using the command.



To get a custom badge for the icon you can use a helper AppleScript application to run your script, but if the osascript is all you are doing, you can just do everything by using the app (otherwise all you are doing is using an osascript to run an AppleScript that runs an osascript). To create an application for the osascript, edit your script in the Script Editor, for example:



do shell script "echo 'this is a test' >> ~/Desktop/Testing.txt" with administrator privileges


then save it as an application (leave the options unchecked). Rename a copy of the icon file you want to use to applet.icns, open the app bundle, and replace the existing icon file in /Contents/Resources/. You can then run the application from the Terminal by using open /path/to/your/app



The main icon will still be the padlock, but the badge will now be your application icon.



To pass arguments to an application is a little different than an osascript, but a little bit of AppleScriptObjC takes care of that:



use framework "Foundation"
use scripting additions

# the first argument item is the applet/droplet executable path, so we'll just skip that
set args to rest of (arguments of current application's NSProcessInfo's processInfo() as list)

if args is not then
do shell script "echo " & first item of args & " >> ~/Desktop/Testing.txt" with administrator privileges
end if


You can run that by using open /path/to/your/app --args “this is a test”






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55035195%2fdo-shell-script-with-admin-privileges-custom-icon%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    The badge on the authentication dialog comes from the application that is using the command.



    To get a custom badge for the icon you can use a helper AppleScript application to run your script, but if the osascript is all you are doing, you can just do everything by using the app (otherwise all you are doing is using an osascript to run an AppleScript that runs an osascript). To create an application for the osascript, edit your script in the Script Editor, for example:



    do shell script "echo 'this is a test' >> ~/Desktop/Testing.txt" with administrator privileges


    then save it as an application (leave the options unchecked). Rename a copy of the icon file you want to use to applet.icns, open the app bundle, and replace the existing icon file in /Contents/Resources/. You can then run the application from the Terminal by using open /path/to/your/app



    The main icon will still be the padlock, but the badge will now be your application icon.



    To pass arguments to an application is a little different than an osascript, but a little bit of AppleScriptObjC takes care of that:



    use framework "Foundation"
    use scripting additions

    # the first argument item is the applet/droplet executable path, so we'll just skip that
    set args to rest of (arguments of current application's NSProcessInfo's processInfo() as list)

    if args is not then
    do shell script "echo " & first item of args & " >> ~/Desktop/Testing.txt" with administrator privileges
    end if


    You can run that by using open /path/to/your/app --args “this is a test”






    share|improve this answer





























      1














      The badge on the authentication dialog comes from the application that is using the command.



      To get a custom badge for the icon you can use a helper AppleScript application to run your script, but if the osascript is all you are doing, you can just do everything by using the app (otherwise all you are doing is using an osascript to run an AppleScript that runs an osascript). To create an application for the osascript, edit your script in the Script Editor, for example:



      do shell script "echo 'this is a test' >> ~/Desktop/Testing.txt" with administrator privileges


      then save it as an application (leave the options unchecked). Rename a copy of the icon file you want to use to applet.icns, open the app bundle, and replace the existing icon file in /Contents/Resources/. You can then run the application from the Terminal by using open /path/to/your/app



      The main icon will still be the padlock, but the badge will now be your application icon.



      To pass arguments to an application is a little different than an osascript, but a little bit of AppleScriptObjC takes care of that:



      use framework "Foundation"
      use scripting additions

      # the first argument item is the applet/droplet executable path, so we'll just skip that
      set args to rest of (arguments of current application's NSProcessInfo's processInfo() as list)

      if args is not then
      do shell script "echo " & first item of args & " >> ~/Desktop/Testing.txt" with administrator privileges
      end if


      You can run that by using open /path/to/your/app --args “this is a test”






      share|improve this answer



























        1












        1








        1







        The badge on the authentication dialog comes from the application that is using the command.



        To get a custom badge for the icon you can use a helper AppleScript application to run your script, but if the osascript is all you are doing, you can just do everything by using the app (otherwise all you are doing is using an osascript to run an AppleScript that runs an osascript). To create an application for the osascript, edit your script in the Script Editor, for example:



        do shell script "echo 'this is a test' >> ~/Desktop/Testing.txt" with administrator privileges


        then save it as an application (leave the options unchecked). Rename a copy of the icon file you want to use to applet.icns, open the app bundle, and replace the existing icon file in /Contents/Resources/. You can then run the application from the Terminal by using open /path/to/your/app



        The main icon will still be the padlock, but the badge will now be your application icon.



        To pass arguments to an application is a little different than an osascript, but a little bit of AppleScriptObjC takes care of that:



        use framework "Foundation"
        use scripting additions

        # the first argument item is the applet/droplet executable path, so we'll just skip that
        set args to rest of (arguments of current application's NSProcessInfo's processInfo() as list)

        if args is not then
        do shell script "echo " & first item of args & " >> ~/Desktop/Testing.txt" with administrator privileges
        end if


        You can run that by using open /path/to/your/app --args “this is a test”






        share|improve this answer















        The badge on the authentication dialog comes from the application that is using the command.



        To get a custom badge for the icon you can use a helper AppleScript application to run your script, but if the osascript is all you are doing, you can just do everything by using the app (otherwise all you are doing is using an osascript to run an AppleScript that runs an osascript). To create an application for the osascript, edit your script in the Script Editor, for example:



        do shell script "echo 'this is a test' >> ~/Desktop/Testing.txt" with administrator privileges


        then save it as an application (leave the options unchecked). Rename a copy of the icon file you want to use to applet.icns, open the app bundle, and replace the existing icon file in /Contents/Resources/. You can then run the application from the Terminal by using open /path/to/your/app



        The main icon will still be the padlock, but the badge will now be your application icon.



        To pass arguments to an application is a little different than an osascript, but a little bit of AppleScriptObjC takes care of that:



        use framework "Foundation"
        use scripting additions

        # the first argument item is the applet/droplet executable path, so we'll just skip that
        set args to rest of (arguments of current application's NSProcessInfo's processInfo() as list)

        if args is not then
        do shell script "echo " & first item of args & " >> ~/Desktop/Testing.txt" with administrator privileges
        end if


        You can run that by using open /path/to/your/app --args “this is a test”







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 9 at 22:46









        Aidan H

        627




        627










        answered Mar 7 at 23:00









        red_menacered_menace

        39529




        39529





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55035195%2fdo-shell-script-with-admin-privileges-custom-icon%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

            Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

            Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved