Check PID in rc.d script

Hi,
I want to create a rc.d script for tt-rss.
The script has to execute
/usr/bin/php /path/to/update.php -daemon
and send the process into the background.
I read the coresponding wiki page.
However, it isn't a good solution to search for the pid using
pidof -o %PPID /usr/bin/php
since other php processes may run.
What is the correct way to solve this problem?
Sven

There are two possible solutions that I am aware of:
1. Use a .install script that adds the 'http2' user.
2. Use su with the '-s' flag to specify an alternate shell. This would probably be the better solution. Example:
su http -s "/bin/sh" -c "command"
Last edited by bluepumpkin (2011-08-14 04:17:35)

Similar Messages

  • In Firefox 2.0+ you can go to Advanced JavaScript Settings and check a box to allow scripts to change status bar text. How do I do this is Firefox 10.0.1?

    In Firefox 2.0+ you can go to Advanced JavaScript Settings and check a box to allow scripts to change status bar text. How do I do this is Firefox 10.0.1?

    Two items in the Advanced JavaScript window were removed as of the Firefox 4.0 version, but they are still available thru about:config .
    Type '''about:config''' in the URL bar and hit Enter. <br />
    ''If you see the warning, you can confirm that you want to access that page.''
    Filter = '''dom.disable_window_status_change''' = double-click to toggle to '''false''' to allow websites to mess with status text.

  • " loading failed please check your page for  java script errors" please Help

    recently my project starts crashing.... when it loads it gives a java scrip error .. saying " loading failed please check your page for  java script errors"

    Hey, If you have an error, you should see the error in Edge and you can correct it. In the window/code there will be a red dot too.

  • Checking database availability with shell script

    can anyone help with a script that checks for database availability before 10 P.M and 7 A.M at 5 minites interval and starts a SQL Load of a table once the db is available.
    I have no Shell script experience at all but I can amend an already written script.
    Please Help !!

    Dear Timothy,
    Within the Oracle software you have installed on your machine, there is a script called "dbstart" within the <ORACLE_HOME>/bin directory. This script provided by Oracle can be easily modified to check whether the server is up and should help solve your problem.
    Ciao!

  • Check data valid with Java Script

    Hi, every one,
    I made a jsp program and just to check if the data is valid before submit. My problem is even the data is invalid, it still go to next jsp page and display alert message at the same time. But I think if the data is invalid, we can't go to next jsp page. So, any one can tell me what's wrong with my program.
    Thanks in advance.
    The source code is as follows:
    <HTML><HEAD>
    <TITLE>TEST PROGRAM</TITLE>
    <SCRIPT LANGUAGE="JavaScript">
    function validate(){
         if(document.form1.yourname.value.length < 1){
              alert("please enter your full name");
              return false;
         if(document.form1.address.value.length < 3){
              alert("please enter your address.");
              return false;
         if(document.form1.phone.value.length < 3){
              alert("please enter your phone number");
              return false;
         return true;
    </SCRIPT>
    </HEAD>
    <BODY>
    <H1>FORM EXAMPLE</H1>
    Enter the following information. When you press the Display button,
    the data you entered will be validated, then sent by e-mail.
    <form name="form1" action="a2.jsp" enctype="text/plain" onSubmit="validate();">
    <p>
    <b>Name:</b><input type="text" length="20" name="yourname">
    <p>
    <b>Address:</b>
    <input type="text" length="30" name="address">
    <p>
    <b>Phone:</b><input type="text" length="15" name="phone">
    <p>
    <input type="SUBMIT" value="Submit">
    </FORM>
    </BODY>
    </HTML>

    Hi,
    I have another question. If i have a menu as follows and I just want to check the data valid on the current page. I mean, only value=1, 2,3 is valid, value=0 is invalid. How can I do?
    <td valign="middle" width="63%"> <font face="Arial, Helvetica, sans-serif" size="2">
    <select name="type">
    <option value="0">Please Select One of The Following Reasons</option>
    <option value="1">Exchange</option>
    <option value="2">Refund</option>
    <option value="3">Wrong Product</option>
    </select>
    </font></td>
    </tr>
    Thanks.
    peter

  • Checking connectivity to AD via script

    I am trying to come up with a script that would check to see if the mac is connected to AD (ie users can authenticate off AD), and if the mac is not connected, to connect it to AD using the hostname (with some formatting).
    So far I found the dsconfigad command, that allows
    dsconfigad -show
    However this seems to only show the local setup of the machine, not the real AD connectivity status. My test machine is an example.. it was cloned from another machine that is connected to AD, and now it still thinks it is connected to AD, but it will not allow me to log in and authenticate off AD, rather it will only login from a local account.
    Is there an equivalent of a Windows command
    netdom.exe verify "hostname" /d:"domain"
    which actually tests the validity of the connection between the apple and the AD server?
    Thanks a lot!

    You can start by looking in the repository for script that create users from CSV file.s Modify the script to suit your needs.
    Start here:
    https://gallery.technet.microsoft.com/scriptcenter/site/search?f%5B0%5D.Type=RootCategory&f%5B0%5D.Value=activedirectory&f%5B0%5D.Text=Active%20Directory&f%5B1%5D.Type=SubCategory&f%5B1%5D.Value=useraccounts&f%5B1%5D.Text=User%20Accounts
    ¯\_(ツ)_/¯

  • Regarding Pid tool and arithmetic script

    I am working on a labview for controlling electronic load which we had designed I would like to know how the pid tool is written in arithmetic script language in labview that is in which way we can write the pid tool in arithmetic program.

    Hi Amiths,
                       Math Node - https://decibel.ni.com/content/docs/DOC-13859
                       I've not used it myself, but some others here may have some input on this!
    Thanks as kudos only

  • Check PID/VID of a USB Pen/Thumb Drive

    Hi, I would like to read the PID and VID of the USB Pen Drive without using the NI VISA development wizard. This is because, when the pen drive plug in, the windows will automatic detect the windows inf file and install the driver for the pen drive. Is there any way to read and detect the PID/VID of the pen drive such as query the windows registry or call API of the Windows Device Manager?
    Please kindly help! Thanks a lot!

    Unfortunately there is no easy-drive API functions, which can acuire USB device information so easily. Instead, you must use Configuration Manager API, which is declared and implemented in SETUPAPI.H/DLL.  Probably it will be very hard to call them from LabVIEW.  Then you must use
    SetupDiGetClassDevs() - retrieve HDEVINFO handle from the GUID, which is associated with your device or hosted device driver.
    SetupDiEnumDeviceInterface() - enumerate active USB devices from the above-acquired HDEVINFO resulting SP_INTERFACE_DEVICE_DATA
    SetupDiGetInterfaceDeviceDetail() - acquire detail info from SP_INTERFACE_DEVICE_DATA resulting SP_DEVINFO_DATA
    SetupDiGetDeviceInstanceId() - acquire the "device path name" from SP_DEVINFO_DATA, resulting a NULL-terminated string, which will include the USB VID/PID values in hex-format, such as including "USB\VID_xxxx&PID_xxxx\..." string. 
    You can loop above API calls for each enumeration, until the destinate VID and PID are found.

  • Checking if script is running

    I need to find out if a script is not running. When I do the "ps -afe | grep nameOfScript" it gives me no output if the "nameOfScript" is not running. How can I get an output or get a message to say "nameOfScript" is not running. Is there some sort of grep or something I can use to get this to work

    The fact that nothing comes back means the script isn't running - usually. Your script logic is what takes care of saying "Thar ain't nuttin' here honey".
    But using your ps -afe example you need to make sure you only get back instances of the running script. With your example, if I run "vi nameOfScript", your ps -afe command will show my vi command in the list and your script logic may incorrect assumely the script is running when it really isn't.
    You need to make your logic that looks for the script running a bit more specific. The way you run the script will dictate how it shows up in a ps listing. Like this:
    cd /path/to/script
    ./nameOfScript &
    In a "ps -afe", this will show up as the string:
    /bin/ksh ./nameOfScript
    But if you execute it with the full path:
    /path/to/script/nameOfScript &
    It will show up as:
    /bin/ksh /path/to/script/nameOfScript
    So you can see, your logic has to handle all fo these cases. From practical experience, its usually better to have the script create a temporary PID file somewhere. When the script dies, it automagically deletes this file or something. When you check to see if the script is running, you read contents of PID file (assuming it exists), and check a ps listing to see if PID 1234 (or whatever the PID is) is really your script. Kinda a pain in the arse I know but this is usually the best way to handle this.
    Probably more then you asked for ;>

  • Adding a check box in scripts

    Hello experts,
             i got a requirement like to add a check box to the form. is it possible in scripts. if yes can u tell me how can we add a check box in the form(scripts).
    thanks is advance

    thanks yaar.
           but in first option iam not understanding textelement(f9) what is that mean.
    after going to text element we have to press f9 right. then we have to write [] like this in text editor. is it right?
    actually my output is like this
    slno           qty           mtlno      desc
    in the below of slno i have to add check boxes and after that i have to implement some logic if it is checked like that i want.
    thanks & regards
    raj

  • Check box in scripts

    Hi i am Dinakar,
      How can we add a check box in a SAP Script Layout.
      Plz explain the procedure.
    Thanks & Regards
    Dinakar

    Hi,
    Refer the link.Here Checkbox is done in Smartforms.. hope it will be same for Script as well.
    Re: Quick Question on Smartforms
    Re: putting tick mark into check box in smartform
    Reward points if this Helps.
    Manish

  • SAP Script 'space' check in IF  statement

    Hi,
    I want to check for space in SAP script
    i want to check something like
    /: IF &TS_ITEM-USPOS& EQ SPACE
    ZD ...........
    /: ENDIF
    even if the there is space in uspos field this lines under are not printing.
    your help is appriciated.
    thanks
    surya

    Hi Surya,
    It depends of the type of this field 'USPOS'.
    If it's defined, for eg, like POSNR ( NUMC 6 )so the statement is :
    /: IF &TS_ITEM-USPOS& EQ '000000'
    Hope this helps,
    Erwan

  • How to check from a shell script that a particular software is installed

    Hai friends
    I want to write a shell script which has to check whether a particular software is installed on the machine, or not. If installed, then what version is it using and the get the version number and which type of installer is it? i mean is it a .rpm installation or a tar.gz installation.
    how can i check this from a shell script. If any of you have any idea please give me a sample script to check this
    Thank you

    @Raja_Abilash
    I don't think this is a right thread & right forum to POST this question.
    better go ahead with forums related to LINUX.

  • Unicode Check Active For SAP Script

    How to set Unicode Check Active attribute for SAP Script and Smartform

    Hello,
    the Unicode Check Active flag is a program attribute. You can set this flag to check the syntax of an ABAP program. It is not available for SAPScript forms or SAP Smartforms. The attached screenshot shows how the flag is set in the attributes of an example program.
    Best Regards

  • 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

Maybe you are looking for