Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 27, 2012, 02:34 PM   #1
bjbyers
macrumors newbie
 
Join Date: Apr 2006
Very basic Applescript to run command

I am trying to write a simple ApplesSript to run a command in terminal which is needed a workaround for an incompatibility problem with a certain Imation storage drive and Mac's running 10.8.2.

I would like the script to do the following
1. Launch Terminal
2. Type the following command "sudo chmod +r /dev/rdisk*"
3. Wait for the user to enter their password which will be required.
4. If possible close after the password is entered or if that is too complicated just leave terminal open and the user can close it themselves.

I have no experience with AppleScript (obviously based on my question), but based on postings online I thought the following would work but it does not.

tell application "Terminal"
activate
do script "sudo chmod +r /dev/rdisk*"
delay 1
end tell


Can someone assist me with this please? Thank you.
bjbyers is offline   0 Reply With Quote
Old Nov 27, 2012, 03:03 PM   #2
Kasalic
macrumors regular
 
Join Date: Jan 2011
Quote:
Originally Posted by bjbyers View Post
I am trying to write a simple ApplesSript to run a command in terminal which is needed a workaround for an incompatibility problem with a certain Imation storage drive and Mac's running 10.8.2.

I would like the script to do the following
1. Launch Terminal
2. Type the following command "sudo chmod +r /dev/rdisk*"
3. Wait for the user to enter their password which will be required.
4. If possible close after the password is entered or if that is too complicated just leave terminal open and the user can close it themselves.

I have no experience with AppleScript (obviously based on my question), but based on postings online I thought the following would work but it does not.

tell application "Terminal"
activate
do script "sudo chmod +r /dev/rdisk*"
delay 1
end tell


Can someone assist me with this please? Thank you.
Download Textwrangler from http://www.barebones.com/products/te.../download.html

Put the first line as #!/bin/bash
Then put the second line as your command (sudo chmod +r /dev/rdisk*)

Save the command as whatever you want, but make sure you add the .command extension.

You will then need to go into Terminal and make the file executable by typing chmod -x /path/to/file

You should then be able to run the command by double clicking the file.

*EDIT* Not sure if you need to make the file executable when you use Textwrangler, the file I created didn't need to be.

Last edited by Kasalic; Nov 27, 2012 at 03:13 PM.
Kasalic is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Run Basic Command-line Java Programs in Sandvox jblagden Mac Applications and Mac App Store 0 Oct 2, 2013 02:23 PM
Terminal run on startup command Zogw Mac Applications and Mac App Store 7 Jan 26, 2013 10:24 AM
Very Basic AppleScript Question TheMTtakeover Mac Programming 2 Dec 13, 2012 04:45 AM
Run Terminal Command as root on Startup evilblob OS X 10.8 Mountain Lion 1 Aug 2, 2012 01:25 AM
applescript prompts to run Zeke D Mac Programming 4 Jul 23, 2012 09:50 PM

Forum Jump

All times are GMT -5. The time now is 07:33 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC