Help with automatic unmounting via script

Sorry, for some reason, this question got posted twice.
I would like to reroute you to this thread: http://discussions.apple.com/thread.jspa?threadID=1610643&tstart=0
Could some kind soul please help me a bit with some applescript?
I would need two things in applescript:
1. A way to check whether a certain external (firewire) disk is mounted
(so that I can unount, er, eject it, if it is there)
2. A way to make an applescript being executed whenever the laptop goes to sleep.
For the interested reader:
what I want to do is to write an applescript that would automatically unmount my external backup disk whenever the laptop goes to sleep.
Oftentimes I forget to do that myself, then, when the computer is asleep and I want to unplug everything to take it home, I remember that I haven't properly ejected the backup disk ...
Any hints, pointers, tips will be appreciated!
Best regards,
Gabriel.
Message was edited by: GabrielZ

TeHDoHBoY wrote:
*sudo rm -rf ~/Library/Caches*
*sudo ln -s /private/tmp ~/Library/Caches*
If you have a script using "sudo", it will always prompt for a password. The easy way to call this is put your script in /Library/Resources/Scripts/ (you'll have to create the Resources/Scripts/ path) and follow these steps.
Step 1.) Edit your script and take out the "sudo" commands, leaving the following:
rm -rf ~/Library/Caches*
ln -s /private/tmp ~/Library/Caches*
Step 2.) Then open up Terminal and execute the following commands:
chown root:wheel /Library/Resources/Scripts/NameOfYourScript.sh
chmod 755 /Library/Resources/Scripts/NameOfYourScript.sh
Now create your login hook to call this script. If I'm correct, the script will run as root and not prompt the student for a password.

