Help with broken shell script

Hi,
We had the shell script below created for our school last year to keep the students from jumping off of our wireless network so they had to go through our content filters. We put the script on all of the student laptops (MacBooks and MacBook pros) so it ran as a process in the background. It worked beautifully for the  whole year.
Now we are in the process of upgrading our laptops from Snow Leopard to Lion and we've discovered that the script no longer works in Lion. I am guessing it is something simple but I don't see it. Does anyone know what about the OS changed that would cause this script to stop working?
Thanks
Tim
#!/bin/sh
currentSSID=`networksetup -getairportnetwork Airport | awk {'print $4'}`
if [ "$currentSSID" = "optimumwifi" ] ; then
        echo "Disassociating.."
        /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/ai rport --disassociate
        networksetup -setairportnetwork Airport "Student" "only4study!"
fi
if [ "$currentSSID" = "timewarnercablewifi" ] ; then
        echo "Disassociating.."
        /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/ai rport --disassociate
        networksetup -setairportnetwork Airport "Student" "only4study!"
fi
if [ "$currentSSID" = "xfinitywifi" ] ; then
        echo "Disassociating.."
        /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/ai rport --disassociate
        networksetup -setairportnetwork Airport "Student" "only4study!"
fi

Brilliant, that worked perfectly! Thanks for the your help Linc.
Coincidentally, I found a posting on the website stackexchange.com that helped explain why it stopped working in the first placed and why "Airport" alone used to work in Snow Leopard.
Note what it says at the bottom:
"the port name is Wi-Fi on 10.7 and AirPort on 10.6. The device name can be at least en0,en1, or en2 depending on your setup."
http://apple.stackexchange.com/questions/36891/bash-script-to-toggle-wifi-in-lio n

