Need an Applescript for...

I need an Applescript for turning off my computer after it has been idle for 2hrs. Please and Thank you

See this post. http://macscripter.net/viewtopic.php?pid=68885

Similar Messages

  • Help Needed: Automator Applescript for Folder Action - Encode Video

    Hi !
    I have created an Automator Applescript for a Folder Action to do the following:
    When a new video file is moved to the target folder (i.e. Download of Vuze is done), automatically launch the Applescript Action that does the followin g(Applescripted):
    1) Using "run shell script" and FFMPEG on a UNIX command line, determine Width/Height, Framerate, Bitrate
    2) Calculate encoding parameters (slightly reduced bitrate, reduced Aspect etc.)
    3) Using "run shell script" with ffmpeg on the command line and the calculated parameters to encode the video file
    At the same time, the action is written to a log file so I know if a file is recognized, when encoding started etc.
    It works fine if I save this Action as an .app, make an alias on the Desktop and drop video files on it.
    It also works fine if I attach the script to a folder as a folder action and drag a video file in there.
    However, when I attach the script as a folder action to the Vuze download folder, it encodes only some video files, i.e. if there was a download of 5 files, chances are good that it will not encode 1 or 2 files out of those 5.
    If for example a second download finishes while the encoding for the first download is still going on, sometimes the second file starts encoding after the first encode finishes, sometimes it does not, the file does not make the log file at all, i.e. the folder action missed it or the automator action dropped it because it was still encoding. Still, sometimes it happens, sometimes not.
    As I need a solution that is 100% accurate, I would like to ask if there are any ideas on how to do this better maybe? As I am not an Applescript Guru, I would need some help to know what works and what doesn't and what the syntax is.
    My main idea right now:
    Similar to how ffmpegX works with its "process" application, have a second script (as .app) that receives the files to be encoded from the automator action and puts them in a queue, then proceeds to encode this queue while the main automator action is free to receive the next file.
    Writing this second app is quite straightforward (a modified version of my current script) but I have some questions I need help with:
    1) How do I call another applescript from within an existing applescript that launches the new applescript in a new process?
    2) How do I pass parameters to this new applescript?
    3) In case of this "Queueing" Idea, once I called the external applescript the first time, how do I make sure when I call next time, that I don't open a second instance of this script but rather pass another queue item to the original instance to be processed?
    Or in general: Is there a better way to achieve this automatic encoding solution that I have not thought about?
    Alternatively:
    Does anyone know how to call the "process" application that comes with the ffmpegX package with the correct parameters to use as a queueing / processing tool?
    Thanks!
    Joe
    Message was edited by: Joe15000
    Message was edited by: Joe15000

    To do this, I created an Automator workflow with an Applescript snippet to change the 'media kind'.
    Here is the 'Run Applescript' workflow step code:
    on run {input, parameters}
              tell application "iTunes"
                        set video kind of (item 1 of input) to movie
              end tell
              return input
    end run
    Prior to this running, I have an 'Import Files into iTunes' workflow step.
    You can switch out 'movie' with: 'TV show', 'music video', or anything in ITLibMediaItemMediaKind.
    Good luck,
    Glenn

  • Help Needed Creating AppleScript for Dial Up Access and Updates

    Hello,
    Due to my location I can only access the internet via Dial Up. I would like to create a script that wakes up my Mini early in the AM, dials my ISP and checks to see if there are any Apple Updates. I'd like to do this at night so my family doesn't have to compete with updates when they are using the computer.
    I've done the Apple Scripting tutorials and have a feel how to do the basics. But I cannot find any information on how to access the USB Modem (US Robotics), get it to dial, access the "Check for Updates" page, download, install and then disconnect.
    Can anyone point me to a functional script that will do this or tell me where I can find the modem related scripting commands?
    Thanks

    1). Does your script both get and install updates if they exist ? If not what should be added to accomplish that?
    If you use man softwareupdate to look at the command line options for softwareupdate you'll find:
    -i | --install
    Each update specified by args is downloaded and unarchived,
    and also installed. The install flag requires root. args
    can be one of the following:
    item ... One or more update names.
    -a | --all All appropriate updates.
    -r | --req All required updates.
    So '-i' tells softwareupdate to install the updates, and '-a' tells it to install all available updates, as opposed to a specific update, or 'required' ones.
    2). Can you suggest an addition to the script that will disconnect the dial up modem and then shut down our Mac Mini?
    That's going to be harder because, as written, the script performs the softwareupdate in the background. It does that so that you don't run into timeout issues (by default AppleScript will timeout after a certain period, canceling the script in progress). Since it's not clear how long the updates will take to download and install it isn't possible to predict what the appropriate timeout should be.
    The easiest way to disconnect would be to just configure the dialup connection to disconnect after a certain period of idleness (System Preferences -> Network -> Modem -> Advanced -> PPP -> Options or some such). If that doesn't suffice let me know and I'll craft up a revised script.

  • Applescript for folder reading

    I need a applescript for the below script.
    var inputDirectory="D:\\IndFiles";
    var inddFiles=new Array();
    inddFiles=Folder(inputDirectory).getFiles();
    //Suppress all dialogs
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
    for(var indCount=0; indCount < inddFiles.length; indCount++)
        if (String(inddFiles[indCount]).match(/\.indd$/i))
            var aDoc=app.open(File(inddFiles[indCount]), true);
            //Save and close
            aDoc.close(2036691744);
    Arivu.

    With AppleScript you can use either POSIX or HFS paths. You just need to specify which you are passing. Shell will use POSIX, AppleScript by default likes HFS if you are going to coerce to an alias specifier (which is what most apps expect when using AppleScript). Here is another example that uses spotlight to find your files.
    set theFolder to quoted form of POSIX path of (choose folder)
    set fileList to paragraphs of (do shell script "mdfind -onlyin " & theFolder & " kMDItemDisplayName == '*.indd'")
    tell application "Adobe InDesign CS2"
    set user interaction level of script preferences to never interact
    repeat with i from 1 to count of fileList
    open (POSIX file (item i of fileList) as alias)
    -- do stuff
    close document 1 saving yes
    end repeat
    end tell
    I like 'mdfind' for its full POSIX paths and speed but it is recursive…
    If you have problems with 'your code' then you would do better to post it. And also what OS version  you are using?

  • Error when compiling AppleScript for CS2, need help

    I've recently started learning AppleScript, and while I'm no stranger to programming I'm a little lost when it comes to errors like this one. I have both InDesign CS2 and InDesign CS3 installed so I'm not sure if my problem is caused by that, they were installed before I started working on this mac. I've also been recently upgraded from Tiger to Leopard, in case that might be a probable cause.
    Basically, my problem stems from this:
    tell application "Adobe InDesign CS2"
        get active document
    end tell
    When I try to compile this I get a Syntax Error that says "Expected end of line but found class name." and highlights "document". I've also had problems trying to use things like "page 1" or "view preferences" with similar errors. With the case of things like "page 1" I've had to replace it with "item 1 of pages" to get it to compile.
    If I change it to "Adobe InDesign CS3" it works fine, but I need to compile for CS2 for backwards compatability. Strangely, this method works:
    set indesign to application "Adobe InDesign CS2"
    tell indesign
        using terms from application "Adobe InDesign CS3"
            get active document
        end using terms from
    end tell
    Does this mean my CS2 dictionary is broken? I can view it fine from the Script Editor, and I've seen things like "active document" used in example scripts, so this syntax error is confusing me.

    I'm not sure why you're getting that error, but a couple of things:
    Using "document 1" instead of "active document" is not a bad habit,
    because there are cases where active document doesn't work.
    When you compile the scripts, the version is somewhat irrelevant -- when
    you go to run them, they look for a running application of the same creator
    code, and use that. It's a bit like when you double-click on a document in
    the Finder -- it doesn't matter what version of ID you made it in, it will
    try to open in whatever version is running first.
    Shane Stanley <[email protected]>
    AppleScript Pro Sessions <http://scriptingmatters.com/aspro

  • AppleScript for Batch Title Changes Needed

    I need to change the title of 75 items in a folder on my G5 by one character. Help says there's a Script Menu in the Finder bar, but I suspect the Help is for Tiger & I have Panther, and there is no such option. I only have Script Editor.
    Would anyone be willing to provide an AppleScript for batch title changes so I can make the needed change? I'm not a programmer. Secondly, how do I activate the script?
    David

    Jeff,
    Thanks for your reply. In Example Scripts/Finder Scripts, I see Replace Text in Item Names.scpt. I'm thinking this is the script I need. Not so?
    Can you recommend a resource that would tell me how to fill in the blanks? Apple refers to Getting Started With AppleScript, but I don't see it as an available PDF file. AppleScript Language Guide is available, but all I really want is something simple, very basic.

  • Help with a simple applescript for combining Artist text with Track name

    Hi all,
    I'd like to put together a simple script that takes the artist names from a list of tracks in iTunes and copies the text to the start of the Title name, followed by " - ".
    This is because, e.g. on a classical album, I want the artist names to all be "Classic Collection Gold" but I'd like to keep the artist name contained with the track name. This means when I browse by artist I don't get millions of artists...
    I found this script, which does something kinda similar, but I'm new to script writing so not sure how to do it?
    So I'd like to change:
    Name
    Planets: Mars
    Artist
    Gustav Holst
    Ambum:
    Simply Classical Gold (Disc 2)
    To be:
    Gustav Holst - Planets: Mars
    Artist
    Gustav Holst - Planets: Mars OR BETTER Simply Classical Gold (Disc 2)
    Album
    Simply Classical Gold (Disc 2)
    This script has some ideas in, but I'm not sure how to tweak it....
    "Artist - Name Corrector" for iTunes
    written by Doug Adams
    [email protected]
    v1.6 May 17, 2004
    -- removed ref to selection
    v1.5 April 11 2004
    checks if separator string is in name
    v1.0 April 2 2004
    Get more free AppleScripts and info on writing your own
    at Doug's AppleScripts for iTunes
    http://www.malcolmadams.com/itunes/
    property separator : " - "
    tell application "iTunes"
    if selection is not {} then
    set sel to selection
    repeat with aTrack in sel
    tell aTrack
    if (get name) contains separator then
    set {artist, name} to my texttolist(get name, separator)
    end if
    end tell
    end repeat
    end if
    end tell
    -- == == == == == == == == == == == == == == == ==
    on texttolist(txt, delim)
    set saveD to AppleScript's text item delimiters
    try
    set AppleScript's text item delimiters to {delim}
    set theList to every text item of txt
    on error errStr number errNum
    set AppleScript's text item delimiters to saveD
    error errStr number errNum
    end try
    set AppleScript's text item delimiters to saveD
    return (theList)
    end texttolist
    Message was edited by: Chipstix

    I'm not sure what that script thinks it's doing, but it's essentially doing nothing, so scrub that and start afresh.
    The first thing you need is a way to identify the tracks to change - you don't want to do all tracks in the library (they might have already been munged). A good option is to work on the selected tracks:
    tell application "iTunes"
    if selection is not {} then
    set sel to selection
    You then need to iterate through those items, changing them one-by-one:
    repeat with aTrack in sel
    Now comes the easy part - build a list of the elements you want (in this case you want the name, artist, and album of each track:
    set trackName to name of aTrack
    set trackArtist to artist of aTrack
    set trackAlbum to album of aTrack
    Now you have the information you need, so reset the fields as appropriate:
    set name of aTrack to trackArtist & " - " & trackName
    set artist of aTrack to trackAlbum -- or to trackArtist & " - " & trackName, depending on your choice
    Now clean up by closing off the repeat and tell blocks:
    end repeat
    end tell
    Putting it all together you get:
    tell application "iTunes"
      if selection is not {} then
      set sel to selection
      repeat with aTrack in sel
        set trackName to name of aTrack
        set trackArtist to artist of aTrack
        set trackAlbum to album of aTrack
        set name of aTrack to trackArtist & " - " & trackName
        set artist of aTrack to trackAlbum -- or to trackArtist & " - " & trackName, depending on your choice
      end repeat
    end tell

  • Developers I need an applescript that opens documents in excel from a specified folder and saves them as .xlsx from their current .xlsb

    mule13470 
    Apr 3, 2014 11:12 AM 
    I tried simply renaming them however it just corrupts the files when I do it like that so I need the applescript to open the files in excel and the save them as .xlsx to test I only need it one folder but if it works I'd like to be able to do it for all documents with .xlsb extentions that are in a huge folder with subfolders that contain a mix of .pdf, .docx, .xlsx and .xlsb. Please Help.
    Applescript Editor, Mac OS X (10.6.8) 
    I have this question too (0) 
    Reply
    Categories: Using OS X MavericksTags: mac, help, finder, excel, applescript_editor
    Level 1 (0 points)
    mule13470
    Re: I need an applescript that opens documents in excel from a specified folder and saves them as .xlsx from their current .xlsbApr 3, 2014 11:19 AM (in response to mule13470) 
    In that huge folder I only need the .xlsb files opened and saved to .xlsx not the others, in case that wasn't clear above.

    In that huge folder I only need the .xlsb files opened and saved to .xlsx not the others, in case that wasn't clear above.

  • I need an applescript that opens documents in excel from a specified folder and saves them as .xlsx from their current .xlsb

    I tried simply renaming them however it just corrupts the files when I do it like that so I need the applescript to open the files in excel and the save them as .xlsx to test I only need it one folder but if it works I'd like to be able to do it for all documents with .xlsb extentions that are in a huge folder with subfolders that contain a mix of .pdf, .docx, .xlsx and .xlsb. Please Help.

    In that huge folder I only need the .xlsb files opened and saved to .xlsx not the others, in case that wasn't clear above.

  • Migration Assistant says it needs 221978913 gb for one user folder

    I am attempting to migrate a colleague of mine from a PowerMac G5 2.0 DP running 10.4.8 to a Mac Pro 2x2.66 machine running 10.4.8 as well.
    I have the old machine hooked up via a firewire cable and idling in target disk mode. On the new machine I login as an user with administrative rights, start up the migration assistant and let it calculate (takes about 5 minutes). Then it says that it needs 221978913 gb for one of the user folders (the one basically being used and needing to migrate). Obviously this isn't correct. The user folder is pretty big (about 110gb) but definitely not 221978913 gb. Everything else such as Applications or the guest user account is the correct size.
    What do I need to do to make this work? I have a feeling its an alias pointing to itself or something like that, but the guy has thousands of files and projects in his folder... there's gotta be a quick and dirty way to find something like that (perhaps a find command or applescript).
    Thanks guys,
    Yvo

    Hi Yvo:
    I've seen outlandish size estimates like that when the directory is messed up; the computer basically doesn't know where the files begin and end, and it comes up with some huge number for the size of the folder.
    Try using Disk Utility to Repair Disk on the G5. If it makes any repairs, try again until it finds no errors. Then try running the migration assistant again and see what it says.
    Good luck,
    Andrew Penner

  • Help with Simple Applescript for Midipipe

    Hey all, I'm in desperate need of help with some Applescript for use in a program called Midipipe:
    http://web.mac.com/nicowald/SubtleSoft/MidiPipe.html
    I simply require an Applescript for Midipipe that filters out all OFF notes except for the most recently pressed key, or most recently pressed ON note. So for example, when multiple keys have been pressed, only the most recently pressed key will send an OFF note. I hope that is clear enough, i've had some major issues trying to get this work and my last hope is to hit the forums and find some help .. I've posted on some of the audio forums and i'm hoping someone here knows how to code this.
    Thanks so much!! .. Its for an upcomming show next week so i'm hoping someone can get me in the right direction to solving this.
    -Jes

    I try to help, but you'll need to apply your brain cells to get it working with what I've already explained (three times with what I offer below).  Try something like the following (I am renaming your buttons to ch1,ch2,ch3,ch4,ch5,ch6 so that the same functions can be shared by all buttons...
    // this assigns listeners to all 6 buttons
    for(var i:uint=1; i<7; i++){
              this["ch"+String(i)].addEventListener(MouseEvent.CLICK, fl_ClickToSeekToCuePoint);
    // this processes any one of the 6 btns when they are clicked
    function fl_ClickToSeekToCuePoint_1(event:MouseEvent):void
        var btn = event.currentTarget;
        var cuePointInstance:Object = vid.findCuePoint(btn.name);
        vid.seek(cuePointInstance.time);
       resetButtons();    // this makes all buttons go back to normal
        btn.upState = btn.overState; // this makes the clicked button change states
    function resetButtons():void {
         for(var i:uint=1; i<7; i++){
              this["ch"+String(i)].upState =  this["ch"+String(i)].hitTestState;
    For this to work, your buttons need to have the same artwork in the hit frame as they do in the up frame.

  • I NEED ADOBE SERVICE FOR A REFUND -- TONIGHT

    I'm ready to scream -- I was supposed to be transferred to the department for a refund and instead it timed out and ended my chat:
    The chat line is: (EMPHASIS ON THE RED FONT AREAS -- I NEED TO CANCEL DREAMWEAVER CS6 (AS I WAS ASSURED I WOULD HAVE NO PROBLEM DOING) AND GET A REFUND -- I JUST PURCHASED DREAMWEAVER CC.
    One moment please while we route your chat to a representative.
    All representatives are currently assisting others. Thanks for your patience. A representative will be with you shortly.
    Thank you for contacting Adobe Sales. My name is Gavin. How may I help you today?
    Gavin: Hi, may I have your first name please?
    you: Hi, my name is Barry.  I spoke with your chat line the other night, the night I purchased CS6.  I was on the fence, do I want CS6 (for about $400) or CC (with the ongoing $20 a month fee).  I was told that if I wanted to cancel CS6 and move to CC, it would be OK, since I had only installed CS6 and had not used it yet.  And that I could get the refund for CS6 and install CC at the same time.  At the moment, my purchase from Best Buys had not registered in your system, but I'm sure it has now.  SO THE QUESTION AGAIN -- could you discuss with me the pros and cons of CS6 vs. CC -- I have heard that I will not be able to update/upgrade CS6, that it is close-ended, and that CC will be a constant addition of latest features.  PLEASE ELUCIDATE ME ON WHICH PROGRAM I (A NEOPHYTE WHO JUST PAID SOMEONE TO BUILD ME A WEBSITE) MIGHT WANT TO USE.
    Gavin: Hello Barry
    Gavin: Let me explain that for you.
    you: Hi, -- can you read my lengthy question and provide me your insights, CS6 or CS CC?  Thanks, Gavin - I might have spoken with you the other night even.
    Gavin: No, its with other representative.
    Gavin: Adobe Creative Cloud is our newest option for you, That will give you everything , plus the ability to sync and store your files
    Gavin: If you purchase the software outright at once then you'll be paying the upgrade cost when new version releases but that is not the case when subscribed to Creative Cloud membership since you get free upgrades to future version and will remain current with the latest software tools.
    you: Is there some comparison sheet which would lay out the features and benefits of the two programs, side by side, for an educated decision?  I was told that CS6 if purchased outright is NOT UPGRADABLE -- wouldn't that lean me toward DW CC instead, to stay current as features are added and tools too?  IF THAT IS THE CASE, PLEASE REFUND ME THE CS6 COST AND SIGN ME UP FOR THE DW CC PROGRAM INSTEAD.  I was told you could transfer me to the folks in your place who could make this happen -- but I NEED IT DONE TONIGHT!  My website developer is coming tomorrow and needs an installed program to train me on.
    Gavin: We are connected, right?
    you: sorry, it took time to frame my question
    Gavin: That's okay.
    Gavin: Barry, I see that going forward all new versions will be through creative cloud membership.
    Gavin: I'll help you with the cancellation for your CS6 purchase made once you complete the sign up for Dreamweaver CC, Okay
    you: SO, HELP ME TO A DECISION, GAVIN.  What do I do?  Get the monthly fee program and turn in the CS6 for a refund?  HELP
    you: Lead the way -- BUT.... AND IT'S A BIG "BUT" -- will it be installed and functioning TONIGHT so my guy can train me tomorrow?  PLEASE ANSWER THEN let's get this new sign up & cancellation into action.
    Gavin: I see that there is no option to equalize the CS6 purchase for the CC subscription plan however you need to subscribe first and then will refund the CS6 purchase made.
    Gavin: After subscribing to Dreamweaver CC you can download/ install the software immediately
    Gavin: Sounds great, right?
    you: So you cannot help me -- what do I do?  How do I subscribe first, and how do I get the refund for CS6?  Please advise.  I'm ready to do it NOW! 
    Gavin: I'll help you now with the link to subscribe Dreamweaver CC and then help you to get the refund for CS6, Okay
    you: fantastic -- I'm at your disposal
    you: what do you need from me?
    Gavin: Please click here to subscribe
    Gavin: I'll stand by please let me know once your done.
    you: one last question -- as I said, I'm new to this -- can I later upgrade to Creative Cloud's whole family by just increasing my monthly payment by the difference?  please advise.
    Gavin: Yes, that's possible.
    Gavin: You can later switch or upgrade to complete creative cloud membership when you require other products.
    you: great - I'm purchasing now and will let you know when it goes through
    Gavin: Sure
    you: do I have to un-install CS6 first? PLEASE ADVISE - I'M STARTING TO DOWNLOAD AND DIDN'T THINK OF IT!!!!
    Gavin: Excellent!
    Gavin: You can uninstall CS6 version once you complete the download for CC.
    Gavin: Barry, please stay online while I transfer this chat to our Customer Service Team for more help on cancellation for your CS6 purchase made, Okay
    you: I am online, and DW CC has extracted and is half-way through the next step
    you: by the way, here's my proof of purchase--should I proceed through the entire installation and checking for upgrades.  Need I check for upgrades, or is this the latest version?
    you:   We received your payment - thank you! Here are the details about that order for your records:   Order Details:    Creative Cloud single-app membership for Dreamweaver (one-year) $19.99 per month Order # AD010920985  
    Gavin: Excellent!
    Gavin: Please run the download to install, mean while you cancel the order for CS6 purchase made, Okay.
    you: Ok - how do I cancel it?  Will you turn me over to that department to effect the cancellation?
    Gavin: Yes, please stay online while I transfer this chat.
    you: Dreamweaver CC is now installed.  Thanks for your help, Gavin.  I'm so nervous about this because I can't afford to screw it up and have my website guy come tomorrow and not be able to train me.
    Gavin: Not to worry!
    Please wait while I transfer you to an operator at Adobe Service.
    We are still assisting other customers, thank you for your patience. You can also try our community forums, where experts are online 24/7.
    We are still assisting other customers, thank you for your patience. You can also try our community forums, where experts are online 24/7.
    You are not currently connected to a chat representative.
    Your chat transcript will be sent to [email protected] at the end of your chat.
    We are still assisting other customers, thank you for your patience. You can also try our community forums, where experts are online 24/7.
    You are not currently connected to a chat representative.
    We are still assisting other customers, thank you for your patience. You can also try our community forums, where experts are online 24/7.
    You are not currently connected to a chat representative.

    Hello Barry,
    as one of these DW fans here, I'm very surprised and disappointed how your chat passed off. And I can fully understand your immeasurable disappointment. So I/we won't give up this quickly. Maybe you would succeed by using the written form. The employees have time to reflect your problem in an optional way. Please try it once more and use this form for "Sales Inquiries" (Contact us online):
    http://www.adobe.com/products/request-consultation/marketing-cloud.html?promoid=KAWSG
    Good luck!
    Hans-Günter

  • Do We need access key for Additional Data B in VA01

    Hi all,I have to add fields in Additional Data B,I have searched SDN about it and came to know that it is screen '8459' of program 'SAPMV45A',but it is asking key for that,is it safe applying access key for this screen?
    Thanks in advance.

    >is it safe applying access key for this screen?
    yes it is safe. SAP provided the screen 8459 only for adding our own custom fields to it. For this you need access key for the first time. along with that you need access key for
    PBO include, PAI include
    MV45AOZZ ,MV45AIZZ .
    check it once.

  • Need standrad program for vendor aging report

    Hi
      Need standrad program for vendor aging report.
    Please reply me only standrad programs.
    Point are sure.
    Regards,
    kumar

    Hi Pankaj
       sorry to say that this is not my required program.
    I need vendor aging report like s_alr_87012178 tc leads to customer aging report.
    Thanks for your effort.
    points are awarded.
    Regards,
    kumar

  • Keynote and pages are now free, but why do i need to pay for them still when there now free?!?

    keynote and pages are now free, but why do i need to pay for them still when there now free?!?

    Users can obtain the iWorks and iLife applications free, if they purchased a Mac after the beginning of October 2013.
    Older Mac purchases require a paid purchase of these applications.

Maybe you are looking for