Similar Messages

  • [SOLVED] Need a little help with ACPI handler.sh script.

    By using ACPI I'm trying to get my laptop to hibernate at critical power state. So far I've made a few test scripts to test how to do this, with one of these scripts I'm stuck. My scripting skills are not that good to solve it.
    This is the script:
    if [ `awk '{print $3}' /proc/acpi/battery/C1E9/state` == "ok" ]
    then
    logger "battery is ok"
    else
    logger "battery is not ok"
    fi
    If I run the script I get an error (while "battery is not ok" is logged):
    ┌─[~]
    └─> ./test2
    ./test2: line 1: [: too many arguments
    ┌─[~]
    └─>
    When I run the awk-command from the script, I get the following output:
    ┌─[~]
    └─> awk '{print $3}' /proc/acpi/battery/C1E9/state
    ok
    discharging
    2341
    1824
    10969
    ┌─[~]
    └─>
    I think the problem lies in the multiple output of the awk-command, but I'm stuck in solving it.
    Any help would be great.
    Last edited by NeoXP (2009-11-16 22:40:45)

    @ skanky
    Thanks for the suggestion, but you're right I'm not gonna change a working script. It is working exactly as expected.
    @ all
    When interested this is my current handler.sh
    #!/bin/sh
    # Default acpi script that takes an entry for all actions
    # NOTE: This is a 2.6-centric script. If you use 2.4.x, you'll have to
    # modify it to not use /sys
    minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
    maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
    setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
    set $*
    case "$1" in
    button/power)
    echo "PowerButton pressed!">/dev/tty5
    case "$2" in
    PWRF) logger "PowerButton pressed: $2" ;;
    *) logger "ACPI action undefined: $2" ;;
    esac
    button/sleep)
    case "$2" in
    SLPB) echo -n mem >/sys/power/state ;;
    *) logger "ACPI action undefined: $2" ;;
    esac
    ac_adapter)
    case "$2" in
    AC)
    case "$4" in
    00000000)
    echo -n $minspeed >$setspeed
    #/etc/laptop-mode/laptop-mode start
    00000001)
    echo -n $maxspeed >$setspeed
    #/etc/laptop-mode/laptop-mode stop
    esac
    *) logger "ACPI action undefined: $2" ;;
    esac
    battery)
    if [ `awk '{print $2}' /proc/acpi/ac_adapter/C1E8/state` == "off-line" ];
    then
    logger "battery discharging"
    if (( `awk '{if (NR==5) {print $3}}' /proc/acpi/battery/C1E9/state` >= "250" ))
    then
    logger "battery ok"
    else
    logger "battery not ok"
    /usr/sbin/pm-hibernate;
    fi
    else logger "battery charging"
    fi
    button/lid)
    if [ `awk '{print $2}' /proc/acpi/button/lid/C1ED/state` == "closed" ];
    then
    logger "ACPI lid closed"
    /usr/sbin/pm-suspend
    fi
    logger "ACPI group/action undefined: $1 / $2"
    esac
    Still working on it though

  • Help with selecting files from script menu or drag and drop

    I found this scale images applescript online. It works great when a bunch of files is dragged on top of the script but I would like it to also work when a folder or group of files is selected in the Finder and I activate it from the scripts menu.
    I can't get my on run statement to work. I'm not really an Applescript guy so I'm really just asking if someone can help finish what I started in this on run.
    -- save in Script Editor as Application
    -- drag files to its icon in Finder
    property target_width : 120
    property save_folder : ""
    on run
    tell application "Finder"
    activate
    set folder_path to quoted form of (POSIX path of (the selection as alias))
    set theItems to every file of folder_path
    end tell
    end run
    on open some_items
    -- do some set up
    tell application "Finder"
    -- get the target width, the default answer is the property target_width
    set new_width to text returned of ¬
    (display dialog "Target width:" default answer target_width ¬
    buttons {"OK"} default button "OK")
    if new_width as integer > 0 then
    set target_width to new_width
    end if
    -- if the save_folder property has not been set,
    -- set it to the folder containing the original image
    if save_folder is "" then
    set save_folder to ¬
    (container of file (item 1 of some_items) as string)
    end if
    -- get the folder to save the scaled images in,
    -- default folder is the property save_folder
    set temp_folder to ¬
    choose folder with prompt ¬
    "Save scaled images in:" default location alias save_folder
    set save_folder to temp_folder as string
    end tell
    -- loop through the images, scale them and save them
    repeat with this_item in some_items
    try
    rescaleand_save(thisitem)
    end try
    end repeat
    tell application "Image Events" to quit
    end open
    on rescaleand_save(thisitem)
    tell application "Finder"
    set new_item to save_folder & "scaled." & (name of this_item)
    end tell
    tell application "Image Events"
    launch
    -- open the image file
    set this_image to open this_item
    set typ to this_image's file type
    copy dimensions of this_image to {current_width, current_height}
    scale this_image by factor (target_width / current_width)
    save this_image in new_item as typ
    end tell
    end rescaleandsave

    When items are dragged to your script's icon they are passed in to the on open handler, so this triggers:
    on open some_items
    and the dragged items are passed in as some_items
    In contrast, when you double-click on the script, or invoke it via the Script menu, this runs the on run handler:
    on run
      tell application "Finder"
        activate
        folder_path to quoted form of (POSIX path of (the selection as alias))
        set theItems to every file of folder_path
      end tell
    end run
    However, there's nothing in this block that actually does anything with the selection - you (dangerously) assume that the selection is a folder (you really should check first), and just set theItems to every file in that folder then you exit.
    So to do what you want you'll need to edit your run handler to filter the selection and pass files over to the code that does the hard work.
    You already have the basis for this - your rescaleandsave() handler, so it's just a matter of identifying the files in the selection and passing those over to that handler:
    on run
      tell application "Finder"
        set cur_selection to (get selection) -- get the selection
        repeat with each_item in cur_selection -- iterate through
          if class of each_item is folder then -- do we have a folder?
            set theFiles to every file of each_item -- if so, get its contents
            repeat with each_file in theFiles -- iterate through them
              my rescaleand_save(eachfile) -- and process them
            end repeat
          else if class of each_item is document file then -- do we have a file selected?
            my rescaleand_save(eachitem) -- if so, process it
          end if
        end repeat
      end tell
    end run
    So the idea here is that the run handler gets the selection and works through the (potentially-numerous) items. For each selected item it checks whether its a folder or a file, if its a folder it gets all the files within and passes them to the rescaleandsave handler.
    Note that this is not recursive - it won't catch files within folders within folders - since it only looks at the top level of selected folders, but it wouldn't be hard to rework the script to handle that if that's what you need.

  • Help with EEM TCL / CLI scripting for re-direction/wccp counters

    Being new with EEM scripting I wanted to see if I was on the right track and get some help to finish my idea.
    Our problem I am trying to fix is our remote sites utilize pairs of Cat3650's for some routing and WCCP redirection.  We are encountering ACL denial issues causing slow down and access issues.  The fix for the issue we remove the WCCP service groups to break peering with our wan optimizers and re-insert the configuration thus re-establishing peering and restoring service.
    My idea is to use a TCL scipt on a watchdog timer to parse the "sh ip wccp | inc denied (or unassign)" output for denial and unassignable error counters.  If a counter is found I wanted to create a syslog message that would then kick off a simple EEM CLI script to remove the service groups, wait 10 seconds, then re-add the service groups.  Please point me in the right direction if I am off track as I am not sure if I can use the EEM CLI for all this or since I want to retreive specific info from the sh ip wccp output if I do need to utilize TCL.  I am also unsure if the "total denied" ascii string pulled via the "sh ip wccp | inc denied" will cause issues when attempting to just pull the counter information.
    sh ip wccp | inc Denied Red
            Total Packets Denied Redirect:       0
            Total Packets Denied Redirect:       0
    Script thus far :
    TCL
    if [catch {context_retrieve "EEM_WCCP_ERROR_COUNTER" "count"} result] {
    set wccpcounter 0
    } else {
    set wccpcounter $result
    } if [catch {cli_open} result] {
    error $result
    } else {
    array set cli $result
    } if [catch {cli_exec $cli(fd) "show ip wccp | incl Denied"} result] {
    error $result
    } else {
    set cmd_output $result
    set count ""
    catch [regexp {receive ([0-9]+),} $cmd_output} ignore count]
    set count
    set diff [expr $count - $wccpcounter]
    if {$diff != 0} {
    action_syslog priority emergencies msg "WCCP counters showing incremental Denied packet counts"
    if [catch {cli_close $cli(fd) $cli(tty_id)} result] {
    error $result
    context_save EEM_WCCP_ERROR_COUNTER count
    CLI
    event manager applet WCCP_COUNTER_WATCH
    event syslog priority emergencies pattern "WCCP counters showing incremental Denied packet counts"
    action 001 cli command "enable"
    action 002 cli command "config t"
    action 003 cli command "no ip wccp 61"
    action 004 cli command "no ip wccp 62"
    action 005 wait 10
    action 006 cli command "ip wccp 61"
    action 007 cli command "ip wccp 62"
    action 008 wait 15
    action 009 cli command "clear ip wccp"
    action 010 cli command "end"
    Thanks for all the help

    This won't work as EEM cannot intercept its own syslog messages.  However, I'm not sure why you need this form of IPC anyway.  Why not just make the Tcl script perform the needed CLI commands?
    And, yes, you could use all applets here.  But since you've written the hard stuff in Tcl already, it might be best just to add the missing calls to reconfigure WCCP to that script.

  • Help with printing document via wireless

    The printer is connected to PC via wireless and has worked ok for a long time.
    Thr printer seems to be working ok (copying ok). 
    Although printer icon is ready, any document sent to print sits in a queue and does not print. I have downloaded the updated version off the internet (HP website) for the HP 3050A driver and installed ok (who knows).
    Can you help?
    cheers

    Hi @PPritchard ,
    I see that you are having issues with the print jobs just sitting in the queue and won't print. I will certainly do my best to help you.
    Download and run the Print and Scan Doctor. It will diagnose the issue and might automatically resolve it. Find and fix common printer problems using HP diagnostic tools for Windows?
    Try and print a hardware self test on the printer to find out if it is a hardware or software issue.
    On the printer control panel, press the Wireless button (). The Wireless menu opens.
    Press the button () next to the Down Arrow () to scroll through the options and select Print Reports, and then press the button next to OK.
    Press the button () next to Wireless Test to print the page.
    If you have a valid IPv4 address for the printer then try and access the Embedded Web Server for the printer.
    Type the IP address into your web browser's address bar. (Internet Explorer)
    If it loads the printer's network page then the printer is on the network.
    Power cycle the router, computer and printer.
    Try printing again.
    What were the results when you ran the Print and Scan Doctor? (did it print or scan, any error messages)
    If you need further assistance, just let me know.
    Have a nice day!
    Thank You.
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!
    Gemini02
    I work on behalf of HP

  • Help with sound output via HDMI

    My sound output via HDMI suddenly stopped worked to my TV set. I've reset the PRAM and the SMC. When I go to sound control panel for sound output, the setting is on Headphones. When I try to change it to SV420XVT1A (the tv) it immediately jumps back to headphone. I also tried a different HDMI cable to a different HDMI port on the tv. This just started after the Mac Mini had been turned off for a week. I'm using Lion and it's an 8GB Intel Core 2 Duo. Any suggestions?

    I actually discovered this answer about 5 minutes after I posted the question. Thanks a lot for your help!! Funny thing is that it had worked all along with something plugged in the headphone jack but suddenly stopped working. Again, thanks!

  • Help with "Automatically fill empty space on ipod" Function in itunes

    I am having an issue I don't understand when trying to sync my ipod. I go into the "music" tab where it allows you to select the music you want on the ipod. In addition to selecting playlists, artists, genres, etc. there is a box you can check that says "automatically fill free space with songs." I select a playlist with only a few albums on it which leaves me with a good deal of free space. My assumption was that checking this box would RANDOMLY choose songs (or albums?) in itunes to fill up the free space. However, when I do this it fills up the free space with the *exact same songs/albums every time*! The only thing I have checked off is the 1 playlist so I don't understand why it keeps choosing the same albums and songs to fill up the free space. I want it to just randomly choose songs from my entire music collection to fill up the free space. any help is appreciated!!

    Also, it seems that iTunes is not smart enough to -remove- songs when you add something new, i.e. movies or podcasts, and will constantly tell you that the iPod is full. That results in having to un-check the option, remove every song 'automatically added', add the new content, then re-check the "fill free space" box. Did no one actually test this feature or is it done on purpose to wear out your iPod quicker?

  • Flash Newbie needs help with Movie Clips/Action Scripting

    Hi -
    I'm having a problem with my movie clips playing
    simultaneously and cannot, for the life of me, figure out what I
    have done wrong. I'm new to flash, so I may have set something up
    incorrectly, but here's what I have so far:
    11 layers, total: 1 layer with 10 control buttons, each
    button with the following actionscript:
    on (release) {
    gotoAndPlay(85);
    Where the number changes in relation to which keyframe the
    next movie is on.
    I have 10 movies, total, but they are only movie clips,
    essentially photo slide shows with audio, made all in the library.
    The problem happens when I click on the second or third
    button. Not only does the movie that I have selected begin to play,
    but all of the previous clips do as well, so it all sounds quite
    garbled. I don't know what I am missing in the action script, as my
    Action Layer has a stop command on it at each keyframe where there
    is a new clip to play.
    I have tried to add a stopAllSounds command, but I'm afraid
    that doesn't do anything because it is not a "sound file" per se,
    playing in the timeline.
    I'm at the end of my rope and really need some help in
    figuring this one out. My project is hanging in the balance on
    this, as I have scripted everything else correctly and it runs
    beautifully.
    Please help!
    Thanks,
    Caroline

    Each layer has a blank keyframe before and after each
    movieclip. Each movie clip is at a different frame. Even with the
    blank keyframes added, the second video starts to play and then the
    first video begins to play. Same happens if I click on the third
    button. Third plays, and starts 1st and 2nd shortly thereafter. Is
    there an action script I can put in that will tell the timeline
    that, when a button is clicked, no matter where the movieclip is,
    it will stop and start the newly selected movieclip?

  • Help with UCCX 8.5 scripting and xmls

    I have a customer with multiple scripts, we are moving them from 3.5 to 8.5 which is running on VMWare.  Here's my scenario:
    The caller can call the trigger 54779, enter a #, then a password of 12345.  Then they can set a normal condition by dialing 1, an after-hours condition by dialing 2, or an emergency condition by dialing 3.  I’m testing the “2” condition now. In the previous 3.5 system, if they dialed 2, the system copied the Doc “2.xml” and copied it to the Doc "Carolina_Access_Emergency_Check.xml", both of which are in the en_US folder in the Documents section.
    I can’t get this thing to change my document "Carolina_Access_Emergency_Check.xml". All I know is that it goes, “unsuccessful”. I’m pretty sure the authentication is working since it gets by that step.  If we can’t get the “copy” to work, really all I need to do with this option 2, is for the data in "Carolina_Access_Emergency_Check.xml" in <TYPE>1</TYPE> to change from a 1 to a 2." I'm attaching a zip with the old and new scripts along with the 2 xml files i'm referring to.  I need help on this one, please!

    Has the user you setup have Application Admin rights? I had this issue when I was trying to create an Emergency shutdown script and the user did not have sufficient rights.
    I don't mind sharing this script I created ,which effectively changes a value from 1 to a 2, which seems to be what you are trying to do but I can not figure out how to share it with you here. You could then use this as example to achieve what you are trying to do.

  • Help with a program Option Script

    I need some help writing a Option Frame for a Add-in on my program. The basic thing it will do is to call a KeyListener with a KeyAdapter, wait for a key to be pressed, assign the key that was pressed to an int (i.e. LEFT for e.VK_LEFT) and send it to my main program. I don't have the script completely written yet, but I'm not sure how I can send 7 int values to my main program at the same time. I was thinking of something like:
    LEFT = KA_Options.getIntLEFT(int temp_LEFT);but if their is an easier way to get all the int's called at once instead of calling 7 different classes everytime a key is pressed in my main program (because of Beta testing, I don't exactly want to assign them to their own int values intill I get the code almost bug free). I would like to put my main program in this thread, but the hugeness of it, it would make reading the posts hard.
    Thanks,
    g@m3r

    This is the basic working code for my KA_Options script
         KA Option Pop-up
         Version 0.1b
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class KA_Options extends Frame implements ActionListener
         String title= "KA Options 0.1b";
         int LEFT, RIGHT, UP, DOWN, A, S, D; //The Directional Ints
         MenuBar kamenu = new MenuBar();
         Menu file = new Menu("File");
              MenuItem file_close = new MenuItem("Close");
         Menu options = new Menu("Options");
              MenuItem options_default = new MenuItem("Default Controls");
         public static void main(String[] args)
              KA_Options window = new KA_Options();
         public KA_Options()
              setTitle(title);
              setSize(100,100);
              setResizable(false);
              setLocation(0,200);
              KAMenuSetup_v1b();
                   setMenuBar(kamenu);
              addWindowListener(new WindowAdapter()
                   { public void windowClosing(WindowEvent e)
                        { setVisible(false); }
              pack();
         public void KAMenuSetup_v1b() //Beta
              kamenu.add(file);
                   file.add(file_close);
                        file_close.setActionCommand("Close");
                        file_close.addActionListener(this);
              kamenu.add(options);
                   options.add(options_default);
                        //options_default.setActionCommand("Default");
                        //options_default.addActionListener(this);
         public int getIntLEFT()
              return LEFT;
         public int getIntRIGHT()
              return RIGHT;
         public int getIntUP()
              return UP;
         public int getIntDOWN()
              return DOWN;
         public int getIntA()
              return A;
         public int getIntS()
              return S;
         public int getIntD()
              return D;
         public void actionPerformed(ActionEvent e)
              String arg = e.getActionCommand();
              if(arg == "Close")
                   { setVisible(false); }
    } I'm still writing the bulk of the code.

  • Need help with automatic slideshow

    I made an automatic slideshow that switches frames at a set
    interval but now i want to load each frame from an extrenal swf and
    add a preloader for each frame, how do i tell the slideshow to wait
    until the frame is loaded before it proceeds to the next frame, but
    still have the movieclip be automatic. Also the slideshow can be
    controlled mannually so i also want to know how to disable the
    manual control till each frame is loaded.

    Here is some of the action script for the slideshow.
    This first bit sets up the automatic interval transitions in
    the main movie timeline
    function nextImage()
    mc_slide.mc_transition.play();
    } // End of the function
    function waitImage()
    clearInterval(slideTimer);
    var slideTimer = setInterval(nextImage, timer * 1000);
    nextImage();
    } // End of the function
    function pauseSlide()
    mc_slide.mc_quicktransition.gotoAndPlay(2);
    } // End of the function
    var timer = 8;
    var pauseTime = 20;
    var slideTimer = setInterval(nextImage, timer * 2000);
    stop ();
    the movieclip loaders that load each movie clip are embedded
    with the transition animation.
    this is the code in the embedded mc-it loads the 1st movie
    clip and allows the user to manually jump to any of the other movie
    clips.
    emptyMC.loadMovie("frame1.swf");
    var pageAddress = "about:blank";
    btn1.onRelease = function ()
    _parent.pauseSlide();
    gotoAndStop(1);
    btn2.onRelease = function ()
    _parent.pauseSlide();
    gotoAndStop(2);
    btn3.onRelease = function ()
    _parent.pauseSlide();
    gotoAndStop(3);
    btn4.onRelease = function ()
    _parent.pauseSlide();
    gotoAndStop(4);
    stop();
    I need to know how to put the code for the automation of the
    slideshow pause until each movieclip has finished loading and also
    at the same time disable the manual control of the movie clips
    before they are fully loaded.

  • Help with Automatic refreshing

    I got this graph that I can slide with my finger, Im wondering if its possible to update it automatic with this code?
    //Function for sliding graph.
       protected function mouseDownHandler(event:MouseEvent):void
        lastX = event.stageX;
        systemManager.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
        systemManager.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
       protected function mouseMoveHandler(event:MouseEvent):void
        var delta:Number = (lastX - event.stageX) / chart.width * viewportMax;
        if (hAxis.minimum + delta < 0)
         hAxis.minimum = 0;
         hAxis.maximum = viewportMax;
        else if (hAxis.maximum + delta  > chart.dataProvider.length - 0)
         hAxis.maximum = chart.dataProvider.length - 0;
         hAxis.minimum = hAxis.maximum - viewportMax;
        else
         hAxis.minimum += delta;
         hAxis.maximum += delta;
        lastX = event.stageX;
       protected function mouseUpHandler(event:MouseEvent):void
        systemManager.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
        systemManager.removeEventListener(MouseEvent.MOUSE_MOVE, mouseUpHandler);

    Here is the whole graph code, the source is the "myArray", it gets updated thru UDP.
    I guess something have to be done in the "mouseMoveHandler". Tried to change different things, but it
    still scolls with finger only, and does not update by itself. There should be a way to make it scroll by itself, dont you agree?
    <fx:Script>
      <![CDATA[
       import flash.events.TimerEvent;
       import flash.utils.Timer;  
       import flashx.textLayout.events.ScrollEvent;  
       import mx.collections.ArrayCollection;
       import mx.events.FlexEvent;
       import mx.rpc.events.AbstractEvent;  
       public var NewValue:Object; 
       public var Value:String;
       public var myTimer:Timer;
       public var PowerNumber:Number;
       //Function for UDP graph.
       protected var lastX:Number = 0;  
       [Bindable]
       protected var viewportMax:Number = 10;
       private function creationCompleteHandler():void
        completeHandler();
        init();
       protected function completeHandler():void
        chart.dataProvider = myArray;
       protected function mouseDownHandler(event:MouseEvent):void
        lastX = event.stageX;
        systemManager.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
        systemManager.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
       protected function mouseMoveHandler(event:MouseEvent):void
        var delta:Number = (lastX - event.stageX) / chart.width * viewportMax;
        if (hAxis.minimum + delta < 0)
         hAxis.minimum = 0;
         hAxis.maximum = viewportMax;
        else if (hAxis.maximum + delta  > chart.dataProvider.length - 1)
         hAxis.maximum = chart.dataProvider.length - 1;
         hAxis.minimum = hAxis.maximum - viewportMax;
        else
         hAxis.minimum += delta;
         hAxis.maximum += delta;
        lastX = event.stageX;
       protected function mouseUpHandler(event:MouseEvent):void
        systemManager.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
        systemManager.removeEventListener(MouseEvent.MOUSE_MOVE, mouseUpHandler);
       public var myArray:ArrayCollection = new ArrayCollection();
       public function initTimer():void
        var myTimer:Timer = new Timer(500, 0);
        myTimer.addEventListener("timer", timerHandler);
        myTimer.start();
       //Function for UDP graph.
       public function timerHandler(event:TimerEvent):void
        var obj:Object = new Object();   
        obj.time = getTimer();   
        obj.Value = NewValue;
        myArray.addItem(obj);
       //Function for UDP graph.
       protected function applicationCompleteHandler(event:FlexEvent):void
        udpSocket = new UDPSocket();
        udpSocket.addEventListener(DatagramSocketDataEvent.DATA, udpDataHandler);
        udpSocket.bind(1000);
        udpSocket.receive();   
        initTimer();
       //Incomming UDP for graph (Tracking).
       protected function udpDataHandler(event:DatagramSocketDataEvent):void
        var Value:String = event.data.readUTFBytes(event.data.bytesAvailable);
        if(Value)
         NewValue = Value;
        else
         NewValue = 0;
      ]]>
    </fx:Script>
    <fx:Declarations>
      <mx:SolidColorStroke id = "s1" color="0x0000ff" weight="2"/>
    </fx:Declarations>
    <mx:LineChart id="chart"  x="51" y="141" width="875" height="190" paddingLeft="5" paddingRight="5"
          showDataTips="true"
          mouseDown="mouseDownHandler(event)">
      <mx:series>  
       <mx:LineSeries yField="Value" form="curve" displayName="Tracking" lineStroke="{s1}"/>  
      </mx:series>
      <mx:horizontalAxis> 
       <mx:LinearAxis id="hAxis" minimum="0" maximum="{viewportMax}"/> 
      </mx:horizontalAxis>
    </mx:LineChart>
    </s:Application>

  • Help with a date field script

    Sorry if this is a repeat. I was interrupted and found that my browser had crashed when I came back so I'm not sure if the question got asked.
    I need a script for a date field (mm/dd/yyyy) where the user can only fill in a date that is between 12/31/1899 and the current date (whatever the date when the form is opened). I'm getting better at writing these but I haven't been successful with this one. Any help would be greatly appreciated.
    Thanks!

    I have a feeling I already answered this question some time ago... Anyway, you can use this code as the field's custom validation script:
    var minDate = util.scand("mm/dd/yyyy", "12/31/1899");
    var maxDate = new Date();
    event.rc = true;
    if (event.value) {
        var d = util.scand("mm/dd/yyyy", event.value);
        if (d<minDate || d>maxDate) {
            app.alert("Error! The entered date must be between " + util.printd("mm/dd/yyyy", minDate) + " and " + util.printd("mm/dd/yyyy", maxDate));
            event.rc = false;

  • Anyone here can help with a quick bash script?

    I am no coder, by any means, unless you consider html code....I don't
    any how, here's what i'm trying to do, if someone who knows bash would like to assist?
    i have a folder, with a bunch of subfolders, inside these subfolders, is a setup.xml file.
    and inside these setup xml files is a line titled product code with a string after it.
    i could really use a script or sorts to go through and output all those product codes into a single text file right now, otherwise i'm sure i'll be here for hours
    anyone care to help?

    ooooh.......that works
    tweaked it a bit and ran it from the source folder, worked well, this is what i ran though
    find -name \Setup.xml -exec grep 'productcode' '{}' \; > theFile
    does this give you any idea as to the file structure of the xmls?
    <Setups productcode="ICA.productcode">
    <Msi productcode="UpdateX3.exe" file="WPO15\UpdateX3.exe" cmdline="/s" adminsupport="0" condition="UpdateX3=1"/>
    <Msi productcode="{6E274E81-F9E1-43A2-9672-E45F655953FA}" file="WPO15\UpgradesX4.msi" cmdline="ADDLOCAL=ALL" progresstext="Str.UpgradeProgressText" adminsupport="0" condition="REMOVE_14" scheduled="0" ignorereturn="1" />
    <Msi productcode="{DCDAB2ED-5741-4C30-A1A4-0FCB8A529001}" file="ICA_X4.msi" cmdline="REMOVE=ALL" progresstext="Str.UpgradeProgressText" adminsupport="0" condition="REMOVE_14" scheduled="0" ignorereturn="1" />
    <Msi productcode="{92B60B3B-7DF3-4BF7-8823-9F17A9EEA31E}" file="WPO15\Setup.msi" progresstext="Str.ProgressText.Common" cmdline="ICA_ALL_PUBLIC" managed="1">
    <Dbm productcode="{71D2F8EE-9D45-4D95-A6F6-F6433C2B94B5}" file="WPO15\ENSystem.msi" progresstext="Str.ProgressText.Common" adminsupport="0"/>
    <Dbm productcode="{EC61C6D9-159B-4B14-AAF3-AF33FCFA50DD}" file="WPO15\ENWP.msi" cmdline="ADDVIEWERS=[ADDVIEWERS]" progresstext="Str.ProgressText.WP" />
    <Dbm productcode="{DAEDCD3D-B981-4F10-B17B-764753EDAF9F}" file="WPO15\ENQP.msi" progresstext="Str.ProgressText.QP" />
    <Dbm productcode="{378BAC91-3AE8-45F0-90E4-4F81E3EAEBC5}" file="WPO15\ENPR.msi" progresstext="Str.ProgressText.PR" />
    <Dbm productcode="{17C5A285-F7B6-492B-8F3B-343D02B84D75}" file="WPO15\ENCommon.msi" progresstext="Str.ProgressText.Common" cmdline="ESTIMATEDSIZE=[ICA.DiskSpace.Drive.Required.0] PIDPREFIX=WP15" />
    <Dbm productcode="{D7643510-C1AE-44AD-B0F9-0665C4D73BFD}" file="WPO15\LegalTools.msi" progresstext="Str.ProgressText.WP" />
    <Dbm productcode="{CD5C6C29-E6CB-4DF3-B45F-A04087B1C294}" file="WPO15\ENTemplates.msi" progresstext="Str.ProgressText.WP" />
    <Dbm productcode="{E67732DE-3387-4F1E-BDDA-2D0C08BC025B}" file="WPO15\ENFilters.msi" progresstext="Str.ProgressText.Common"/>
    <Dbm productcode="{6E4B1E42-A831-44B4-A705-D006F68560EC}" file="WPO15\ENGraphics.msi" progresstext="Str.ProgressText.Common"/>
    <Dbm productcode="{19B4CD07-1919-4002-B28F-A5D2027026E0}" file="WPO15\IPM.msi" progresstext="Str.ProgressText.Common" cmdline="PCUSOURCEID=[PCUSOURCEID] ALLOW_PRODUCTUPDATES=&quot;[ALLOW_PRODUCTUPDATES]&quot; SERIALNUMBER=&quot;[SERIALNUMBER]&quot; USERNAME=&quot;[USERNAME]&quot; SHOW_EULA=[AcceptLicense] SKU=[SKU]"/>
    <Dbm productcode="{E539B721-4458-4EFC-8BD0-04D4842051AE}" file="WPO15\EN.msi" progresstext="Str.ProgressText.EN" cmdline="SKUDATA=&quot;[SKUDATA]&quot;" />
    <Dbm productcode="{D4167D08-0F61-4F44-BC3F-26B4960745C4}" file="WPO15\ENSkins.msi" progresstext="Str.ProgressText.EN" />
    <Dbm productcode="{64459BD5-3AE8-4689-B7B0-D57B667D8399}" file="WPO15\ENPExp.msi" progresstext="Str.ProgressText.Common" />
    <Dbm productcode="{1F0D7D15-8A36-4AE4-8573-70BEA7DF379D}" file="WPO15\MMan_EN.msi" progresstext="Str.ProgressText.Common" />
    Last edited by ssl6 (2012-04-10 02:05:44)

  • Help with my first PKGBUILD script [solved]

    Hi There
    I am trying to write my first PKGBUILD script and I am landing in a bit of trouble.  The script is short and is:
    #Contributor: iKevin <kellwood-at-ameritech.net>
    pkgname=fpm
    pkgver=0.60
    pkgrel=1
    pkgdesc="A password manager for gnome"
    url="http://fpm.sourceforge.net"
    license="GPL"
    depends=('xorg' 'gtk' 'glibc' 'libgnome' 'libxml2' 'glib')
    source=(http://heanet.dl.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.gz)
    md5sums=(be7655d300c306c8f962f6aad0a60cc5)
    build() {
    cd $startdir/src/$pkgname-$pkgver
    ./configure --prefix=/usr
    make || return 1
    mkdir -p $startdir/pkg/usr/bin
    make prefix=$startdir/pkg/usr install
    I haven't reach the point where it compiles.  It failes to download the file.  Oddly, when I type:
    wget http://heanet.dl.sourceforge.net/source … .60.tar.gz
    it downloads fine.  When running makepkg, the contents of ./src/fpm-0.60.tar.gz is some kind of web page.
    I have eyeballed this PKGBUILD script for a while and I can't see any problems.  Is there something special about sourceforge files?  I feel that I must have a typo because makepkg is using wget, which works by hand.
    Thanks
    Kev

    Well,
    I installed kedpm with my first working PKGBUILD script.  I was able to import my "fpm" password file.  Once I get my gnucash stuff transfered into grisbi, I will be able to switch my main machine completely to archlinux.
    I know it is trivial for you guys, but here is my script -- it might save you some typing.
    Kev
    pkgname=kedpm
    pkgver=0.4.0
    pkgrel=1
    pkgdesc="Ked Password Manager helps to manage large amounts of passwords and related information"
    url="http://kedpm.sourceforge.net/"
    depends=(python pygtk pycrypto)
    makedepends=()
    conflicts=()
    replaces=()
    backup=()
    install=
    source=(http://dl.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.gz)
    md5sums=('6b83a646873f8ea00af9c6403aa259bc')
    build() {
    cd $startdir
    mkdir -p pkg/usr
    cd $startdir/src/$pkgname-$pkgver
    python setup.py install --prefix=$startdir/pkg/usr

Maybe you are looking for

  • Cant uninstall Itunes 7.7.1.11

    So I turn Itunes on and it asks if I want to upgrade to 8.0 and I click yes so i downloads everything and installs everything nothing looks like it went wrong but then when I turn it on i get an error box that says Warning! The registry settings used

  • How do I manually modify a font of text with photo in text?

    I was trying to do an example from a photoshop CS3 for dummies book but I wanted to modify the example a bit- here's the q I asked on the author's amazon page:  http://www.amazon.com/gp/forum/cd/discussion.html/ref=ntt_mus_ep_cd_tft_tp?ie=UTF8&cdForu

  • How do I continue to download my movie ?

    I was downloading a movie onto my ipod touch from itunes on my ipod and my ipod went dead and so I let it charge and it came back and then i try to resume my download process and it says: download error .....HELP!

  • Adobe Flex 3, unable to check existing XML nodes

    I am getting an XML data from server(Pls refer xmlData value). I need to: i. Create another XML with non-duplicates Folders ii. Create another XML with final count on monthly basis. I am unable to do this with below code and getting duplicate records

  • Automatically copy format to new slide

    HI all, I'm new with Keynote and I'm sure there is an easy answer to this, but I certainly can't seem to find it. I'm putting together a boring, bulleted presentation and have adjusted the master slide to the format I want. Changed font, size, bullet