Help with apple script for Chapter Markers (on each edit)

Hi,
My goal:
Add for each edit in the sequence a chapter marker til the end of the sequence.
(Bonus track would be: Name the marker like the current clipname )
so far I could work it out, with a lot of googling.... but:
Not working: character "a" is not typed, no idea why ?
Not working: goto begin of sequnce at the beginning
And: I need something like a loop til the end of the sequence
help very appreciated !
thanks
P.S.: I work tith FCP 7
Here's my code so far:
tell application "Final Cut Pro"
  activate
          tell application "System Events"
                    delay 0.5
  key code 34 using {shift down} #Go to Begin
                    delay 0.5
  key code 125 # Arrow Down, next edit
                    delay 0.2
  key code 46 #Create a marker
                    delay 0.2
  key code 46 #Edit the marker title
                    delay 0.2
  key code 48 # TAB
                    delay 0.2
  key code 50 # <
                    delay 0.2
  key code 8 using {shift down} # C
                    delay 0.2
  key code 4 # h
                    delay 0.5
  key code 128 # a
                    delay 0.2
  key code 35 # p
                    delay 0.2
  key code 17 # t
                    delay 0.2
  key code 14 # e
                    delay 0.2
  key code 15 # r
                    delay 0.2
  key code 50 using {shift down} # >
                    delay 0.5
  key code 76 #Enter, Get out of marker window
                    delay 0.5
  key code 125 # Arrow Down
          end tell
end tell

Use Automator. It's great for repetitious tasks (like the one you've described), and it's very user-friendly. Open Automator, create a new workflow that executes the action you want, and you can apply that action to the resources you wish to edit.
Good resource here:
http://bit.ly/