Similar Messages

  • Help with a shell script for schroot

    Since I replaced dchroot with schroot I have a problem.
    In /usr/bin I have a script run32.sh to run 32 bit applications, and symbolic links like acroread32 pointing to run32.sh, firefox32 pointing to run32.sh etc.
    Here is the run32.sh I had before
    #!/bin/bash
    cmd=`basename $0 | sed -n s/32//p`
    for (( i=1; $i<=$#; i=$i+1 )); do
    esc[$i]=$(sed -e 's#\([^[:alnum:]]\)#\\\1#g' <<<${!i})
    done
    exec schroot -p "$cmd" "${esc[@]}"
    The for loop is a trick I stole from the web for escaping some characters.
    But this is not working anymore with schroot.
    So I modified run32.sh like this:
    #!/bin/bash
    cmd=`basename $0 | sed -n s/32//p`
    ct=0
    arg=\"
    for i in "$@"
    do
    ct=$(($ct+1))
    if [ $ct -eq 1 ]
    then
    arg="$arg$i"
    else
    arg="$arg $i"
    fi
    done
    arg=$arg\"
    echo exec schroot -p $cmd $arg
    exec schroot -p $cmd $arg
    Notice that at the end I echo the exec command and then I execute it.
    It works fine for simple arguments, like
    acroread32 foo.pdf
    but not for composite arguments like
    acroread32 foo boo.pdf
    or
    acroread32 foo\ boo.pdf
    (this last one is when I use the tab key to complete the name of the file).
    The thing that I really don't understand is that, typing
    acroread32 foo boo.pdf
    the echoed command is
    exec schroot -p acroread "foo boo.pdf"
    and I get an error
    I: [Arch32-8398824e-10d9-4adf-a299-10c09116e262 chroot] Running command: "acroread foo boo.pdf"
    but then, if i type directly to the command line
    exec schroot -p acroread "foo boo.pdf"
    it opens the file!
    Has somebody a solution to deal both with files like "foo.pdf" and "foo boo.pdf"?

    jacko wrote:Is there any reason your choosing to use acroread over some other form of pdf viewer via a chroot?
    Usually I use kpdf but for some particular features acroread is better. But it's not the point, acroread is just an example. You can do another example with firefox 32 bit, that I use for flash and jre, and mplayer 32 bit, that I use for some win32 codecs.

  • Schedule workbook using with Unix shell script

    Hi,
    Can we schedule workbook using with Unix shell script?
    Thanks,
    Jay

    I can't imagine how.
    1. You can schedule Disco workbooks via Disco itself.
    2. You can schedule Disco workbooks to run and output in different file formats automatically via batch scheduler in Windows running Disco Desktop directly (or can user VBasic).
    3. You can schedule Disco workbooks to run and output in different file formats automatically via a Java program running the Java Command Line interface.
    Moving forward, Oracle has announced that with a further interfacing of Disco with XML Publisher, you'll be able to use Oracle Apps concurrent manager and scheduling. But that's coming supposedly at the end of this year.
    And I think that's about it.
    Russ

  • [solved]Need help with a bash script for MOC conky artwork.

    I need some help with a bash script for displaying artwork from MOC.
    Music folders have a file called 'front.jpg' in them, so I need to pull the current directory from MOCP and then display the 'front.jpg' file in conky.
    mocp -Q %file
    gives me the current file playing, but I need the directory (perhaps some way to use only everything after the last  '/'?)
    A point in the right direction would be appreciated.
    thanks, d
    Last edited by dgz (2013-08-29 21:24:28)

    Xyne wrote:
    You should also quote the variables and output in double quotes to make the code robust, e.g.
    filename="$(mocp -Q %file)"
    dirname="${filename%/*}"
    cp "$dirname"/front.jpg ~/backup/art.jpg
    Without the quotes, whitespace will break the code. Even if you don't expect whitespace in any of the paths, it's still good coding practice to include the quotes imo.
    thanks for the tip.
    here it is, anyhow:
    #!/bin/bash
    filename=$(mocp -Q %file)
    dirname=${filename%/*}
    cp ${dirname}/front.jpg ~/backup/art.jpg
    then in conky:
    $alignr${execi 30 ~/bin/artc}${image ~/backup/art.jpg -s 100x100 -p -3,60}
    thanks for the help.
    Last edited by dgz (2013-08-29 21:26:32)

  • Issue with calling Shell Script using DBMS_SCHEDULER

    Hi All,
    I am executing a shell script using DBMS_SCHEDULER from APEX web page. Execution part is working fine without any issues.
    In my shell script file (abc.sh) I have few oracle sql procedure calls which connects back to same database and that SQL call is not executing some reason, it not giving any errors.
    Inside my shell script code looks like this.
    sqlplus -silent $USER/$PASSCODE@$SCONNECT > /dev/null <<END
    set pagesize 0 feedback off verify off heading off serveroutput on
    echo off linesize 1000
    WHENEVER SQLERROR EXIT 9
    BEGIN     
    dbms_output.enable(1000000);
    do_enable_cons();
    dbms_output.disable;
    END;
    spool off;
    exit;
    END
    When I run this shell script file from backend it works fine now issues.
    Is there any restrictions in executing sql code using DBMS_SCHEDULER? Any ones help is much appreciated.
    -Regards

    james. wrote:
    Thanks you sb and Sybrand . It is problem with environment variables. After running .bash_profile in the beginning of the shell script, it is working fine.
    One issue is when I check the process it is showing two entries with two different process id's.
    The command I used
    ps -ef | grep <my script> is COPY & PASTE broken for you?
    any reason why you did not show us EXACTLY was produced by OS command above?
    >
    Is it something wrong with my code or is it normal? Is it really executing two times ?
    -Regards
    bcm@bcm-laptop:~$ sqlplus user1/user1
    SQL*Plus: Release 11.2.0.1.0 Production on Fri Jul 20 15:14:15 2012
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    15:14:15 SQL> !ps -ef | grep sqlplus
    bcm      24577  1903  1 15:14 pts/0    00:00:00 sqlplus           
    bcm      24579 24577  0 15:14 pts/0    00:00:00 /bin/bash -c ps -ef | grep sqlplus
    bcm      24581 24579  0 15:14 pts/0    00:00:00 grep sqlplus
    15:14:23 SQL> how many different copies of "sqlplus" running on my laptop based upon actual output above?

  • Trying to run program off network location using GPO with Power shell script.

    Hello All,
    Not much of a script writer. I am giving it a shot.  My issue is that I need to run a application update across our network and I am trying to do it with as little hands on as possible. So I was planning to push a GPO with a power shell script in it
    to run the program with elevated privileges. 
    Little background:
    We are running on a domain and end users do not have admin rights.
    The application is stored on a share on our network that is open to all domain users.
    The installer user name and password is a temp one and will only be valid for the 30 min window when everyone logs in at the beginning of the day.
    So this is what I have so far.
    $username = "USER"
    $password = "PASSWORD"
    $credentials = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
    Start-Process PSQLv11Patch_Client_x86.msp -Credential ($credentials) -WorkingDirectory \\Server\Folder\Folder1\Folder2\filder3\PSQLv11sp3_x32\
    But for some reason I keep getting :
    Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
    At line:10 char:1
    + Start-Process PSQLv11Patch_Client_x86.msp -Credential ($credentials) -WorkingDir ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
        + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
    Any help you could give would be great.
    Thanks,
    jdfmonkey

    Hi jdfmonkey,
    Has anyone provided an answer to your original question?  I am trying to use Start-Process to launch a process using another logged in user's credentials, and am not able to get it working:
    $cred=Get-Credential
    start-process Process.exe-WorkingDirectoryC:\Scripts-Credential$cred
    I get the same error that you mentioned:
    start-process : This command cannot be run due to the error: The system cannot find the file specified.
    At C:\Scripts\Process.ps1:2 char:1
    + start-process Process.exe -WorkingDirectory C:\Scripts -Credential ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
        + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
    When I leave off the credentials:
    start-processProcess.exe-WorkingDirectoryC:\Scripts
    It works correctly.  Does anyone have a solution to make this work correctly?
    Please ask your own question.  You issue is nothing like the current thread.  You clearly are using a user account that has no access to the folder.  It is a permissions issue.  It is not a scripting issue.
    If you need further help please start your own question.
    ¯\_(ツ)_/¯

  • Need Help on Executing Shell Scripts through PL-SLQ

    Hi All,
    I am trying to execute a shell script from PL-SQL but I am not getting it right .
    the code i used is as follows
    ----JAVA CLASS ---
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Host" AS
    import java.io.*;
    public class Host {
    public static void executeCommand(String command) {
    try {
    String[] finalCommand;
    if (isWindows()) {
    finalCommand = new String[4];
    // Use the appropriate path for your windows version.
    finalCommand[0] = "C:\\windows\\system32\\cmd.exe"; // Windows XP/2003
    //finalCommand[0] = "C:\\winnt\\system32\\cmd.exe"; // Windows NT/2000
    finalCommand[1] = "/y";
    finalCommand[2] = "/c";
    finalCommand[3] = command;
    else {
    finalCommand = new String[3];
    finalCommand[0] = "/bin/sh";
    finalCommand[1] = "-c";
    finalCommand[2] = command;
    final Process pr = Runtime.getRuntime().exec(finalCommand);
    pr.waitFor();
    new Thread(new Runnable(){
    public void run() {
    BufferedReader br_in = null;
    try {
    br_in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
    String buff = null;
    while ((buff = br_in.readLine()) != null) {
    System.out.println("Process out :" + buff);
    try {Thread.sleep(100); } catch(Exception e) {}
    br_in.close();
    catch (IOException ioe) {
    System.out.println("Exception caught printing process output.");
    ioe.printStackTrace();
    finally {
    try {
    br_in.close();
    } catch (Exception ex) {}
    }).start();
    new Thread(new Runnable(){
    public void run() {
    BufferedReader br_err = null;
    try {
    br_err = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
    String buff = null;
    while ((buff = br_err.readLine()) != null) {
    System.out.println("Process err :" + buff);
    try {Thread.sleep(100); } catch(Exception e) {}
    br_err.close();
    catch (IOException ioe) {
    System.out.println("Exception caught printing process error.");
    ioe.printStackTrace();
    finally {
    try {
    br_err.close();
    } catch (Exception ex) {}
    }).start();
    catch (Exception ex) {
    System.out.println(ex.getLocalizedMessage());
    public static boolean isWindows() {
    if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1)
    return true;
    else
    return false;
    ---PROCEDURE TO BE EXECUTED WHICH USES THE ABOVE JAVA CLASS IS ----
    CREATE OR REPLACE PROCEDURE Host_Command (p_command IN VARCHAR2)
    AS LANGUAGE JAVA
    NAME 'Host.executeCommand (java.lang.String)';
    --- THE PERMISSIONS ---
    call dbms_java.grant_permission('SYSTEM', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'read ,write, execute, delete');
    call dbms_java.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
    call dbms_java.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
    --- THE SHELL SCRIPT IS -----
    #!/bin/sh
    # This script removes the carriage returns from the Files having .DAT1 extensions in the /test/ Directory
    # and the sends the single line stream to the new file with the use of 'gawk' command
    # so finaly the files with same primary name but different secondary name are created
    # e.g. file 'test.DAT1' is onverted to 'test.DAT'
    # LOOP on /test/ DIRECTORY FOR SEARCHING FILES HAVING EXTENSION *.DAT1
    for file_name in `ls /test/*.DAT1`
    do
    new_file_name=`echo $file_name | sed 's/DAT1/DAT/'`
    # SEND THE CONTAINTS OF SELECTED FILE IN LOOP AS A CONTINUOUS STREAM TO NEW FILE NAME USING 'gawk' COMMAND
    gawk 'BEGIN { ORS = "''" } { print $0 }' $file_name >> $new_file_name
    # ABOVE LINE WILL CREATE A NEW FILE WITH SAME PRIMARY NAME BUT .DAT AS SECONDARY NAME(EXTENSION)
    # REMOVE THE PRIOR FILE(s) AFTER SUCCESSFUL CALL TO 'gawk'
    # $? returns 0 if the call to gawk command is succesfull
    if test 0 = "$?"
         then
         rm -f $file_name
    fi
    done
    # END LOOP ON /test/ DIRECTORY
    ---THE CALL TO THE PROCEDURE --
    SQL>CALL DBMS_JAVA.SET_OUTPUT(1000000);
    SQL>SET SERVEROUTPUT ON SIZE 1000000
    SQL>exec host('/root/sh ecs_script.sh'); -----------------------------------------------1
    now, the statement 1 is the path of the Shell Script ecs_script.sh
    which uses gawk command and does some operations on some file..
    but when i give the call in Statement 1 its giving error like
    /bin/sh is not a directory
    so i am not getting wHat should I do so that my script "ecs_script.sh" gets executed..
    Please Help.

    @ Bhagat & Michaels
    Dear Friends,
    I changed my shell name as per ur suggestions
    and recompiled the Java class source with
    finalCommand[0] = "/bin/bash"; instead of finalCommand[0] = "/bin/sh";
    and then recompiled the host procedure
    executed the host procedure as per ur suggestion as follows (with out put)
    SQL> exec host('/bin/bash ecs_script.sh')
    PL/SQL procedure successfully completed.
    bt, bt, bt, it still did not do any operations defined in the "ecs_script.sh"
    in fact the script did nt executed.......
    pls help , I am loosing my time..
    regards.

  • Editing question, preferably with "do shell script"

    I would like to edit an expression
    from: blah blah /Paragraphs/one two three
    to: blah blah /Paragraphs/one-two-three
    where "/Paragraphs/" is always present
    but "one" might be anything
    Using sed with regexp seems like a way to go, but I don't know how to designate "one," which will vary. Viz.:
    set T to "blah blah /Paragraphs/one two three"
    set T1 to do shell script "echo " & quoted form of T & " | sed 's/\\/Paragraphs\\/{anything}/\\/Paragraphs\\/{anything}(change all subsequent spaces to "-")/g'"

    Hi,
    Can't believe I did it with sed! My test.txt file looks like this:
    blah blah #one here's some text
    blah blah #two more text
    blah blah #three and even more text
    #four number begins this line
    Here's the sed part:
    sed 's/#/\
    #/' < test.txt | sed '/#/ s/ /-/g' | sed '
    N
    s/\n#/#/
    Here I used "#" instead of "/Paragraphs/". Now, you translate this into a do shell script. If you need help with that, then write back. I now understand the N command for working with multiple line processing. Here's the tutorial I used:
    http://www.grymoire.com/Unix/Sed.html
    Edited: and here's the output
    blah blah #one-here's-some-text
    blah blah #two-more-text
    blah blah #three-and-even-more-text
    #four-number-begins-this-line
    gl,

  • Having problems with a shell script

    I'm trying to write a shell script that will echo back the command, and ask for confirmation before proceeding with the command.
    Here is what I have so far:
    Josh:~ josh$ cat ~/Desktop/safe
    #!/bin/sh
    echo "You have typed: "$1 $2 $3 $4"."
    read -p "Are you sure you want to continue? (y/n)" a
    if [ "$a" = "y" ]; then
    $1 $2 $3 $4
    elif [ "a" = "n" ]; then
    exit
    elif [ "a" != "y" ] [ "a" != "n" ];then
    echo "Type y or n."
    fi
    When I run it, and type n, (y works fine) I get a syntax error: ./safe: line 10: [: too many arguments
    Could you please help me fix it?
    Thanks!
    EDIT: If I change the last "elif" statement to a simple "else", it automatically does that statement anyway when the user types "n".
    Is there any better way to end the script when the user types "n"?
    Message was edited by: joshz
    Message was edited by: joshz
    Message was edited by: joshz
    Message was edited by: joshz

    joshz wrote:
    A few q's.
    1. you have "n=$#", but never use n. What is that for?
    Er... because I originally did it differently and then forgot to go back and delete this line!
    2. Why do you set list to a blank string? Just to initialize it?
    Yes. Habit. Sometimes it is an error to use an unassigned variable. It would not matter in this case because echo will not complain, but it still appeals to my sense of logic/tidiness. It also means that if I later change something in my script so that an unassigned variable will cause an error, I won't be stymied by a failure I can't explain. (Not really an issue in a script this short but might well be in a longer script.)
    3. "sed 's+, $+ and all enclosed files/folders+'" What does it do? What is s supposed to do? I know that s treats a string as a single line, but what's the purpose of that (and the +)? $+ would stand for the end of a line, but repeated one or more times. Why have the +'s?
    In this case, s is for substitute. The + is an arbitrary delimeter. A forward slash is standard, but if I use + I don't have to escape the slash in the phrase "and... files/folders". The whole thing says:
    Take the piped output from echo and find every occurrence of the pattern consisting of a comma followed by a space followed by an end of line (on every line of the piped input, but there's only one here). Substitute the first occurrence you find (on every line of the piped input, but there's only one here) with a space followed by "and... files/folders".
    Also, I ideally want the "and all enclosed files/folders" to appear only if there is a recursive option turned on, not all the time. (I guess it would be good enough to have it turn on if there's an r OR R option, because it would be too hard to program it in based on each command).
    To do that properly, you need to do things differently so that you can distinguish between arguments to the command and occurrences of strings in the names of files and folders. For example, you might have a folder named "My Folder-Revised". There are ways of doing this but they are not as simple as the sort of framework you're using here.
    If you are concerned about accidentally deleting files, have you considered using an alias called "rm" for "rm -i". That way, you do not have to remember to use "safe" either. Unfortunately, that won't work for "sudo rm". On the other hand, "sudo safe" won't necessarily work either. Where are you planning to install your script?
    - cfr

  • Help on preparing shell script for setting the listener password

    Hi All,
    I am working on checking all my DB servers listeners and if the password is not set for the listener then I need to set the password for that.
    As we have many servers, I am planning to prepare the shell script for doing this task.
    I am familiar with setting up the listener password manually, but strucked up to prepare the shell script to do the same task.
    Can any one kindly help me on this.
    Thanks in advance,
    Mahi

    815537 wrote:
    Could any body please help me.
    Thanks,
    MahiPatience, Grasshopper
    This forum is not a chat line, and it is not paid support.
    No one is responsible for monitoring it and giving a quick response.
    Furthermore, it is a global forum. The person with the information you seek may very well live 20 time zones away from you and was going to bed just as you posted. He will not even see your post for several more hours.
    Your original post went up in the middle of the night for half the world.
    No one with the information you seek is deliberately withholding it until you sound sufficiently desperate.

  • Help with Custom calculation script in Acrobat 8

    Hi all, I am using acrobat 8 on OS 10.5
    I am trying to add certain fields (numbers) and then subtract another field value to give an end result.
    I don't know anything about Javascript, would anyone be able to help with any info on how I achieve this result? I can only see Add, x and average etc... nothing there for subtraction
    Thanks for any help in advance
    Swen

    This should get you started:
    >if (event) {
    // get values from two text fields
    var a = Number(this.getField('Text1').value);
    var b = Number(this.getField('Text2').value);
    // subtract the values and show it
    this.event.target.value = a - b;
    Place this in a 3d text field, as a Custom Calculation Script.

  • Help with first Adobe Script for AE?

    Hey,
    I'm trying to create a script that will allow me to set a certain number of layer markers at an even interval to mark out a song. Could someone help me troubleshoot this script? I've been working on it for ages now, and I'm about to snap. I've basically gone from HTML and CSS, to javascript and Adobe scripting in the past few hours, and I cannot figure this out for the life of me.
    I want to create a dialog with two fields, the number of markers to place, and the tempo of the song. Tempo is pretty simple, its just the number of beats per minute. The script is meant to start at a marker that I have already placed, and set a new marker at incrementing times. Its mainly to help me see what I'm trying to animate too, even if the beat is a little hard to pick up every once in a while.
    Also, is there a better way to do this? This script will help me in the long run because I will need to do this pretty often, but I'm wondering if there was something that I could not find online that would have saved me these hours of brain-jumbling?
    Thank you very much for any help you can offer.
        // Neo_Add_MultiMarkers.jsx
        //jasondrey13
        //2009-10-26
        //Adds multiple markers to the selected layer.
        // This script prompts for a certain number of layer markers to add to the selected audio layer,
        //and an optional "frames between" to set the number of frames that should be skipped before placing the next marker
        // It presents a UI with two text entry areas: a Markers box for the
        // number of markers to add and a Frames Between box for the number of frames to space between added markers.
        // When the user clicks the Add Markers button,
        // A button labeled "?" provides a brief explanation.
        function Neo_Add_MultiMarkers(thisObj)
            // set vars
            var scriptName = "Neoarx: Add Multiple Markers";
            var numberOfMarkers = "0";
            var tempo = "0";
            // This function is called when the Find All button is clicked.
            // It changes which layers are selected by deselecting layers that are not text layers
            // or do not contain the Find Text string. Only text layers containing the Find Text string
            // will remain selected.
            function onAddMarkers()
                // Start an undo group.  By using this with an endUndoGroup(), you
                // allow users to undo the whole script with one undo operation.
                app.beginUndoGroup("Add Multiple Markers");
                // Get the active composition.
                var activeItem = app.project.activeItem;
                if (activeItem != null && (activeItem instanceof CompItem)){
                    // Check each selected layer in the active composition.
                    var activeComp = activeItem;
                    var layers = activeComp.selectedLayers;
                    var markers = layers.property("marker");
                    //parse ints
                    numberOfMarkers = parseInt (numberOfMarkers);
                    tempo = parseInt (tempo);
                    // Show a message and return if there is no value specified in the Markers box.
                    if (numberOfMarkers < 1 || tempo < 1) {
                    alert("Each box can take only positive values over 1. The selection was not changed.", scriptName);
                    return;
                    if (markers.numKeys < 1)
                    alert('Please set a marker where you would like me to begin.');
                    return;
                    var beginTime = markers.keyTime( 1 );
                    var count = 1;
                    var currentTime = beginTime;
                    var addPer = tempo/60;
                    while(numberOfMarkers < count)
                    markers.setValueAtTime(currentTime, MarkerValue(count));
                    currentTime = currentTime + addPer;
                    if (count==numberOfMarkers) {
                        alert('finished!');
                        return;
                    else{
                        count++;
                app.endUndoGroup();
        // Called when the Markers Text string is edited
            function onMarkersStringChanged()
                numberOfMarkers = this.text;
            // Called when the Frames Text string is edited
            function onFramesStringChanged()
                tempo = this.text;
            // Called when the "?" button is clicked
            function onShowHelp()
                alert(scriptName + ":\n" +
                "This script displays a palette with controls for adding a given number of markers starting at a pre-placed marker, each separated by an amount of time determined from the inputted Beats Per Minute (Tempo).\n" +
                "It is designed to mark out the even beat of a song for easier editing.\n" +
                "\n" +
                "Type the number of Markers you would like to add to the currently selected layer. Type the tempo of your song (beats per minute).\n" +           
                "\n" +
                "Note: This version of the script requires After Effects CS3 or later. It can be used as a dockable panel by placing the script in a ScriptUI Panels subfolder of the Scripts folder, and then choosing this script from the Window menu.\n", scriptName);
            // main:
            if (parseFloat(app.version) < 8)
                alert("This script requires After Effects CS3 or later.", scriptName);
                return;
            else
                // Create and show a floating palette
                var my_palette = (thisObj instanceof Panel) ? thisObj : new Window("palette", scriptName, undefined, {resizeable:true});
                if (my_palette != null)
                    var res =
                    "group { \
                        orientation:'column', alignment:['fill','fill'], alignChildren:['left','top'], spacing:5, margins:[0,0,0,0], \
                        markersRow: Group { \
                            alignment:['fill','top'], \
                            markersStr: StaticText { text:'Markers:', alignment:['left','center'] }, \
                            markersEditText: EditText { text:'0', characters:10, alignment:['fill','center'] }, \
                        FramesRow: Group { \
                            alignment:['fill','top'], \
                            FramesStr: StaticText { text:'Tempo:', alignment:['left','center'] }, \
                            FramesEditText: EditText { text:'140', characters:10, alignment:['fill','center'] }, \
                        cmds: Group { \
                            alignment:['fill','top'], \
                            addMarkersButton: Button { text:'Add Markers', alignment:['fill','center'] }, \
                            helpButton: Button { text:'?', alignment:['right','center'], preferredSize:[25,20] }, \
                    my_palette.margins = [10,10,10,10];
                    my_palette.grp = my_palette.add(res);
                    // Workaround to ensure the editext text color is black, even at darker UI brightness levels
                    var winGfx = my_palette.graphics;
                    var darkColorBrush = winGfx.newPen(winGfx.BrushType.SOLID_COLOR, [0,0,0], 1);
                    my_palette.grp.markersRow.markersEditText.graphics.foregroundColor = darkColorBrush;
                    my_palette.grp.FramesRow.FramesEditText.graphics.foregroundColor = darkColorBrush;
                    my_palette.grp.markersRow.markersStr.preferredSize.width = my_palette.grp.FramesRow.FramesStr.preferredSize.width;
                    my_palette.grp.markersRow.markersEditText.onChange = my_palette.grp.markersRow.markersEditText.onChanging = onMarkersStringChanged;
                    my_palette.grp.FramesRow.FramesEditText.onChange = my_palette.grp.FramesRow.FramesEditText.onChanging = onFramesStringChanged;
                    my_palette.grp.cmds.addMarkersButton.onClick    = onAddMarkers;
                    my_palette.grp.cmds.helpButton.onClick    = onShowHelp;
                    my_palette.layout.layout(true);
                    my_palette.layout.resize();
                    my_palette.onResizing = my_palette.onResize = function () {this.layout.resize();}
                    if (my_palette instanceof Window) {
                        my_palette.center();
                        my_palette.show();
                    } else {
                        my_palette.layout.layout(true);
                else {
                    alert("Could not open the user interface.", scriptName);
        Neo_Add_MultiMarkers(this);

    You should ask such questions over at AEnhancers. I had a quick look at your code but could not find anything obvious, so it may relate to where and when you execute certain functions and how they are nested, I just don't have the time to do a deeper study.
    Mylenium

  • Help with web form script. PHP, CGI, Perl???

    anyone willing to help with a web form script? I have a form built, but cant seem to figure out the scripting! Should I be using Perl, CGI, PHP... What do I need to enable? I am a complete novice when it comes to scripts. Looking for a little friendly help.

    Here is a simple bit of PHP to stick in the page your form posts to. You would need to edit the first three variables to your liking, and add the html you want to serve afterwards:
    <pre>
    <?php
    $emailFrom = '[email protected]';
    $emailTo = '[email protected]';
    $emailSubject = 'Subject';
    $date = date('l, \t\h\e dS \o\f F, Y \a\t g:i A');
    $browser = $HTTPSERVER_VARS['HTTP_USERAGENT'];
    $hostname = $HTTPSERVER_VARS['REMOTEADDR'];
    $message = "$date\n\nAddress: $hostname\nBrowser: $browser\n\n";
    foreach ($_POST as $key => $value) {
    $message .= $key . ": " . $value . "\n";
    $mailResult = mail($emailTo,$emailSubject,$message,"From: $emailFrom");
    ?>
    </pre>
    This script will grab the server's date and the submitter's address and browser type. It will then list the name and value of each form field you have put on your form.
    Also, this script expects your form method="post".
    Lastly, you can offer alternate text later on in your html page based on the success of the above script with a snippet like this:
    <pre><?php
    if ($mailResult) {
    echo "Your comments have been received thank you.";
    } else {
    echo "There was an error. Please try again or contact us using an alternate method.";
    ?></pre>

  • Trying to close an app with a shell script which was launched by same app.

    This may be simple, but is confusing me. I have an app that executes a shell script at launch. The script is designed to check for the existence of files and if not found, I want to display a message and close the application. The problem seems to be that I can't close the app with the script, since the script was called by the app and the shell is tied up. Does that make sense? I can't close the app because the script/shell is still active. Any ideas?

    Just have the script output some value for the app to read and then quit. Once the app reads the value, it will wait for the script to quit (shouldn't take long, especially if the script isn't running anymore) and then, if the value is a flag to quit, quit.

  • SQLPLUS Help with a Linux Script

    I am receiving an SQLPLUS error of 155.
    Apparently my SQL code is being truncated (I believe).
    I originally had all of this code on separate lines to make it readable. Unfortunately for that try I also received a return code of 155.
    I copied this SQL from my SQL DEVELOPER where this SQL works properly.
    Can anybody make any suggestions?
    BTW, I am newbie to both Linux Shell Scripts, SQL, and SQLPLUS.
    Here is the log from the run of the script:
    SQL*Plus: Release 11.2.0.2.0 Production on Fri May 4 17:49:38 2012
    Copyright (c) 1982, 2010, Oracle. All rights reserved.
    SQL> SQL> Connected.
    SQL> SQL> SQL>           SELECT to_char(c.update_date, 'FMMonth, YYYY') 'Shipment Update Date'||'|'||b.SHIPMENT_GID 'Shipment Number'||'|'||count (distinct (b.SHIPMENT_GID)) 'No of Shipments'||'|'||count(distinct(a.i_transaction_no)) 'Auctions per Shipment'||'|'||count(*) 'No. of Carriers Notified'||'|'||sum (case when a.responding_gl_user_gid is null then 0 else 1 end) 'No of Bidders'||'|'||min (numtodsinterval((b.expected_response - b.insert_date),'day')) 'Duration of Auction'||'|'||min (numtodsinterval((a.update_date - a.transaction_time),'day')) 'Elapse time for first bid'||'|'||max (numtodsinterval((a.update_date - a.transaction_time),'day')) 'Elapse time for last bid'||'|'||numtodsinterval((max(a.update_date) - min(a.update_date)),'day') 'Elapse time of bidding'||'|'||numtodsinterval((max(b.shipment_time) - max(c.insert_date)),'day') 'Lead Time of Auction to P/U'||'|'||(max(a.bid_amount) - min(a.bid_amount)) 'High Bid- Low Bid Diff' from tender_collab_servprov a, tender_collaboration b, shipment c where a.i_transaction_no = b.i_transaction_no and b.shipment_gid not in (select sqa.shipment_gid from tender_collaboration sqa, tender_collab_servprov sqb where sqa.i_transaction_no = sqb.i_transaction_no and sqb.acceptance_code = 'A') and a.i_transaction_no in (select i_transaction_no from tender_collaboration where tender_type = 'Spot Bid') and b.shipment_gid = c.shipment_gid AND c.update_date >= trunc(last_day(to_date((to_char(add_months(SYSDATE,-2), 'MM-DD-YYYY')),'MM-DD-YYYY')) + 1) group by c.update_date, b.SHIPMENT_GID order by c.update_date, b.shipment_GID
    ERROR at line 1:
    ORA-00923: FROM keyword not found where expected
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Here is the Linux Shell script:
    /bin/sh
    LOGFILE="$(date +"%Y-%m-%d %H") Oracle REPORT LOG.TXT"
    FILENAME="$(date +"%Y-%m-%d") PROD Unfinished Spot Bids.CSV"
    echo "File Name for the spool is:" "$FILENAME"
    #spool "$FILENAME"
    sqlplus /nolog <<EOF >$LOGFILE
    whenever sqlerror exit sql.sqlcode
    connect glog_read/parker@OTMDEV
    spool PROD_Unfinished.CSV
    set linesize 32000 trimspool on pagesize 3000
              SELECT to_char(c.update_date, 'FMMonth, YYYY') 'Shipment Update Date'||'|'||b.SHIPMENT_GID 'Shipment Number'||'|'||count (distinct (b.SHIPMENT_GID)) 'No of Shipments'||'|'||count(distinct(a.i_transaction_no)) 'Auctions per Shipment'||'|'||count(*) 'No. of Carriers Notified'||'|'||sum (case when a.responding_gl_user_gid is null then 0 else 1 end) 'No of Bidders'||'|'||min (numtodsinterval((b.expected_response - b.insert_date),'day')) 'Duration of Auction'||'|'||min (numtodsinterval((a.update_date - a.transaction_time),'day')) 'Elapse time for first bid'||'|'||max (numtodsinterval((a.update_date - a.transaction_time),'day')) 'Elapse time for last bid'||'|'||numtodsinterval((max(a.update_date) - min(a.update_date)),'day') 'Elapse time of bidding'||'|'||numtodsinterval((max(b.shipment_time) - max(c.insert_date)),'day') 'Lead Time of Auction to P/U'||'|'||(max(a.bid_amount) - min(a.bid_amount)) 'High Bid- Low Bid Diff' from tender_collab_servprov a, tender_collaboration b, shipment c where a.i_transaction_no = b.i_transaction_no and b.shipment_gid not in (select sqa.shipment_gid from tender_collaboration sqa, tender_collab_servprov sqb where sqa.i_transaction_no = sqb.i_transaction_no and sqb.acceptance_code = 'A') and a.i_transaction_no in (select i_transaction_no from tender_collaboration where tender_type = 'Spot Bid') and b.shipment_gid = c.shipment_gid AND c.update_date >= trunc(last_day(to_date((to_char(add_months(SYSDATE,-2), 'MM-DD-YYYY')),'MM-DD-YYYY')) + 1) group by c.update_date, b.SHIPMENT_GID order by c.update_date, b.shipment_GID;
    spool off
    EOF
    RV=$?
    echo "The return code fronm the sqlplus was:" "$RV"

    Looks the SELECT clause have missing pipes. See corrected one below :
    The shell script format has alread been given above.
    SELECT TO_CHAR(c.update_date, 'FMMonth, YYYY')                                  || 'Shipment Update Date'        || '|' ||
           b.shipment_gid                                                        || 'Shipment Number'             || '|' ||
           COUNT(DISTINCT(b.shipment_gid))                                       || 'No of Shipments'             || '|' ||
           COUNT(DISTINCT(a.i_transaction_no))                                   || 'Auctions per Shipment'       || '|' ||
           COUNT(*)                                                              || 'No. of Carriers Notified'    || '|' ||
           SUM(CASE WHEN a.responding_gl_user_gid IS NULL THEN  0  ELSE  1 END)  || 'No of Bidders'               || '|' ||
           MIN(numtodsinterval((b.expected_response - b.insert_date), 'day'))    || 'Duration of Auction'         || '|' ||
           MIN(numtodsinterval((a.update_date - a.transaction_time), 'day'))     || 'Elapse time for first bid'   || '|' ||
           MAX(numtodsinterval((a.update_date - a.transaction_time), 'day'))     || 'Elapse time for last bid'    || '|' ||
           numtodsinterval((MAX(a.update_date) - MIN(a.update_date)), 'day')     || 'Elapse time of bidding'      || '|' ||
           numtodsinterval((MAX(b.shipment_time) - MAX(c.insert_date)), 'day')   || 'Lead Time of Auction to P/U' || '|' ||
           (MAX(a.bid_amount) - MIN(a.bid_amount))                               || 'High Bid- Low Bid Diff'
    FROM   tender_collab_servprov a,
           tender_collaboration b,
           shipment c
    WHERE  a.i_transaction_no = b.i_transaction_no
    AND    b.shipment_gid NOT IN  ( SELECT sqa.shipment_gid
                                    FROM   tender_collaboration sqa,
                                           tender_collab_servprov sqb
                                    WHERE  sqa.i_transaction_no = sqb.i_transaction_no
                                    AND    sqb.acceptance_code = 'A')
    AND    a.i_transaction_no IN (SELECT i_transaction_no
                                  FROM   tender_collaboration
                                  WHERE  tender_type = 'Spot Bid')
    AND    b.shipment_gid = c.shipment_gid
    AND    c.update_date >= trunc(last_day(to_date((to_char(add_months(SYSDATE, -2),'MM-DD-YYYY')),'MM-DD-YYYY')) + 1)
    GROUP  BY c.update_date, b.shipment_gid
    ORDER  BY c.update_date, b.shipment_gid
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for

  • Flash Builder RichTextEditor extra line feeds

    In Flash Builder 4 I am using the RichTextEditor, specifically for the formatting features.  The input is stored in a MySql database; when I retrieve the html text back and shown again in RichTextEditor it has extra line feeds, if I show the text in

  • Good receipts output type

    Hi, I am trying to trigger Output type for EDI to generate IDOC - while doing Good receipt against Purchase order. Steps followed to do this - Vendor Parnter functions maintained. Created a PO. NACE for Application 'ME' - Condition record maintained

  • Error in KPF6 Transaction.

    Hi Gurus, When I am trying to post the post plan costs to R&D order through the transaction code KPF6 Iam getting the following message Order interval 100000 - 199999 is empty Message no. KO028 Please help me to fix the above issue. Thanks in Advance

  • Downloading packages and class files

    Hi Friends I have a query regarding downloading packages . I have a LdapHelper class defined in a package of com.beasys.commerce.bridge.ldap of wls 2.0 version . I want that package to be imported to my wls of 8.1 version . Is this feasible ? . Can i

  • 3rd generation nano entire contents of ipod not showing up..

    3rd generation nano entire contents of ipod not showing up, itunes says to restore, however I am pretty certain this erases all contents. Is there anyway to retrieve the seemingly lost content, what do I do? I have had little to no prior issues with