Applescript Terminal Command Problem

Hilo
I am making an application that Alphabetizes words.
Everything works except that whenever I get to this part -
do shell script "cd ~/Public/Alphabetizer; ls -l *.pl; chmod +x Alphabetizer.pl; ./Alphabetizer.pl"
does anyone know why nothing happens, and if you do,
can you tell what to type to show what happens on terminal using applescript?
^_^ greatly appreciated

What do you expect to happen? That command does not involve Terminal at all. If you want to check the stdout from the shell commands, you could use the Results pane and/or the Event Log in Script Editor. Or redirect the output to a file.
If you want an actual Terminal window, you need to send the commands to Terminal, rather than directly to a shell. E.g.,
tell application "Terminal"
activate
do script "ls -l"
end tell
Note that that is the Terminal's +do script+ command, not AppleScript's +do shell script+ command.

Similar Messages

  • #30 | can i run the Terminal Command to stop Snapshots with no problems?

    i am somewhat surprised to find out that the 75 GB of "Backups" that are taking up space on my MBP may be due to some "feature" in Mavericks or the new OS's or whatever and i have had to MOVE all my data off my laptop as a consequence of this over the last two months because i have no more space on my Hard Drive.
    is it legit and OK to follow the terminal commands in #30 without having any problems?
    i am on a mid 2009 MBP running Mavericks and i have a 2 TB Time Capsule that i am wirelessly backing up my data.
    as some kind of sadistic test in advance of running this terminal command - can i plug my laptop into the Time Capsule, unplug the laptop from the time capsule, restart and see how much space got recaptured on my HD for my data?
    i mean, well - i must be missing something but i mean i am hoping i can get this to stop so i can get my data back on my laptop. i'm walking around with an external HD of all my Mac Pro information just so i can get work done when i go to a coffee shop or something.

    for those suffering through this:
    https://discussions.apple.com/message/24878591#24878591
    In Terminal:
         sudo tmutil disablelocal
    Turn off local Time Machine snapshots and trigger automatic cleanup of accumulated local snapshot data. Requires root privileges.
    (use sudo tmutil enablelocal to turn back on)
    this got rid of my 75 GB backup file (!!) and now i am going to move my data back to my laptop...
    not sure if there is an apple tech article to link to regarding this issue but it would be good to post if there is one.

  • Using Applescript to execute a Terminal command

    I've looked at the possible answers that come up when I ask this question here, but none really fit my question.
    I want to automate the Terminal command that cleans out obsolete entries in my right-click "Open with" menu, which I have to do often. Rather than copying the command each time I want it, then opening Terminal, pasting it in, etc., is there a way to automate this with Applescript?  Thanks!

    Thanks for the fast reply, Niel. I understand this is a newbie Applescript question, but over the years I have just never used Applescript and other than this one thing, probably won't again.  So rather than take hours to learn it, I hope you don't mind the additional question regarding this.  Do I just put the following into the main Applescript editor?
    do shell script "ls -l ~"
    /System/Library/Frameworks/CoreServices.framework//Versions/A/\
    Frameworks/LaunchServices.framework/Versions/A/Support/lsregister \
    -kill -r -domain local -domain user;
    killall Finder

  • Applescript: terminal unrar command

    Hey,
    I would like to know if it's possible to make an applescript of the following terminal command(s).
    cd
    unrar e -r -o- *.rar && find ./ -name “*.r*” -delete
    Also, I would like to know if it's possible to tweak the "unrar e -r -o- *.rar" command.
    Following situation:
    Main_folder\SubfolderA
    Main_folder\SubfolderB
    Main_folder\SubfolderC
    when I login in to terminal and use the command => unrar e -r -o- *.rar
    Everything from SubfolderA / SubfolderB & SubfolderC will be extracted in Main_folder
    Now my question is: Is there a command that will extract the "*.rar" in the same subfolder as where they are stored.
    Kind regards,
    Maxime

    Hi Frank,
    I try to unrar .rar files.
    I've managed to tweak my automator script:
    on run {input, parameters}
      tell application "Terminal"
      activate
      do script with command "cd /Volumes/****_storage/Downloads && unrar e -r -o- *.rar && find /Volumes/****_storage/Downloads -name *.r* -type f -delete"
      end eend tell
    eenend run
    The the subfolder remains an issue.

  • Applescript to run terminal command then open application..

    Hey,
    I've installed the add-on to make the Lion Finder sidebar icons colored again, but whenever I reboot my Mac, I have to execute a killall Finder to get those icons back. This also closes TotalFinder, which is an addon I use. So, I want to write an AppleScript which will run on startup, and do those two things: run the Terminal command, and then open TotalFinder.
    I've written:
    tell application "Terminal"
        activate
        do script "killall Finder" in front window
        quit
    end tell
    tell application "TotalFinder"
        activate
    end tell
    This gives me an error stating "Connection is invalid." when running the activate line for TotalFinder. The Terminal command is executed correctly. Any idea why this is? The application is definitely named correctly, its just in my root Applications directory so it should be able to find it, etc. How can I get this working?
    Thanks!

    try this:
    do shell script "killall Finder"
    tell application "TotalFinder"
              try
      activate
              end try
    end tell
    First thing you don't need to open a terminal window to do the killall you can just do to as a shell script.
    Second don't know why TotalFinder gives that message about Connection invalid but it doesn;t seem to affect it any. So putting in the try just eats the error message.
    Ypu may not even need the killall, When TotalFinder starts it restarts the Finder so you may be able to remove the killall
    regards

  • Terminal Commands for Internet Connect VPN?

    I could maybe do this as an applescript but I'm hoping there are terminal commands which I can incorporate into an rsync script...
    I need to open a PPTP VPN connection on a computer (Internet Connect VPN client, 10.4.8) , to connect to VPN services on OS X Server (10.4.8). The configuration works fine but really needs manual intervention at times. I would like to just script the equivalent of hitting the 'connect' button, so this can be run by cron.
    Any ideas or links?
    Ta.
    -david

    I did repair permissions with disk Utility and I used Onyx to delete the various caches, but that didn't work.
    Everything is functioning. The problem isn't on the VPN server side, because I can log into the VPN on my Powerbook and the status shows correctly. There's definitely something going on with my G5.
    This isn't a really huge deal, but it would be nice if the status indicated that I'm connected when I'm connected.

  • Terminal Command to Re-Mount an Unmounted Local Disk Partition?

    Hello,
    Does anyone know a terminal command (or applescript command) to re-mount an unmounted local disk partition? I know it can be done using the DiskUtility, but I would like to do it from the Terminal without launching another program.
    Using Tiger 10.4.5 on a G5
    Thanks,
    Tom
    G5 2.3 MHz dual core   Mac OS X (10.4.5)  

    Hi Tom,
       AppleScript will execute anything that you can exectute from the command line that isn't interactive but it won't execute it in the same way. By that I mean that the environment will be more vanilla. In this case the problem is that the path is rather basic. All you have to do is to use an absolute path to the script and it should work. Apple has a pretty good reference for the mechanism, Technical Note TN2065: do shell script in AppleScript.
       Is wakeonlan basically the same thing as waking upon receipt of a "magic packet"? I think you can easily make Mac OS X do that by itself. Just open System Preferences and the "Options" tab of the "Energy Saver" pane. Check the checkbox beside "Wake for Ethernet network administrator access".
    Gary
    ~~~~
       I gave my love an Apple, that had no core;
       I gave my love a building, that had no floor;
       I wrote my love a program, that had no end;
       I gave my love an upgrade, with no cryin'.
       How can there be an Apple, that has no core?
       How can there be a building, that has no floor?
       How can there be a program, that has no end?
       How can there be an upgrade, with no cryin'?
       An Apple's MOS memory don't use no core!
       A building that's perfect, it has no flaw!
       A program with GOTOs, it has no end!
       I lied about the upgrade, with no cryin'!

  • What are the terminal commands to list all plugins, extensions, etc?

    I remember a while ago reading a thread on diagnosing kernel panics and such, where someone listed a number of commands (I think there were four separate terminal commands) which produced lists of plugins, daemons, background enhancers, extensions etc which could sap resources or drive up temperature without necessarily showing up in activity monitor or anything like that.
    Anyone know what these commands are? I'm having some serious overheating problems at the moment when doing nothing but for instance watching a youtube video with no other processes running so I'd like to get these dumps and see if there's anything installed which could be causing trouble.

    Check this out : http://helpx.adobe.com/story/help/keyboard-shortcuts.html

  • Terminal command to refresh USB peripheral device

    I'm running OS 10.7.5, and I have a recurring problem with the USB ports on my Mac mini.  After several days of up-time, one or more of the ports will sometimes become non-responsive.  This seems to be software related, because logging off and logging back into the machine always fixes the problem (as does a restart and a cold-reboot).  I was thinking maybe the "checklist" of device filenames somehow gets corrupted over time, and needs to be recreated.
    Does anyone know how to refresh the list of peripheral devices without restarting, rebooting, or logging off?  Ideally a terminal command?  I'm hoping not to have to keep shutting down the session each time this happens to get my list of connected devices back.
    Thanks very much for your suggestions for the newbie.

    Hi Korby,
    If you are having difficulties with USB devices such as you describe, I would suggest resetting your Mac mini’s parameter RAM, as described in this article -
    About NVRAM and PRAM
    http://support.apple.com/kb/HT1379
    Specifically -
    Resetting NVRAM / PRAM
    Shut down your Mac.
    Locate the following keys on the keyboard: Command (⌘), Option, P, and R. You will need to hold these keys down simultaneously in step 4.
    Turn on the computer.
    Press and hold the Command-Option-P-R keys before the gray screen appears.
    Hold the keys down until the computer restarts and you hear the startup sound for the second time.
    Release the keys.
    Thanks for using Apple Support Communities.
    Best,
    Brett L

  • How to make Apple Script do a terminal command

    Hey,
    I am wondering how can I make an AppleScript do the following command :
    "networksetup -setdnsservers Wi-Fi 8.8.8.8 8.8.4.4"
    Please mention step by step since I'm new to AppleScript
    Best Regards,
    Nadav.

    To run a terminal command it is usually sufficient to use do shell script. So for your command it would be
    do shell script "networksetup -setdnsservers Wi-Fi 8.8.8.8 8.8.4.4"
    note if the command requires administrator privileges you would need to do
    do shell script "command"  with administrator privileges
    will prompt for the password when the script is run.
    do shell script "command" user name "me" password "mypassword" with administrator privileges
    will store the password and username in the script. More convenient but much less secure.
    See do shell script in AppleScript

  • Terminal Command, how to set defaults write, make application(s) use directory path where file last saved?

    Does anyone know whether there's a terminal command to make all applications remember/use the last directory/path where I last saved a file?
    For example, let's say there are (10) ten PDF's on a website, and I want to use Preview.app to open and save each file to the same directory.
    Problem is, after each time I save a file, Preview.app doesn't automatically remember/use the last directory where I saved my file(s).
    Forcing me to navigate back to the same directory after each time I save a file; super-annoying.
    But, for some reason, when saving images from the web, Firefox remembers the last directory where I saved the file (jpeg).
    So I'm hoping there's some way, possibly a terminal command to set/force all applications (including Preview.app) to remember/use the directory/path where file(s) were last-saved.
    Anyone?

    Get the third-party utility Default Folder X 4.4.9.

  • Terminal command to lock and unlock the dock?

    Hello,
    I manage hundreds of iMacs running Yosemite at a school site.  I use parental controls with the lock dock feature turned on.  I would like to periodically unlock the dock to customize it with new icons, but have not found a terminal command that works, or a streamlined process that is time efficient.
    So far I have been individually unlocking the dock in parent controls on each machine, restarting, editing the dock, then re-locking it parental controls, then restarting.  This takes 5-10 minutes per machine). 
    I also tried this command but it didn't work.
    defaults write com.apple.dock contents-immutable -bool true; killall Dock;
    I also tried cloning the parental controls with an exported plist file to all the machines using ARD, which works for all the parental control settings EXCEPT for the lock dock feature.
    Any ideas?
    Cheers,
    Crystal

    Sorry this is probably too late for you, but it may help others seeking this answer, I just had this problem [Mac OS x Yosemite 10.10.2] and found that the following worked for me:
    1. Use Terminal to LOCK the Dock by C&P or typing in:
    defaults write com.apple.dock contents-immutable -bool true
    Then use your preferred method to Log-Out [e.g. Key Combo ⇧⌘Q or  [Top Left Menu] then select Log Out “name”]
    and then Log-In again.
    2. Use Terminal to UNLOCK the Dock by C&P or typing in:
    defaults write com.apple.dock contents-immutable -bool false
    Then use your preferred method to Log-Out [e.g. Key Combo ⇧⌘Q or  [Top Left Menu] then select Log Out “name”]
    and then Log-In again.
    NB. You will be solely responsible for your actions making changes to the Operating System.

  • Strange terminal command caching while manually running SWUPD.

    I've built dozens of software update servers with little issues. This one has me stumped today.
    I built a software update server to update solely our Tiger machines. Initially, I had sent a command to the clients that hit the wrong IP address. Once I realized the mistake, I overwrote the plist files on them to reflect the correct address.
    Problem is, some of those machines, even tho I have thrown out the plist completely, still seem to be trying to update with the wrong address. I have verified 100 times that the plist is correct. And if I do a softwareupdate -l, it hits the correct address. When I send a softwareupdate -i -a, it gives me this error:
    2010-06-29 13:50:50.606 softwareupdate[728] Loading CatalogURL 10.192.170.11:8088
    2010-06-29 13:50:50.625 softwareupdate[728] loader:didFailWithError:NSError "unsupported URL" Domain=NSURLErrorDomain Code=-1002 UserInfo={
    NSErrorFailingURLKey = 10.192.170.11:8088;
    NSErrorFailingURLStringKey = "10.192.170.11:8088";
    NSLocalizedDescription = "unsupported URL";
    Error: unsupported URL
    Software Update Tool
    The IP address it's reflecting is the original bad address. I'm thinking this has to be cached somewhere, but I've tried it via ARD on fresh machines that had never tried to push any of these commands, and I get the same thing.
    I verified that this happens locally in the terminal and via ARD. But if you manually run the software update from the GUI, it goes to the right place and updates fine.

    No, this is a Tiger server, updating Tiger clients. We literally update the plist via command line or ARD, and then run the softwareupdate -i -a command.
    I have deleted all profile softwareupdate plists via root. It worked on one machine, but not the others. What's odd is that even if i run the software update command locally in the terminal, I still get this error, but if I run it from the Apple menu, it hits the right server and works just fine. So the plist is correct. So I'm wondering what's the difference between where the GUI grabs the address from, and where the terminal command gets it.

  • I didn't find configure terminal command in the ios of aironet 1131AG

    Dear All
    i bought cisco aironet 1131AG yesterday. when the AP get IP from DHCP and trying to access it by internet browser, the web page is empty so i tried to access AP by console and login in to the privileged mode but i did't find the configure terminal command to enter the config mode.
    what is the problem !!!???
    is the IOS version problem?
    the details of show version command :
    Cisco IOS Software, C1130 Software (C1130-RCVK9W8-M), Version 12.3(11)JX1, RELEASE SOFTWARE (fc1)
    Technical Support: http://www.cisco.com/techsupport
    Copyright (c) 1986-2006 by Cisco Systems, Inc.
    Compiled Mon 17-Jul-06 11:38 by alnguyen
    ROM: Bootstrap program is C1130 boot loader
    BOOTLDR: C1130 Boot Loader (C1130-BOOT-M) Version 12.3(8)JEA, RELEASE SOFTWARE (fc2)
    AP001e.7abd.dca6 uptime is 3 hours, 9 minutes
    System returned to ROM by power-on
    System image file is "flash:/c1130-rcvk9w8-mx/c1130-rcvk9w8-mx"
    cisco AIR-LAP1131AG-A-K9   (PowerPCElvis) processor (revision A0) with 24566K/8192K bytes of memory.
    Processor board ID FOC12072A3U
    PowerPCElvis CPU at 262Mhz, revision number 0x0950
    Last reset from power-on
    LWAPP image version 3.0.51.0
    1 FastEthernet interface
    32K bytes of flash-simulated non-volatile configuration memory.
    Base ethernet MAC Address: 00:1E:7A:BD:DC:A6
    Part Number                          : 73-8962-12
    PCA Assembly Number                  : 800-24818-11
    PCA Revision Number                  : B0
    PCB Serial Number                    : FOC12072A3U
    Top Assembly Part Number             : 800-29144-02
    Top Assembly Serial Number           : FOC12072A3U
    Top Revision Number                  : A0
    Product/Model Number                 : AIR-LAP1131AG-A-K9
    Configuration register is 0xF

    Hi,
    The APs image is LWAPP and to access the config t command we need to convert the IOS to Autonomous.. here is the step by step procedure that we need to follow to get the issue resolved..
    C1130 Software (C1130-RCVK9W8-M)
    I request you to do download any image from the below link and perform the conversion from LWAPP image to autonomous..
    http://www.cisco.com/cisco/software/release.html?mdfid=279537722&flowid=6775&softwareid=280805680&release=12.4.25d-JA&rellifecycle=ED&relind=AVAILABLE&reltype=latest
    the method to convert is..
    download TFTPd32 from google and install it on ur PC.. point the image that you have downloaded in the TFTP server..
    connect  a ethernet cable between ur laptop and AP.. both should be in the same  subnet.. and connect a console cable and get the hyperterminal console  access and issue the command..
    AP>en
    AP#debug lwapp console cli or debug capwap console cli
    AP#config t
    AP(confg)int fa 0
    AP(confg-if)ip addr (same subnet as that of the laptop)
    AP(confg-if)end
    AP#archieve download-sw /force-reload /overwrite tftp:///
    eg-
    Assuming tftp ip address is 10.0.0.1 and the image is c1130-k9w7-tar.124-25d.JA.tar, then..
    AP#archieve download-sw /force-reload /overwrite tftp://10.0.0.1/c1130-k9w7-tar.124-25d.JA.tar
    The AP will reload and it will come up with IOS image and you will be able to enter the config mode
    lemme know if this answered your question..
    Regards
    Surendra
    ====
    Please dont forget to rate the posts which answered your question and mark it as answered or was helpfull

  • Is there a terminal command that will close quicktime player once a video is finished?

    I'm running a python program that uses subprocess.call(['open', '-a', "Quicktime Player", filename]) to open a video and defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen 1 starts it automatically. I'm wondering if there's a terminal way or a python way to close the video once it's finished.

    Hi, Thanks for the reply, I appreciate it.
    What do you mean by "pick up"?
    I mean to show what the DNS numbers are that the router is using.
    They are not entered in the DNS server field in Networks, TCP/IP tab.
    If you mean refresh the client settings, the DNS settings are obtained as part of the DHCP lease (or PPP connection in the case of PPP).
    The user/ OP is actually using PPPoA, when i googled PPPoA.. seems he is using Cisco perhaps.
    http://en.wikipedia.org/wiki/Point-to-PointProtocol_overATM (Asynchronous Transfer Mode)
    "PPPOA or PPPoA, Point-to-Point Protocol (PPP) over ATM, is a network protocol for encapsulating PPP frames in ATM AAL5. It is used mainly with cable modem, DSL and ADSL services.
    It offers standard PPP features such as authentication, encryption, and compression. If it is used as the connection encapsulation method on an ATM based network it can reduce overhead slightly (around 0.58%) in comparison to PPPoE".
    Essentially the original poster removed the OpenDNS #s from his DNS server field in the TCP/IP tab (b/c they seem to make Adobe.com inaccessible to him)
    removing them & allowing his router to "pick them up from the ISP" seems to solved his problem.
    However he can not, find what the numbers are that are being utilized,
    b/c they are not entered as usual in the Network, & part of the DHCP lease,
    or in Airport admin Utility.
    I/ we wondered, if there was a Terminal command that will show what the
    numbers are that are being used .
    Does that help clarify what I mean? Sorry to be so long winded.
    Eme '~[ )♥♪

Maybe you are looking for

  • Flex 3 Beta 2 Debugger Crash

    Hello, I'm seeing a possible memory leak within ImageSnapshot.captureImage() and also a debugger crash depending on the dpi that I pass to that function. This occurs while iterating over the children of a canvas, creating an ImageSnapshot, and writin

  • Asset issue in as91

    Dear Sapgurus, while uploading the asset masters through as91 system it is showing error message 30 Consolidated balance sheet in local currency Line item causes scrap value of 0,00 to be violated Message no. AA632 Asset affected: INTERN-00001-0000 D

  • No goods-receipt-based invoice verification

    I need some guidance on a new process. We are a north american company. 1- We create a PO to China and we unchecked the GR based IV flag 2- we send it... 3- When the stock is delivered to the China Port, we receive the invoice from the vendor and pay

  • Issue with multiple files merging into 1

    I'm trying to write some code that will read the contents of multiple files in a directory then output it into a single file. However when I try to open the files via a for loop it does not recognise the variable I have assigned for the filename: Fil

  • HU and SU number range

    Hello, If storage location is HU and WM managed ( SU management active), is it required that for the number range of  HU simialr overlapping number range has to be maintained for SU (assigned to the warehouse)?