Run Applescript or Application at a certain battery level

i was wondering if anyone knows an applescript or app or something that could run 1 of my own applescripts or apps when the battery drops to a certain charge bc i recently installed deep sleep and it messed up something so whenever the low battery warning dialog pops up my computer does a hard shutdown like instantly before i can even reach for the plug so i would like to run an applescript (of my own creation) that displays "PLUG IN YOUR MACBOOK" in the big text display (i hacked some already hacked program but it works lol)(i can save the script as an app if needed)

bump
im not entirely sure that it was bc of deep sleep (and i already unistalled it and problem persists)
thanks in advance

Similar Messages

  • [SOLVED] Udev rule to hibernate my laptop at certain battery level

    Hi!
    I'm needing this kind of udev rule, to have my laptop automatically hibernate when battery level is about 3% (or 5, it doesn't matter).
    I don't want to have a little script running in the background that every eg 5 seconds polls my battery level, because i find it a really rough system.
    I guess i can use udev to reach what i want.
    udevadm info --path=/sys/class/power_supply/BAT0
    P: /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
    E: DEVPATH=/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
    E: POWER_SUPPLY_CHARGE_FULL=4800000
    E: POWER_SUPPLY_CHARGE_FULL_DESIGN=4800000
    E: POWER_SUPPLY_CHARGE_NOW=4800000
    E: POWER_SUPPLY_CURRENT_NOW=0
    E: POWER_SUPPLY_CYCLE_COUNT=0
    E: POWER_SUPPLY_MANUFACTURER=SANYO
    E: POWER_SUPPLY_MODEL_NAME=AS07B32
    E: POWER_SUPPLY_NAME=BAT0
    E: POWER_SUPPLY_PRESENT=1
    E: POWER_SUPPLY_SERIAL_NUMBER= 7210
    E: POWER_SUPPLY_STATUS=Full
    E: POWER_SUPPLY_TECHNOLOGY=Li-ion
    E: POWER_SUPPLY_VOLTAGE_MIN_DESIGN=14800000
    E: POWER_SUPPLY_VOLTAGE_NOW=16142000
    E: SUBSYSTEM=power_supply
    Any help?
    Thank you very much!
    Last edited by nierro (2012-09-21 20:36:45)

    It is indeed udev, displaying device info from its database in response to a query - that's what 'udevadm info' does. But you can't write a udev rule against that info - you need a uevent.
    man udev wrote:The udev daemon, systemd-udevd.service(8), receives device uevents directly from the kernel whenever a device is added or removed from the system, or it changes its state. When udev receives a device event, it matches its configured set of rules against various device attributes to identify the device. Rules that match may provide additional device information to be stored in the udev database or to be used to create meaningful symlink names.
    If you run cybertorture's 'udevadm monitor' command above, as your battery is running down, you will not see any uevents. If you connect or disconnect your AC adapter, you will see uevents - in fact, you're using those ones already, to trigger your powersave script. So although the general description I've quoted mentions kernel uevents generated when a device "changes its state", this does not cover all possible changes, and in this particular case, it does not cover changes in battery charge level.

  • HT201365 How do I turn off applications to keep my battery level up?  I used to be able to press the bottom button twice and hold down an icon until it jiggled and had an x on it.  That doesn't seem to work with the new upgrade.

    With the new OS 7 I can't figure out how to shut down applications to save battery.  I used to double click the bottom button and select applications to " x" out of.  How does this work now?

    double tap the home button and swipe up on the app screenshot.
    Having apps in the multi task doesn't effect your battery life.

  • Automator Applications don't let me run applescripts!

    ok just made an excellent automator application that deleted invisible files on selected drives. the only problem is that when i run it as an application, it gives me an error message and tells mr to check the "Run Applescript" action's properties. But, it works in the workflow perfectly!
    please help.

    OK, that does help. The statementset y to (value of variable "path" of front workflow)uses Automator terminology - unless your workflow is actually running in Automator, your script won't know anything about those terms unless you target the Automator or the Automator Runner applications.
    In this case though, you don't need to use variables at all, since the value you want is in the input parameter of the *Run AppleScript* action (this is what is output from the previous action). Note that the input parameter is a list, so you need to repeat through the items in the list or coerce it from a list to the desired class. Your Terminal scripting also seems to be a bit severe, but with the items I noted your workflow would be something like:
    1) *Ask for Finder Items* { Type: Folders } (Allow Multiple Selections is not checked)
    2) *Run AppleScript*
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #DAFFB6;
    overflow: auto;"
    title="this text can be pasted into an Automator 'Run AppleScript' action">
    on run {input, parameters}
    set y to input as text -- coerce from list
    display dialog "Are you sure you want to delete the Trash folder on flashdrive " & quoted form of y & "?" buttons {"Cancel", "Yes"} default button 2
    display dialog "Enter password:" default answer "password" buttons {"Cancel", "OK"} default button 2
    set x to (text returned of result)
    tell application "Terminal"
    delay 2
    do script "cd " & quoted form of POSIX path of y -- convert path
    do script "sudo rm -rf .Trashes" in window 1
    delay 2
    do script x in window 1
    delay 2
    do script "yes" in window 1
    delay 2
    do script "killall Terminal"
    end tell
    return input
    end run</pre>

  • How do I not let certain users run an installed application?

    I have a computer lab at a school that is running Snow Leopard and a Snow Leopard server.  Is there a way in Workgroup Manager to disallow the student group from running an installed application?  I know that I can "always allow" all the rest of the applications, but there is just one that I specifically want to disallow and I don't want to have to be constantly updating an application whitelist.

    Hang an ACL off the bundle and — presuming your students are all associated with a group I'll refer to as "student" group — use the ACL to deny access to anybody in "student"?  That's sort-of and sort-of-not WGM, but it'll work.

  • How to run an "Automator" application at regular time intervals

    I would like to find out how to run an "Automator" application at regular time intervals, say at every 5 minutes.
    Is there any program, AppleScript or any method to do this?
    I would very much appreciate a help.
    Suwan

    save your workflow as an ical plugin, this will automatically insert the workflow into ical,and create a workflow category for it, then just set to repeat every 5 minutes, or save as an APP and use a program called CRONIX (freeware) to run the schedule.

  • AIR application crashes at certain point in windows vista

    Hi Dudes,
    I am facing a problem in Window vista. It always crash when we open the window component using Adobe AIR. I am creating the Dynamic window and adding the child component as window.rawChildren.addChild(object) like this.. we made the setup , it is running perfect in all OS except Windows vista 32/64 bit.
    When we work with our AIR application in conjunction with our own h/w product(Tablet Driver).[without connection of Tablet slate with PC it works fine but with it not].
    S/w Details:- AIR Installer above 2 and SDK above 2.
    OS- Win-Vista 32/64 bit.
    AIR application crashes at certain point and shows the error like:-
    Problem signature:
      Problem Event Name:                        APPCRASH
      Application Name:                             GTMP.exe
      Application Version:                           0.0.0.0
      Application Timestamp:                     4bde2f02
      Fault Module Name:                          Adobe AIR.dll
      Fault Module Version:                        3.1.0.4880
      Fault Module Timestamp:                  4eb760e8
      Exception Code:                                  c0000005
      Exception Offset:                                003ca9be
      OS Version:                                          6.1.7601.2.1.0.768.3
      Locale ID:                                             2057
      Additional Information 1:                  0a9e
      Additional Information 2:                  0a9e372d3b4ad19135b953a78882e789
      Additional Information 3:                  0a9e
      Additional Information 4:                  0a9e372d3b4ad19135b953a78882e789
    Read our privacy statement online:
      http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
    If the online privacy statement is not available, please read our privacy statement offline:
      C:\Windows\system32\en-US\erofflps.txt
    I found one more error in debugging mode..the Alert message is
    Microsoft Visual C++ Runtime Library
    R6025 -
    pure virtual function Call.
    As per my view it is about some .dll and .CPL file makes some issues with AIR Frameworks is it? !!!!..
    Please give some ideas to resolve it.
    by
    Beerahamedkhan

    Could you try this against the released 3.2 version of AIR and our 3.3 beta to see if it still occurs?  If so, please open a new bug report on this over at bugbase.adobe.com?  Include any sample code or application to help us easily reproduce the problem.  If you'd like to keep your code private, please feel free to send it to me directly at [email protected]  In addition, if you can give us a .dmp of this crash it could be very helpful. 
    Please post back with the URL so that others affected can add their comments and votes.

  • Video playback in ALL applications stutters while using battery only.

    Video playback in ALL applications stutters while using battery only. All OK when running from power adaptor. New battery did not fix. Recently updated iTunes to 11.0.5 and Flash player 11.8.800.94 .

    Thank you again andyBall_uk.
    I have successfully run Apple Hardware Test and it returned the error code...
    4SNS/1/40000001:VPOR
    A  Google search reveals that this is a sensor error. The "V" of VPOR indicates a voltage sensor and the "P" indicates the sensor is on the Power bus. However don't yet know what the "OR" refers to.
    I have had a non operative optical disk drive for a year or more but the fault with the video only developed in the last week or two. Could the "O" in VPOR refer to the Optical drive?
    By the way, I got the impression from the instructions on running the Apple Hardware Test that I had to use the internal dvd drive to run the APT program from the install disk. But this turned out to be not the case. Just put install disk ito an external drive plugged into the usb ports and use system preferences to set this drive as the start up disk.

  • I recently upgraded to Lion and i find that my computer is running slow and applications are crashing.  For example I have Word 2011 for Mac and it crashes all the time I end up losing my work.  It often happens when I'm in notebook trying to record.

    i recently upgraded to Lion and i find that my computer is running slow and applications are crashing.  For example I have Word 2011 for Mac and it crashes all the time I end up losing my work.  It often happens when I'm in class using notebook and when I press record my computer starts thinking and it freezes.
    Also, I feel that it overheats often and my battery runs out pretty quickly.  I had the macbook (black) and this never happened before.  I'm not sure if I'm doing something wrong or if there is something with my computer.I bought my computer summer 2010, I don't think this should be happening. Please Help......

    This is exactly what keeps happening to mine too.  I was at a conference taking notes, and I was
    using the Notebook template, and doing some audio recording simultaneously.  About 3 hours into the conference (not consistently recording, but on and off with the sessions) my file wouldn't save anymore, saying something like "File cannot be modified while in use with another program" and "Invalid file name" when I would go back into my folder to look for it). I tried installing some updates from Microsoft, and when I restarted, I was at least able to open my old notes again, and so far it looks like the audio was working.  However, today at the conference, the same thing happened again, but I wasn't actively recording any audio (though after I had copy and pasted my second file of notes into the original, I went back to using it after re-naming it). 
    Does the crash happen to you under similar cirucumstances?  The update might help a little, but it is definitely not the solution.  Does anyone have any solutions?  Lion shouldn't be this buggy... I moved to Mac to get away from the garbage of bugs and compatibility issues...

  • Running AppleScript in the background

    Okay, yet another problem I'm having that I'm going to bug the community here with.
    Is it at all possible to run AppleScript while doing other things? For example, if I wanted my AppleScript to hop online every hour and send me back information from my site could I have it do this while I do other things? Or will I have to wait until it's completed?
    Say I wanted to create a script that hopped on my site and sent me the post number of the last post, could I have it do this while I do other things?
    Something like
    tell application "Safari" to activate
    tell application "System events"
    tell process "Safari"
    (enter code here to get post number and send it to me)
    end tell
    end tell
    I've tried doing it like this and it definitely doesn't work at all if I don't have the Safari window selected at all times, so is there any way in which I can run script in the background while I work on other things or does AppleScript require full control of my computer while it's working?

    Save this script just like the others I posted. The script will do exactly as you asked.
    <pre style="width:630px;height:auto;overflow-x:auto;overflow-y:hidden;"
    title="Copy this code and paste it into your Script Editor application.">property helloWorld : "Hello World "
    global numChars, charNum, x
    on run
    tell application "System Events" to set isRunning to exists process "TextEdit"
    if not isRunning then tell application "TextEdit" to launch
    tell application "TextEdit"
    if isRunning then make new document
    set name of window 1 to "Hello World"
    set numChars to number of characters in helloWorld
    set charNum to 0
    set x to 0
    end tell
    end run
    on idle
    try
    tell application "TextEdit"
    if x = numChars then
    set x to 1
    else
    set x to x + 1
    end if
    set charNum to charNum + 1
    set theChar to character x of helloWorld
    set character charNum of document 1 to theChar
    end tell
    on error
    quit
    end try
    return 0.1
    end idle
    on quit
    continue quit
    end quit</pre>

  • How to constant running a java application

    I have created a java application. My main class is called PTS.class and that has my main method.
    I wish to run this class continously, such that each time the main method completes execution, it is called again.
    I could probably do that by creating a thread which runs infinitely, as below. Is this a good skeleton solution? Will each instance of class PTS be garbage collected after execution, before a new one is created?
    Is there any freeware Java scheduler out there that allows me to do the same thing i.e. running an application infinitely?
    public class TestApplication implements Runnable{
    p.s.v.m (String[] args){
    Thread t = new Thread(this);
    t.start();
    public void run(){
    while(true){
    PTS pts = new PTS();
    }

    I'm not aware of any general Java based scheduling applications, though there certainly may be some. In general schedulers are built into the O/S such as cron. More robust schedulers like AutoSys are native code in part because they need to do O/S specific things like change who a particular process is running as.
    Depending on your needs it shouldn't be too bad to write your own.

  • How do i resolve an issue where i have run out of application memory?

    My imac says i have run out of application memory and that i should quit applications. How do i resolve this issue?

    The message has nothing to do with low disk space.
    There is excessive swapping of data between physical memory (that is, the memory chips on the logic board) and virtual memory (one or more files on the startup volume.) That activity is relatively slow and causes the whole system to be less responsive. It can happen for two reasons:
    A long-running process with a memory leak (a kind of bug)
    Not enough memory for your usage pattern
    Tracking down a memory leak can be difficult, and it may come down to a process of elimination.
    These instructions are for OS X 10.9 ("Mavericks.") The procedure may be slightly different for earlier versions of OS X.
    When you notice the swap activity, open the Activity Monitor application and select All Processes from the View menu, if it's not already selected. Select the Memory tab. Click the heading of the Real Mem column in the process table twice to sort the table with the highest value at the top. If you don't see that column, select
    View ▹ Columns ▹ Real Memory
    from the menu bar.
    If one process (excluding "kernel_task") is using much more memory than all the others, that could be an indication of a leak. A better indication would be a process that continually grabs more and more real memory over time without ever releasing it. Here is an example of how it's done.
    The processes named "Safari Web Content" render web pages for Safari. They use a lot of memory and may leak if certain Safari extensions or third-party web plugins are installed. Consider them prime suspects.
    Another process often implicated in memory leaks is "inkjet4" or "inkjet8," which is a component of the HP printing software. If it's present, force-quit the process in Activity Monitor to solve the problem temporarily. Empty the print queues in the Printers & Scanners preference pane (which has a slightly different name in each recent version of OS X.) If you don't use an HP printer, remove the software. Otherwise, if the problem is recurrent, update the software (which may not help) or contact HP support.
    "Wired" memory should be a small part of the total. That memory is not swapped, but it makes less physical memory available which may then result in swapping. If you have a lot of wired memory, that's usually an indication of a memory leak in a third-party program that modifies the operating system at a low level. Ask for guidance in that case.
    If you don't have an obvious memory leak, your options are to install more memory (if possible) or to run fewer programs simultaneously.
    The next suggestion is only for users familiar with the shell. For a more precise, but potentially misleading, test, run the following command: 
    sudo leaks -nocontext -nostacks process | grep total
    where process is the name of a process you suspect of leaking memory. Almost every process will leak some memory; the question is how much, and especially how much the leak increases with time. I can’t be more specific. See the  leaks(1) man page and the Apple developer documentation for details.

  • Accessing multiple Automator variables in a Run Applescript action

    I have an Automator app set up with 4 variables feeding into a Run Shell Script with the following code. And it runs perfectly.
    /Applications/Adobe\ After\ Effects\ CC/aerender -sound ON -project $1 -comp "$2" -output $3/$4
    However, I need to be able to see the progress of the Script while it processes in the Terminal window. So, I'm setting up a Run AppleScript to tell Terminal to run the script, but I'm getting two problems.
    code:
    on run {input, parameters}
              set aVar to item 1 of input
              set bVar to item 2 of input
              set cVar to item 3 of input
              set dVar to item 4 of input
              tell application "Terminal"
      activate
                        do script "/Applications/Adobe\ After\ Effects\ CC/aerender -sound ON -project aVar -comp \"bVar\" -output cVar/dVar"
              end tell
    end run
    Problem 1--Either my syntax or method of setting the 4 variables to access the array of 4 input variables is wrong. And I don't know enough about AppleScript to figure it out.
    Problem 2-- AppleScript really doesn't like the spaces in "Adobe\ After\ Effects\ CC" even though the Terminal has no problem with it. But it errors out before it even gets to Terminal.
    Any help that anyone can give will be greatly appreciated.

    The backslash is also used as the escape character in an AppleScript string, so to actually get the character you need to escape it (you can also use the term quoted form of to let AppleScript figure out how to quote the string).  To use the variables, you need to use the concatentation operator to mix the variables and text pieces - by putting a variable inside the string the identifier just becomes text.
    Your string should look something like:
    "/Applications/Adobe\\ After\\ Effects\\ CC/aerender -sound ON -project " & aVar & " -comp " & bVar & " -output " & cVar & "/" & dVar
    or perhaps
    quoted form of "/Applications/Adobe After Effects CC/aerender" & " -sound ON -project " & aVar & " -comp " & bVar & " -output " & quoted form of (cVar & "/" & dVar)

  • Your system run out of application memory

    your system run out of application memory i get this message pop up and everything freezes

    There is excessive swapping of data between physical memory (that is, the memory chips on the logic board) and virtual memory (one or more files on the startup volume.) That activity is relatively slow and causes the whole system to be less responsive. It can happen for two reasons:
              A long-running process with a memory leak (a kind of bug)
              Not enough memory for your usage pattern
    Tracking down a memory leak can be difficult, and it may come down to a process of elimination.
    These instructions are for OS X 10.9 ("Mavericks.") The procedure may be slightly different for earlier versions of OS X.
    When you notice the swap activity, open the Activity Monitor application and select All Processes from the View menu, if it's not already selected. Select the Memory tab. Click the heading of the Real Mem column in the process table twice to sort the table with the highest value at the top. If you don't see that column, select
              View ▹ Columns ▹ Real Memory
    from the menu bar.
    If one process (excluding "kernel_task") is using much more memory than all the others, that could be an indication of a leak. A better indication would be a process that continually grabs more and more real memory over time without ever releasing it. Here is an example of how it's done.
    The processes named "Safari Web Content" render web pages for Safari. They use a lot of memory and may leak if certain Safari extensions or third-party web plugins are installed. Consider them prime suspects.
    Another process often implicated in memory leaks is "inkjet4" or "inkjet8," which is a component of the HP printing software. If it's present, force-quit the process in Activity Monitor to solve the problem temporarily. Empty the print queues in the Printers & Scanners preference pane (which has a slightly different name in each recent version of OS X.) If you don't use an HP printer, remove the software. Otherwise, if the problem is recurrent, update the software (which may not help) or contact HP support.
    "Wired" memory should be a small part of the total. That memory is not swapped, but it makes less physical memory available which may then result in swapping. If you have a lot of wired memory, that's usually an indication of a memory leak in a third-party program that modifies the operating system at a low level. Ask for guidance in that case.
    If you don't have an obvious memory leak, your options are to install more memory (if possible) or to run fewer programs simultaneously.
    The next suggestion is only for users familiar with the shell. For a more precise, but potentially misleading, test, run the following command:
    sudo leaks -nocontext -nostacks process | grep total
    where process is the name of a process you suspect of leaking memory. Almost every process will leak some memory; the question is how much, and especially how much the leak increases with time. I can’t be more specific. See the  leaks(1) man page and the Apple developer documentation for details.

  • I'm getting the message that my MacBook Pro has run out of application memory?

    If I'm not paying attention and am running more then 1 application at the same time I get a message that I've run out of application memory and need to "force quit" current applications in order to continue. Anything I can do to resolve this problem like add more RAM/

    First, all so-called "memory cleaning" software is worse than useless.
    There is excessive swapping of data between physical memory (that is, the memory chips on the logic board) and virtual memory (one or more files on the startup volume.) That activity is relatively slow and causes the whole system to be less responsive. It can happen for two reasons:
              A long-running process with a memory leak (a kind of bug)
              Not enough memory for your usage pattern
    Please note that if the cause is a memory leak, installing more memory will not help. That's likely if you already have more than 4 GB of memory. Tracking down a memory leak can be difficult, and it may come down to a process of elimination.
    These instructions are for OS X 10.9 and later. Some details may be slightly different for earlier versions of OS X.
    When you notice the swap activity, open the Activity Monitor application and select All Processes from the View menu, if it's not already selected. Select the Memory tab. Click the heading of the Real Mem column in the process table twice to sort the table with the highest value at the top. If you don't see that column, select
              View ▹ Columns ▹ Real Memory
    from the menu bar.
    If one process (excluding "kernel_task") is using much more memory than all the others, that could be an indication of a leak. A better indication would be a process that continually grabs more and more real memory over time without ever releasing it. Here is an example of how it's done.
    The processes named "Safari Web Content" render web pages for Safari. They use a lot of memory and may leak if certain Safari extensions or third-party web plugins are installed. Consider them prime suspects.
    Another process often implicated in memory leaks is "inkjet4" or "inkjet8," which is a component of the HP printing software. If it's present, force-quit the process in Activity Monitor to solve the problem temporarily. Empty the print queues in the Printers & Scanners preference pane (which has a slightly different name in each recent version of OS X.) If you don't use an HP printer, reset the printing system. Otherwise, if the problem is recurrent, update the software (which may not help) or contact HP support.
    "Wired" memory should be a small part of the total. That memory is not swapped, but it makes less physical memory available which may then result in swapping. If you have a lot of wired memory, that's usually an indication of a memory leak in a third-party program that modifies the operating system at a low level. Ask for guidance in that case.
    If you don't have an obvious memory leak, your options are to install more memory (if possible) or to run fewer programs simultaneously.
    The next suggestion is only for users familiar with the shell. For a more precise, but potentially misleading, test, run the following command:
    sudo leaks -nocontext -nostacks process | grep total
    where process is the name of a process you suspect of leaking memory. Almost every process will leak some memory; the question is how much, and especially how much the leak increases with time. I can’t be more specific. See the leaks(1) man page and the Apple developer documentation for details.

Maybe you are looking for