Similar Messages

  • Help with Apple Script Code

    Hi,
    I found this Apple script online and here's how it works:
    tell application "QuickTime Player"
    activate
    try
    if not (exists document 1) then display dialog "Please open a QuickTime movie." buttons {"Cancel"} default button 1 with icon 1
    set thefile to (choose file name)
    save document 1 in thefile
    close document 1
    end try
    end tell
    +I run the Apple script+
    *1. It prompts me to open a movie file in Quicktime*
    +I open a movie in Quicktime+
    *2. It prompts me for an name and directory to save the new file in*
    +I enter a name and directory+
    *3. It saves a new reference movie in said directory with said name*
    This is useful if I want to customize every file, but unfortunately, I just want to mass create reference movies for a whole bunch of files.
    What I am looking for is for an Apple script that is a drag and drop application, so I can drop say 100 movie files or so, and have the Apple script create reference movie files with the same name and in the same directory automatically with no prompts.
    Since I am unfamiliar with Apple script I was wondering if someone would be able to edit my existing script to do what I want.
    Thanks so much for your help!

    Use Automator. It's great for repetitious tasks (like the one you've described), and it's very user-friendly. Open Automator, create a new workflow that executes the action you want, and you can apply that action to the resources you wish to edit.
    Good resource here:
    http://bit.ly/

  • Help With dynamic scripting for Dervied Property

    Hi,
    I am trying to get the the list of child nodes and then loopthorugh those nodes to do some calculation in a derived propety using dynamic scripting. I tried with below script.
    var childEnumerator = node.GetChildEnumerator();
    while(childEnumerator.MoveNext())
        var propValue = childEnumerator.GetCurrent().PropValue("Custom.Salary");
        print(propValue);
    While Evaluating this script I am getting below mentioned error. Any idea what i am missing here?
    DRM-16008: There was an error calculating Script property Custom.TotalSalaryExp for EMP_Zone/Emp/PPD1: TypeError: 'GetChildEnumerator' is not a function
    Please help me out. thanks fr your co-operation
    Regards,
    Sudipta

    Try this instead...
    var childEnumerator = node.GetChildEnumerator();
    childEnumerator.MoveNext();
    while(childEnumerator.GetCurrent() != null)
        var propValue = childEnumerator.GetCurrent().PropValue("Custom.Salary");
        print(propValue);
    childEnumerator.MoveNext();

  • NEED a java coder to help with a script for a programs of mine.

    I play a game, very competitively, and need someone to make and compile a script for me. I am willing to pay upwards of 100 USD for this script made to MY standards. There will be a lot of work involved...Probably 12 hours studying my game and the purpose of the script(s). I will be buying 2-3 scripts, at roughly 50-100 USD each, depending on the quality. I will transfer the money via paypal, or other means if we can reach an agreement.
    Please IM me at Chadtrapier on AIM or send an email to [email protected]
    Or...Add me on MSN - [email protected]
    We can reach an agreement with these scripts...
    Thank you, I will also check this thread, so reply if you would like.
    ~Chad

    Ummm. Do you think that's a lot of money or something? Think in the range of 40-60 per hour. And if you're talking about warcraft I don't think they java hooks to make bots. I think you need to figure out what your problem is first and maybe learn to code them yourself.

  • Help with Automator Script for QuickTime Pro Movie Conversion from Vado

    All my videos from my Creative Vado do not show up in iMovie 09 initially on import. By trial and error, I have discovered that the old version of QuickTime Pro 7 ($29.95) will convert them to .mov files that can be seen by iMovie 09 once the converted videos are imported back into iPhoto.
    I am (very) new to mac things, and it looks like in theory I could use Automator to handle to conversion process, and perhaps even the re-import into iPhoto. Does anyone have any suggestions on how to go about this? Where would be a good site to post this as a project that I could pay some one to help me, provide an automator script/workflow?
    Are any other solutions available? Buy Final Cut etc?
    PS (Rant): One of the reasons I bought a MacBook Pro and iLife was to take advantage of what I thought was supposed to be Apple's superior multimedia handling. It seems ludicrous to me that with a MacBook Pro running the latest software (10.6.4), and using the latest versions of iLife, I'd have to buy an old version of QuickTime to convert my videos so that I could manipulate them in iMovie. Sigh.

    MPeg Stram clip will export files which are compatible with iMovie '09. It (iMovie )can import the following.
    DV
    AIC
    Motion-JPEG
    Photo-JPEG
    MPEG-4 (Supported profiles)
    H.264 (Supported profiles)
    Apple Animation (Movie '09 only)
    Apple Video (iMovie '09 only)
    iMovie '08/'09 will not accept files containing extraneous data tracks such as:
    'Tween
    Text
    Chapter
    Closed Caption
    Secondary audio such as AC3
    etc.
    iMovie '08/'09 Will not accept files that rely on proprietary/third-party components such as
    DivX
    WMV
    XviD
    etc.

  • Need help with easy script for open / close app and move files

    Hi,
    I'm not a scripter.. never done anything special perhaps more complicated than /shutdown -s on cmd..
    I actually learned ASCII C language on university but never used it in real.
    I'm trying to create a basic script that perhaps you could help me or guide me how to do it..
    The commands are
    1) Close a running app (end task it or force kill it, I prefer end task it)
    2) delete files from x location
    3) run .exe app from y location
    4) close that running app 
    5) move files from z to y
    Perhaps adding few "wait few seconds" commands in between each, so the apps will launch successfully..
    My first question will be whats the easiest script language to do that?
    I tried VBScript but couldn't find commands for open or close apps.. also for controlling files..
    And what commands can do that? I could google them up for better understanding no need for rough guide
    And lastly, does it too hard? If it takes more than hour to make it (learn and process) than it ain't worth it..
    Thanks alot ahead!
    Jordan.

    hmm 2 questions:
    1) taskkill.exe causing me access deny error.. I used "taskkill.exe /IM softwarename.exe"
    how do I get permission or something to fix that?
    2) on the "move" command..
    First, its a "copy" instead.. but I easily figured that out.. 
    but more important is that I want to copy a folder.. with unknown list of way too long files and sub folders..
    and all I see is ability to move a file..
    Is this possible?
    Thanks

  • Help with Apple Script rewrite

    I can't wrap my brain around applescript. I found this program mp3gain. It is written in applescript. I just need it to go to folder abc download and run, then save it to a folder names abc done. I can reset the db from the script. Any help would be great. All the itunes stuff can be deleted.
    -- MacMP3Gain.applescript
    -- MacMP3Gain
    -- Created by Bery Rinaldo on Tue Jan 14 2003.
    -- Copyright (c) 2003-2005 Bery Rinaldo. All rights reserved.
    -- This AppleScript is used to wrap the command line version of mp3gain with a quaint GUI.
    -- This program is free software; you can redistribute it and/or modify it under the terms
    -- of the GNU General Public License as published by the Free Software Foundation; either
    -- version 2 of the License, or (at your option) any later version.
    -- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
    -- without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    -- See the GNU General Public License for more details.
    -- You should have received a copy of the GNU General Public License along with this program; if not,
    -- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    -- This program includes a binary version of aacgain downloaded from here
    -- http://www.hydrogenaudio.org/forums/index.php?act=Attach&type=post&id=1461
    -- aacgain version 1.4.0, derived from mp3gain version 1.4.6
    -- copyright(c) 2001-2004 by Glen Sawyer
    -- AAC support copyright(c) 2004 David Lasker, Altos Design, Inc.
    -- uses mpglib, which can be found at http://www.mpg123.de
    -- AAC support uses faad2 (http://www.audiocoding.com), and
    -- mpeg4ip's mp4v2 (http://www.mpeg4ip.net)
    -- Check out the MP3Gain/AACgain web sites:
    -- http://mp3gain.sourceforge.net/
    -- http://altosdesign.com/aacgain/
    -- Version 1.0 - Initial release
    -- Version 1.01 - Added status updates to display while mp3gain is running
    -- Version 1.1 - 13-Feb-2003 - Added iTunes playlist support
    -- Version 1.2 - 18-Feb-2003 - Added "Process Sub-folders" option to process all folders below the selected folder.
    -- Version 1.3 - 20-Feb-2003 - Fixed program hang when "Allow Clipping" checkbox was unchecked.
    -- Version 1.4 - 23-Feb-2003 - Added target MP3 Gain dB value, added preferences file support for all controls
    -- Version 1.5 - 26-Feb-2003 - Integrate "Be Nice" feature from Michael Heinz. Added "Cancel" feature.
    -- Version 1.6 - 28-Feb-2003 - Minor GUI tweaks to "Be Nice" an "Target" buttons to disable while running.
    -- Version 1.7 - 01-Nov-2003 - Update to mp3gain 1.4.3, use -k (autoClip) option when "Allow Clipping" is unchecked
    -- Version 1.8 - 09-Nov-2003 - Update run_mp3gain.pl to handle iTunes 4 playlists
    -- Version 1.9 - 23-Aug-2005 - Update for Tiger & AAC
    property ref_folder : ""
    property ref_playlist : ""
    property running : false
    property mp3gain : ""
    property run_mp3gain : ""
    on clicked theObject
    if name of theObject is "Start" then
    if running is true then
    set title of button "Start" of window "MainWindow" to "Start"
    try
    set pids to do shell script "ps -auxww | egrep \"" & run_mp3gain & "|" & aacgain & "\" | grep -v grep | awk '{ print $2 }' | xargs kill"
    end try
    set running to false
    tell progress indicator "BusyBar" of window "MainWindow" to stop
    set visible of progress indicator "BusyBar" of window "MainWindow" to false
    tell window "MainWindow" to update
    set contents of text field "StatusMessage" of window "MainWindow" to "Processing aborted."
    set enabled of button "Start" of window "MainWindow" to false
    set enabled of button "Choose Folder" of window "MainWindow" to true
    set enabled of button "Choose Playlist" of window "MainWindow" to true
    set enabled of button "Clip" of window "MainWindow" to true
    set enabled of button "Sub" of window "MainWindow" to true
    set enabled of button "Target" of window "MainWindow" to true
    set enabled of button "Nice" of window "MainWindow" to true
    set targetchecked to state of button "Target" of window "MainWindow" as integer
    if targetchecked = 1 then
    set enabled of text field "TargetValue" of window "MainWindow" to true
    set targetvalue to 75
    try
    set targetvalue to contents of default entry "TargetValue" of user defaults as integer
    end try
    set contents of text field "TargetValue" of window "MainWindow" to targetvalue
    else
    set enabled of text field "TargetValue" of window "MainWindow" to false
    set contents of text field "TargetValue" of window "MainWindow" to 89
    end if
    set enabled of matrix "ARmatrix" of window "MainWindow" to true
    set ref_folder to ""
    set contents of text field "FolderPath" of window "MainWindow" to "No folder selected"
    set ref_playlist to ""
    set contents of text field "PlaylistName" of window "MainWindow" to "No playlist selected"
    tell window "MainWindow" to update
    else
    set clip to (state of button "Clip" of window "MainWindow") as integer
    set albumradio to current row of matrix "ARmatrix" of window "MainWindow"
    set options to " -q "
    if clip = 1 then
    set options to options & "-c "
    else
    set options to options & "-k "
    end if
    if albumradio = 1 then
    set options to options & "-a "
    else
    set options to options & "-r "
    end if
    set nicechecked to state of button "Nice" of window "MainWindow" as integer
    set targetchecked to state of button "Target" of window "MainWindow" as integer
    if targetchecked = 1 then
    set targetdb to integer value of text field "TargetValue" of window "MainWindow"
    set targetparam to targetdb - 89
    set options to options & "-m " & (targetparam as string) & " "
    end if
    set can_run to false
    if ref_playlist is not equal to "" then
    set the playlist_text to ""
    tell application "iTunes"
    set the track_count to the count of tracks of playlist ref_playlist
    repeat with z from 1 to the track_count
    tell track z of playlist ref_playlist
    copy {database ID} to {dbid}
    end tell
    set the playlist_text to the playlist_text & (dbid as string) & ","
    end repeat
    end tell
    activate
    if track_count = 0 then
    display dialog "The playlist is empty." buttons {"OK"}
    else
    set options to options & "-P " & playlist_text
    set can_run to true
    end if
    else
    set folder_path to POSIX path of ref_folder
    set sub to (state of button "Sub" of window "MainWindow") as integer
    if sub = 1 then
    set options to options & "-S -F \"" & folder_path & "\""
    set can_run to true
    else
    set command to "cd \"" & folder_path & "\" ; ls *.mp3 *.m4a 2> /dev/null"
    set output to do shell script command
    if output is equal to "" then
    display dialog "No MP3/M4A files were found in the specified folder." buttons {"OK"}
    else
    set options to options & "-F \"" & folder_path & "\""
    set can_run to true
    end if
    end if
    end if
    if can_run is equal to true then
    set enabled of button "Start" of window "MainWindow" to false
    set enabled of button "Choose Folder" of window "MainWindow" to false
    set enabled of button "Choose Playlist" of window "MainWindow" to false
    set enabled of button "Clip" of window "MainWindow" to false
    set enabled of button "Sub" of window "MainWindow" to false
    set enabled of button "Target" of window "MainWindow" to false
    set enabled of button "Nice" of window "MainWindow" to false
    set enabled of text field "TargetValue" of window "MainWindow" to false
    set enabled of matrix "ARmatrix" of window "MainWindow" to false
    set visible of progress indicator "BusyBar" of window "MainWindow" to true
    set uses threaded animation of progress indicator "BusyBar" of window "MainWindow" to true
    tell progress indicator "BusyBar" of window "MainWindow" to start
    tell window "MainWindow" to update
    if nicechecked = 1 then
    set command to "nice -n 1 "
    else
    set command to ""
    end if
    set command to command & "\"" & run_mp3gain & "\" " & options & " > /tmp/.mp3gain_output 2>&1"
    --display dialog command
    try
    ignoring application responses
    do shell script command & "&"
    end ignoring
    end try
    set running to true
    set title of button "Start" of window "MainWindow" to "Cancel"
    set enabled of button "Start" of window "MainWindow" to true
    tell window "MainWindow" to update
    end if
    end if
    else if name of theObject is "Choose Playlist" then
    tell application "iTunes"
    set allPlaylists to name of user playlists
    end tell
    activate
    set playlist_choice to choose from list allPlaylists with prompt "Which playlist?" multiple selections allowed 0
    if playlist_choice is false then --nothing selected, just stop
    set ref_playlist to ""
    set contents of text field "PlaylistName" of window "MainWindow" to "No playlist selected."
    else
    set ref_playlist to playlist_choice as string
    set contents of text field "PlaylistName" of window "MainWindow" to ref_playlist
    set ref_folder to ""
    set contents of text field "FolderPath" of window "MainWindow" to ""
    set state of button "Sub" of window "MainWindow" to false
    set enabled of button "Sub" of window "MainWindow" to false
    set enabled of button "Start" of window "MainWindow" to true
    tell window "MainWindow" to update
    end if
    else if name of theObject is "Sub" then
    set ischecked to state of button "Sub" of window "MainWindow" as integer
    try
    set contents of default entry "Sub" of user defaults to ischecked
    end try
    else if name of theObject is "Clip" then
    set ischecked to state of button "Clip" of window "MainWindow" as integer
    try
    set contents of default entry "Clip" of user defaults to ischecked
    end try
    else if name of theObject is "Nice" then
    set nicechecked to state of button "Nice" of window "MainWindow" as integer
    try
    set contents of default entry "Nice" of user defaults to nicechecked
    end try
    else if name of theObject is "Target" then
    set targetchecked to state of button "Target" of window "MainWindow" as integer
    try
    set contents of default entry "Target" of user defaults to targetchecked
    end try
    if targetchecked = 1 then
    set enabled of text field "TargetValue" of window "MainWindow" to true
    set targetvalue to 89
    try
    set targetvalue to contents of default entry "TargetValue" of user defaults as integer
    end try
    set contents of text field "TargetValue" of window "MainWindow" to targetvalue
    else
    set enabled of text field "TargetValue" of window "MainWindow" to false
    set contents of text field "TargetValue" of window "MainWindow" to 89
    end if
    else if name of theObject is "ARmatrix" then
    set albumradio to current row of matrix "ARmatrix" of window "MainWindow" as integer
    try
    set contents of default entry "AlbumRadio" of user defaults to albumradio
    end try
    else if name of theObject is "Choose Folder" then
    set ref_folder to choose folder with prompt "Choose the folder where the MP3/M4A files are stored"
    set contents of text field "FolderPath" of window "MainWindow" to ref_folder as string
    set ref_playlist to ""
    set contents of text field "PlaylistName" of window "MainWindow" to ""
    set state of button "Sub" of window "MainWindow" to true
    set enabled of button "Sub" of window "MainWindow" to true
    set enabled of button "Start" of window "MainWindow" to true
    tell window "MainWindow" to update
    end if
    end clicked
    on will finish launching theObject
    -- display dialog "IN the will finish launching thing"
    set running to false
    set mypath to POSIX path of (path to me as string)
    set aacgain to mypath & "Contents/Resources/aacgain"
    set run_mp3gain to mypath & "Contents/Resources/run_mp3gain.pl"
    try
    make new default entry at end of default entries of user defaults with properties {name:"AlbumRadio", contents:1}
    end try
    set albumradio to 1
    try
    set albumradio to contents of default entry "AlbumRadio" of user defaults as integer
    end try
    set current row of matrix "ARmatrix" of window "MainWindow" to albumradio
    my getpreferencebutton("Clip")
    my getpreferencebutton("Sub")
    my getpreferencebutton("Target")
    my getpreferencebutton("Nice")
    try
    make new default entry at end of default entries of user defaults with properties {name:"TargetValue", contents:89}
    end try
    set targetvalue to 89
    try
    set targetvalue to contents of default entry "TargetValue" of user defaults as integer
    end try
    set contents of text field "TargetValue" of window "MainWindow" to targetvalue
    set targetchecked to state of button "Target" of window "MainWindow" as integer
    if targetchecked = 1 then
    set enabled of text field "TargetValue" of window "MainWindow" to true
    else
    set enabled of text field "TargetValue" of window "MainWindow" to false
    set contents of text field "TargetValue" of window "MainWindow" to 89
    end if
    set visible of progress indicator "BusyBar" of window "MainWindow" to false
    tell window "MainWindow" to update
    set visible of window "MainWindow" to true
    end will finish launching
    on will close theObject
    quit
    end will close
    on changed theObject
    set targetdb to integer value of text field "TargetValue" of window "MainWindow"
    try
    set contents of default entry "TargetValue" of user defaults to targetdb
    end try
    end changed
    on idle
    -- display dialog "idle " & running
    if running is true then
    set psout to ""
    set stout to ""
    try
    set psout to do shell script "ps -auxww | grep \"" & run_mp3gain & "\" | grep -v grep"
    set stout to do shell script "grep -a -v '^$' /tmp/.mp3gain_output | tail -1"
    end try
    if stout = "" then
    if ref_playlist is not equal to "" then
    set stout to "Processing iTunes playlist " & ref_playlist & " ..."
    else
    set stout to "Processing folder " & ref_folder & " ..."
    end if
    else
    set stlen to length of stout
    if stlen > 75 then
    set firstpart to (characters 1 through 30 of stout) as string
    set startlast to stlen - 30
    set lastpart to (characters startlast through stlen of stout) as string
    set stout to firstpart & "..." & lastpart
    end if
    end if
    set contents of text field "StatusMessage" of window "MainWindow" to stout
    tell window "MainWindow" to update
    if psout is equal to "" then
    set running to false
    set title of button "Start" of window "MainWindow" to "Start"
    tell progress indicator "BusyBar" of window "MainWindow" to stop
    set visible of progress indicator "BusyBar" of window "MainWindow" to false
    tell window "MainWindow" to update
    set contents of text field "StatusMessage" of window "MainWindow" to "Processing complete."
    set enabled of button "Start" of window "MainWindow" to false
    set enabled of button "Choose Folder" of window "MainWindow" to true
    set enabled of button "Choose Playlist" of window "MainWindow" to true
    set enabled of button "Clip" of window "MainWindow" to true
    set enabled of button "Sub" of window "MainWindow" to true
    set enabled of button "Target" of window "MainWindow" to true
    set enabled of button "Nice" of window "MainWindow" to true
    set targetchecked to state of button "Target" of window "MainWindow" as integer
    if targetchecked = 1 then
    set enabled of text field "TargetValue" of window "MainWindow" to true
    else
    set enabled of text field "TargetValue" of window "MainWindow" to false
    set contents of text field "TargetValue" of window "MainWindow" to 89
    end if
    set enabled of matrix "ARmatrix" of window "MainWindow" to true
    set ref_folder to ""
    set contents of text field "FolderPath" of window "MainWindow" to "No folder selected"
    set ref_playlist to ""
    set contents of text field "PlaylistName" of window "MainWindow" to "No playlist selected"
    tell window "MainWindow" to update
    end if
    end if
    return 1
    end idle
    on will quit theObject
    if running is true then
    try
    set pids to do shell script "ps -auxww | egrep \"" & run_mp3gain & "|" & aacgain & "\" | grep -v grep | awk '{ print $2 }' | xargs kill"
    end try
    end if
    end will quit
    on getpreferencebutton(buttonname)
    try
    -- this is how to initialize the preferences mechanism...it will not reset the value if one exists already
    make new default entry at end of default entries of user defaults with properties {name:buttonname, contents:0}
    end try
    set value to 0
    try
    set value to contents of default entry buttonname of user defaults as integer
    end try
    if value = 1 then
    set state of button buttonname of window "MainWindow" to true
    else
    set state of button buttonname of window "MainWindow" to false
    end if
    end getpreferencebutton

    hi riker123
    it is written in applescript, but it is written for AppleScript Studio & Xcode which has now been superseded by AppleScriptObjC & Xcode, used under OSX 10.6
    Looking at your Mac specs you could use AppleScript Studio & Xcode
    to set this code up, you will find a copy of Xcode on your OSX installer disk.
    Not to discourage you but Xcode needs a bit of work to get the hang off,
    but that's part of the fun.
    Budgie

  • Help with a script for elder friend

    First off, with apologies, I am not a script familar person at all.  I have an elderly friend who is switching to Mac for the first time.  I wanted a way to close all open programs, with a prompt to save any open files and then run a Time Machine backup and shut down - preferably without restarting next day with any windows opening automatically.  Time Machine is set to run every hour but she's a writer and could lose work if Time Machine doesn't run before shutting down for the night.  So I searched and found some small scripts that I tried to put together.  I think it works but after Time Machine runs it waits a very long time before shutting down.  I'm wondering if some of you kind folks could refine this for me.  (I do realize that automator has a quit all programs that I can save as an app but I'm trying to make this a one step 'app' process.)
    So what I have is this:
    tell application "System Events" to set the visible of every process to true
    set white_list to {"Finder"}
    try
              tell application "Finder"
                        set process_list to the name of every process whose visible is true
              end tell
              repeat with i from 1 to (number of items in process_list)
                        set this_process to item i of the process_list
                        if this_process is not in white_list then
                                  tell application this_process
                                            quit
                                  end tell
                        end if
              end repeat
    on error
              tell the current application to display dialog "An error has occurred!" & return & "This script will now quit" buttons {"Quit"} default button 1 with icon 0
    end try
    do shell script "/bin/bash -c '/System/Library/CoreServices/backupd.bundle/Contents/Resources/backupd-helper > /dev/null 2>&1  &'"
    repeat
      delay 5
              if not IsProcRunning("backupd") then
                        ignoring application responses
                                  tell application "Finder" to shut down
                        end ignoring
                        exit repeat
              end if
    end repeat
    on IsProcRunning(theProc)
              try
                        do shell script "ps auxc | grep \"" & theProc & "\""
                        return true
              on error
                        return false
              end try
    end IsProcRunning
    .... frankly I don't understand most of this in reality but it's a need I'd like to help her with on her Mac Mini. 
    Many Thanks,
    Brenda

    First off, you're overthinking this.  There's no reason why your friend would lose any data by not backing up prior to shutdown (unless she has a flaky hard drive that needs to be replaced).  Assuming she's saving her work when she quits her apps, she should be fine.
    Second, trying to auto-quit applications is dangerous.  You don't check to see if any files need to be saved (there's no easy way to make that check anyway), and that in itself could cause data loss.
    Third, time machine has its own command line utility: tmutil.  There's no reason to script backupd.
    Last, if I remember correctly, whether or not apps and windows reopen at startup can be set on a system-wide or per-application basis.
    Give a clearer and more specific description of the goals you're trying to accomplish: what kind of apps are likely to be open, which of them will/might need to save data, what you want the machine to look like on restart, all with details.  That would help a lot.

  • Help with understanding script for rotating objects

    Hi all
    would some help me with this, I am trying to understand what part of AS3 script says loop through(create a continues 360 loop of objects) the images from an XML file, does this make any sense.
    in my script I have this
    for(var i:int = 0; i < images.length(); i++)
    is this the part that says loop the images/objects
    this is a little more to the script including the above to maybe understand better?
    private function onXMLComplete(event:Event):void
    // Create an XML Object from loaded data
    var data:XML = new XML(xmlLoader.data);
    // Now we can parse it
    var images:XMLList = data.image;
    for(var i:int = 0; i < images.length(); i++)  <<<<<<<<FROM ABOVE ///        {
    // Get info from XML node
    var imageName:String = images[i].@name;
    var imagePath:String = images[i].@path;
    var titles:String = images[i].@title;
    var texts:String = images[i].@text;
    any help would be great

    hi rob
    ok I found this menu which rotates item around on a 360 wheel trying to see if I can use the same script on my menu,
    link to example: http://art.clubworldgroup.com/menu/R...g_menu_AS3.zip
    I have highlighted in blue what creates the loop of items
    in my menu I do  ot have anything like
    var angleDifference:Number = Math.PI * (360 / NUMBER_OF_ITEMS) / 180;
    which sest up the 360 circle of the item
    //Save the center coordinates of the stage
    var centerX:Number=stage.stageWidth/2;
    var centerY:Number=stage.stageHeight/2;
    //The number of items we will have (feel free to change!)
    var NUMBER_OF_ITEMS:uint=15;
    //Radius of the menu circle (horizontal and vertical)
    var radiusX:Number=200;
    var radiusY:Number=200;
    //Angle difference between the items (in radians)
    var angleDifference:Number = Math.PI * (360 / NUMBER_OF_ITEMS) / 180;
    //How fast a single circle moves (we calculate the speed
    //according to the mouse position later on...)
    var angleSpeed:Number=0;
    //Scaling speed of a single circle
    var scaleSpeed:Number=0.0002;
    //This vector holds all the items
    //(this could also be an array...)
    var itemVector:Vector.<Item>=new Vector.<Item>;
    //This loop creates the items and positions them
    //on the stage
    for (var i:uint = 0; i < NUMBER_OF_ITEMS; i++) {
        //Create a new menu item
        var item:Item = new Item();
        //Get the angle for the item (we space the items evenly)
       var startingAngle:Number=angleDifference*i;
        //Set the x and y coordinates
        item.x=centerX+radiusX*Math.cos(startingAngle);
        item.y=centerY+radiusY*Math.sin(startingAngle);
        //Save the starting angle of the item.
        //(We have declared the Item class to be dymamic. Therefore,
        //we can create new properties dynamically.)
        item.angle=startingAngle;
        //Add an item number to the item's text field
        item.itemText.text=i.toString();
        //Allow no mouse children
        item.mouseChildren=false;
        //Add the item to the vector
        itemVector.push(item);
        //Add the item to the stage
        addChild(item);
    //We use ENTER_FRAME to animate the items
    addEventListener(Event.ENTER_FRAME, enterFrameHandler);
    //This function is called in each frame
    function enterFrameHandler(e:Event):void {
        //Calculate the angle speed according to mouse position
        angleSpeed = (mouseY - centerY) / 5000;
        //Loop through the vector
        for (var i:uint = 0; i < NUMBER_OF_ITEMS; i++) {
            //Save the item to a local variable
            var item:Item=itemVector[i];
            //Update the angle
            item.angle+=angleSpeed;
            //Set the new coordinates
            item.x=centerX+radiusX*Math.sin(item.angle);
            item.y=centerY+radiusY*Math.cos(item.angle);
            //Calculate the vertical distance from centerY to the item
            var dx:Number=centerX-item.x;
            //Scale the item according to vertical distance
            //item.scaleX = (dx / radiusX);
            //If we are above centerY, double the y scale
            if (item.x<centerX) {
                item.scaleX*=1;
            //Set the x scale to be the same as y scale
            item.scaleY=item.scaleX;
            //Adjust the alpha according to y scale
            item.alpha=item.scaleX+1.9;

  • Need help with configure script for audacious plugin

    Hello. I have written a small plugin for audacious, that uses an Amarok script to retrieve song lyrics and displays them in a window. I'd like to make an AUR package of it, but I don't even know how to write a configure script. I used to compile it with audacious-plugins, but I suppose a package with all audacious plugins plus my own would be sort of a duplicate of the vanilla audacious-plugins.
    Can anyone help me?

    btn1.addEventListener(MouseEvent.CLICK,f1):
    function f1(e:MouseEvent){
    nextFrame();
    btn2.addEventListener(MouseEvent.CLICK,f2):
    function f2(e:MouseEvent){
    prevFrame();

  • Need help with python script for Deluge

    I am using Deluge 1.3.2 with web server, and all works fine, I use this script in the Deluge settings to execute upon torrent completion:
    #!/bin/bash
    torrentid=$1
    torrentname=$2
    torrentpath=$3
    torrenttimedelta=`/usr/bin/python2 /home/bobby/scripts/deluge/torrentTimeDelta.py $1`
    subject="Started download new torrent!"
    message="$torrentname to $torrentpath"
    echo -e `date`"::Finished downloading torrent:$2 in: $3" with id:$torrentid >> ~/logs/scripts.log
    echo -e `sendEmail -t [email protected] -f [email protected] -u "deluge server notification: torrent $torrentname is complete!" -m "$torrentname has completed downloading at: $torrentpath and took $torrenttimedelta to complete :)" -xu [email protected] -xp password -v -o tls=yes -s email.com` >> ~/logs/scripts.log
    echo ---------------------------------------- >> ~/logs/scripts.log
    This is to email me when a torrent is done and works. What I wanted to add to this email was the time taken to complete the torrent. I have gotten help from Deluge forum in this thread: http://forum.deluge-torrent.org/viewtop … =9&t=36989  However I think it's something with Python within Arch that is the obstacle, and so that helpful person can't do much more IMO. The python script I'm using is:
    #!/usr/bin/python2
    from deluge.ui.client import client
    from twisted.internet import reactor
    d = client.connect()
    def on_connect_success(result):
    print "Connection was successful!"
    def on_get_torrent_value(value):
    for torrent in value:
    print "%s: %s" % (torrent, value[torrent]["name"])
    client.disconnect()
    reactor.stop()
    client.core.get_torrents_status({}, ["name"]).addCallback(on_get_torrent_value)
    d.addCallback(on_connect_success)
    def on_connect_fail(result):
    print "Connection failed!"
    print "result:", result
    d.addErrback(on_connect_fail)
    reactor.run()
    Now if I call this from shell directly, it works. However, including it with my email script at the top, Deluge itself freezes and no email is sent. I run ps aux | grep deluge and I can see that the script has run, but apparently died and all is just hanging. I kill the script process and Deluge resumes just fine, the email is sent. Kinda confused how to remedy this, appreciate any help Thanks
    P.S. When I get the email, the part that says ""$torrentname has completed downloading at: $torrentpath and took $torrenttimedelta to complete "" shows nothing where $torrenttimedelta should be, it just says "and took to complete"

    [edit]  Sorry, I don't use deluge and I messed up my test script. If the script is executable try `/home/bobby/scripts/deluge/torrentTimeDelta.py $1`
    Are there any other errors? or try running bash with debug output to see if it will tell you something else
    The problem you are having is bash doesn't recognize variables inside the tick marks.
    Hope that helps
    Last edited by rickeyski (2011-07-05 19:27:36)

  • Help with the script for fullname

    Hello
    I am trying to write a script on my form for a fullname field. For eg:" someone enters fullname as abc l xyz then i want it to be like Abc L Xyz
    i tried writing a script but i am messing up somewhere. Can anyone help me please, its urgent
    Thanks

    Hi Jasmin
    I am trying to put a jAVAScript into the script window and got the following script it works otherwise but when inserted into form it doesn't work
    I am doing it on exit event
    var FormName = "7158.pdf";
    var FieldName = "FullName2";
    function CapitalizeNames() {
    var ValueString = new String();
    eval('ValueString=document.'+FormName+'.'+FieldName+'.value');
    ValueString = ValueString.replace(/ +/g,' ');
    var names = ValueString.split(' ');
    for(var i = 0; i < names.length; i++) {
    if(names[i].length > 1) {
    names[i] = names[i].toLowerCase();
    letters = names[i].split('');
    letters[0] = letters[0].toUpperCase();
    names[i] = letters.join('');
    } else { names[i] = names[i].toUpperCase(); }
    ValueString = names.join(' ');
    eval('document.'+FormName+'.'+FieldName+'.value=ValueString');
    return true;

  • Need help with a script for moving bulk users to another OU and removing/assigning groups

    I've never used PowerShell before and have been asked to track down a script that can move bulk users from one OU to another, and remove and assign new group membership. I've been googling it for about 30 minutes and haven't really gotten anywhere. If
    somebody can point me in the right direction or give some tips I'd greatly appreciate it. I'm sure this kind of task has been done by several people in similar environments I just haven't been able to find those people/examples. 

    Here's what I've got so far...
    Moving to new OU
    CSV constructed like below...
    DN  
                                                                                                                                                    TargetOU
    “CN=John R, OU=BB,OU=ES,OU=Students,OU=OSD,DC=usd233,=DC=local”
                          "OU=PRT,OU=MS,OU=Students,OU=OSD,DC=usd233,DC=local"
    Import-Module activedirectory
    $UserList = Import-Csv "c:\yourCSVhere.csv"
    foreach ($User in $UserList) {
    $User.DN
    $User.TargetOU
    Move-ADObject -Identity $User.DN -TargetPath $User.TargetOU
    Would this work? I also need to remove the user from two groups and add them to two different groups as well. Would I need to use the addUsertoGroups and removeUserfromGroups commands?

  • Help with a script for checking processes

    hello,
    I have the following script
    while :
    do
    date
    ps -ef |grep f60runm | wc -l
    sleep 60
    done
    I would like this script to also add to a txt file so that I can see the activity overnight.
    rgds
    Alan

    Well, if the commands are in a script:
    script.sh >> /path/to/logfile.log
    or you could do this inside the script:
    LOGFILE="/path/to/logfile.log"
    while :
    do
    date >> $LOGFILE
    ps -ef |grep f60runm | wc -l >> $LOGFILE
    sleep 60
    done

  • Help with Apple Script

    Hi All,
    Every so often I have to delete an application from my mac. Since this involves opening 6 specific folders and trashing a file from within each I thought I could automate this.
    I've opened all the relevant windows in Finder, open AppleScript, hit "record" and then move each of the items into the trash (some require password entry to do this).  When I have finished, I hit "stop" but there's nothing there, it hasn't recorded anything.  Am I missing something (knowledge maybe?)
    Thanks
    G

    The Finder has a command to delete items (move them to the trash), and the command line has commands to remove items (although you need to be very careful), so it would just be a matter of making a list of the paths of the files you want to remove, for example:
    tell application "Finder"
      delete file "path:to:file"
      -- empty trash
    end tell

Maybe you are looking for

  • Download data into a pipe delimited file

    I want to download data from an internal table into a pipe delimited file. I plan to use FM: SAP_CONVERT_TO_TEX_FORMAT but the system I am working on is BW 3.1. This FM does not exists in BW 3.1 How can I download data from an internal table into a p

  • Add member to a collection !

    Hello! I have a report region based on a content of a collection, the report item that display one of the members of the collection is a popkey lov item that I create using : htmldb_item.popupkey_from_lov my problem is : when I add a member to a coll

  • MSI-6529 On Board Sound Not Working

    Hi,there I have a PC MSI-6529 mobo,Windows 98,P4 1.5Ghz,savage 3d Video Card, 256MB PC133 RAM, realtek 8139 NIC. I tried to install the on board sound,but I'm having some problems. I downloaded ac97 audio drivers from MSI's website (Realtek AC97)and

  • OVM 3.0.3 - New VM loses filesystem after OS install

    New install of OVM 3.0.3. Setup new server pool and new storage pool using local disk space on the host. Imported OracleLinux-R5-U7-Server-x86_64-dvd.iso for the install media. Created new VM and installed OS. No issues until OS install was complete

  • SetInstance issue with 3 subforms

    Hi I'm trying to create a form where users can enter details for courses. There is a function where they can select a course type from a drop down menu, and depending on what they select a subform is displayed underneath. if (this.rawValue == "VET")