Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6175111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:52:06+00:00 2026-05-23T23:52:06+00:00

My Applescript and Python script are in the present working directory. Now I need

  • 0

My Applescript and Python script are in the present working directory.
Now I need to call the Python script named test.py with admin privileges from the applescript using shell commands.

This code in Applescript gives the pwd

tell application "Finder" to get folder of (path to me) as Unicode text
set presentDir to POSIX path of result

This code in Applescript calls a python script from an Applescript manually

do shell script "/Users/mymac/Documents/'Microsoft User Data'/test.py"

How to add the presentDir to this command along with Admin privileges?

EDIT and UPDATE:

set py to "test.py "
set calldir to workingDir & py
do shell script calldir

It gives an error

error "sh: /Users/mymac/Documents/Microsoft: No such file or directory" number 127

But
display dialog calldir
shows

/Users/mymac/Documents/Microsoft User Data/test.py

Reason:

it gets breaked up after the word ‘Microsoft’ in shell script command because of space.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:52:06+00:00Added an answer on May 23, 2026 at 11:52 pm

    If you know the script is in the same directory, just use:

    do shell script presentDir & "test.py " user name "me" password "mypassword" with administrator privileges
    

    Notice the space after test.py before the close-quote. You may possibly need the string to be /test.py, rather than test.py, I’m not sure.

    I got this info from http://developer.apple.com/library/mac/#technotes/tn2065/_index.html.

    Edit: Try

    set py to "test.py "
    set calldir to quoted form of workingDir & py
    do shell script calldir
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to run an AppleScript from within a Python script? The questions says it
I'm currently using AppleScript to clean up an Xcode project. I'd like my script
I need to invoke a keyboard shortcut from within an AppleScript code, e.g. Cmd+Ctrl+Opt+E.
I'm using Applescript to automate deployment of applications from Xcode 4. I use System
How would I quit all running user applications using Applescript?
I would like to adjust the system audio volume in OSX from a python
I am using this jquery ui autocomplete but i need to grab the data
I'm trying to applescript XCode into building and launching on device. My script is
I need t parse xml for an applescript project and i got a start
How do I make a new document in TextMate using rb-appscript or AppleScript? Here

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.