Script to set brightness depending on battery

Hello guys,
I'd like to set the brightness on my machine depending on the usage of battery.
If the battery is available it should be set to 100%, if not then to the minimum to save battery life.
I thought about something like that but as I currently have no battery available I can't test it.
In /etc/rc.local
if acpi -a | grep off-line 2> /dev/null; then
xbacklight -set 0
else
xbacklight -set 100
fi
What do you think?
Last edited by orschiro (2010-03-22 07:03:47)

Hello chpln,
I know laptop-mode can do this but as I simply want just this feature it's too bloated for my usage.
Regards

Similar Messages

  • Program to automatically adjust brightness dependent on power source?

    I just bought a MacBook Pro and would love to have my screen brightness adjust automatically based on whether or not the machine is plugged in. I find that the first thing I do when I plug it in or unplug it is adjust the brightness. I like the screen at full brightness when it is plugged in but on a lower setting when running on battery power.
    You would think that the Energy System Preference would include these settings. Does anyone out there know of such a beast???
    Thanks,
    Frank

    It's in the Energy Saver Preference - battery then
    click options - there is a box.
    I am aware of that setting: "Redcue the brightness of the built-in display when using this power source"
    However, what I am looking for is something that will allow me to specify EXACTLY how bright I want the display to be when it is plugged in and how bright I want it to be when it is not plugged in. The checkbox provided in the Energy Saver preference does not give me any control. How much is it reducing it? What if I had already manually set it low? Will it reduce it further? The checkbox is basically useless.
    Thanks anyway,
    Frank

  • How to create the Sap script & Layout Set (wants sample code)

    Hi All ,
    Can you please provide me the step by step procedure
    to create the Sap script & Layout Set .(please provide sample
    code/links /docs for layout & print program).
    Regards
    Rahul

    hi,
    go through the following links  what i found to create sap script.
    http://www.thespot4sap.com/Articles/SAPscript_Introduction.asp
    http://abapliveinfo.blogspot.com/2008/01/free-sapscript-made-easy-46-book.html
    http://www.thespot4sap.com/articles/SAPscript_example_code.asp
    http://idocs.de/www3/cookbooks/sapscript/sapscript_1/docu.htm
    http://idocguru.com/www5/cookbooks/sapscript/sapscript_1/example.htm
    www.geocities.com/wardaguilar25/sapscript-tutorial.html
    http://logosworld.de/www3/cookbooks/sapscript/sapscript_8/docu.htm
    how to create a  scripts?give steps?
    https://forums.sdn.sap.com/click.jspa?searchID=1811669&messageID=2969311
    https://forums.sdn.sap.com/click.jspa?searchID=1811669&messageID=2902391
    https://forums.sdn.sap.com/click.jspa?searchID=1811669&messageID=3205653
    https://forums.sdn.sap.com/click.jspa?searchID=1811669&messageID=3111402
    http://www.sap-img.com/sapscripts.htm
    http://sappoint.com/abap/
    http://www.henrikfrank.dk/abapexamples/SapScript/sapscript.htm
    http://help.sap.com/saphelp_crm40/helpdata/en/16/c832857cc111d686e0000086568e5f/content.htm
    http://www.sap-basis-abap.com/sapabap01.htm
    http://www.sap-img.com/sapscripts.htm
    http://searchsap.techtarget.com/tip/1,289483,sid21_gci943419,00.html
    http://sap.ittoolbox.com/topics/t.asp?t=303&p=452&h2=452&h1=303
    http://www.sapgenie.com/phpBB2/viewtopic.php?t=14007&sid=09eec5147a0dbeee1b5edd21af8ebc6a
    Other Links

  • Script to set display name in iCS Calendar view to the LDAP CN

    Script to set the display name in the Calendar view for iPlanet Calendar
    Server(iCS) to the LDAP common name(CN)
    By default, iCS uses a user ID(uid) based on an employee number, rather than on
    an employee's first and last name, as the calendar ID(calid).
    The current release of iCS (5.0 P2) does not create a display name for a
    calendar when a user enables a calendar by logging in; by default, it will
    list the calid again in the Display Name field of the Calendar view.
    For example, if an employee has a calid of "12345," when you click the
    Calendar tab to view the calendar, the Display Name will appear as follows:
    <P>
    12345 (12345)
    <P>
    A problem arises when a user tries to subscribe to another user's calendar.
    Although the search criteria are based on the calid and the Display
    Name, the only information currently stored in the calendar database is the
    calid. Therefore, users will be unable to subscribe to another
    user's calendar unless they know the calid of that person. The next
    patch release for iCS will remedy this problem by using common names(CNs) as
    the Display Names. That is, the database will store the CN values
    from LDAP for users, and the Calendar view will appear something as follows:
    <P>
    12345 (John Doe)
    <P>
    Until this next release of iCS, there are two options to work around this
    problem.
    <P>
    <OL>
    <LI>You can "provision" users by running the cscal
    administrative utility with the
    Display Name option.
    <P>
    OR
    <P>
    <LI>If the user community already exists, you can use the sample Perl script
    below to search through the calendars of users.
    <P>
    Note: If a default calid exists that doesn't have a Display Name, the script
    will search the LDAP directory to find a CN to set as the Display Name for
    that calendar.
    </OL>
    <P>
    <HR>
    <P>
    <B>Sample Perl Script:</B>
    #!/bin/perl5.004
    sub TRUE {1}
    sub FALSE {"}
    $SIG{INT} = 'handler';
    $SIG{QUIT} = 'handler';
    $mypath = $ENV{'LD_LIBRARY_PATH'};
    $savepath = $mypath;
    $ENV{'LD_LIBRARY_PATH'} = $mypath.';.';
    #--------------INITIALIZATION----------------
    $host="ldaphost";
    $base_dn="ou=People,o=iplanet.com";
    $port=389;
    $auth_dn="cn=Directory Manager";
    $auth_pwd="password";
    $found_confile = TRUE;
    $default_cal = FALSE;
    open(CSCAL,"./cscal -v list |");
    while($cal_list = <CSCAL>)
    if ($cal_list =~ m/: owner=/)
    @calid = split(' ',$cal_list);
    chop($calid[0]);
    print "\ncalid: $calid[0] ... ";
    $default_cal = TRUE if ($calid[0] !~ m/:/);
    } elsif (($default_cal) && ($cal_list =~ m/^ name=([a-zA-Z ]*)/)) {
    chomp($1);
    print "cal name: $1";
    if (($1 EQ ") || ($1 EQ $calid[0]))
    open(LDAPSEA,"./ldapsearch -h $host -p $port -b \"$base_dn\" -D
    \"$auth_dn\" -w \"$auth_pwd\" uid=$calid[0] |");
    while($ldap_list = <LDAPSEA> )
    if ($ldap_list =~ m/^cn: ([a-zA-Z ]*)/)
    chomp($1);
    `./cscal -n "$1" modify $calid[0]`;
    print "The display name for $calid[0] is being modified to be: $1\n";
    sleep(1);
    close(LDAPSEA);
    $default_cal = FALSE;
    close(CSCAL);
    sub handler
    local($sig) = @_;
    print "... Caught a SIG$sig--closing down shop\n";
    close(CSCAL);
    close(LDAPSEA);
    exit(0);
    }

    anne wrote:
    Hi David,
    About your confuse about"case when 1=2 then "product_d"."name" else "calendar_d"."year" end".
    You can try in your locale.
    You will find they are different.
    BASED ON THAT you have two table product_d and calendar_d AND they are related by one Fact table.
    THEN When you type in
    "case when 1=2 then "product_d"."name" else "calendar_d"."year" end"
    AND
    "calendar_d"."year",
    IT WILL SHOW U TWO different RESULTS.
    I need to show year which its related product is not null. but I cannot use SHOW->SQL RESULTS->TYPE SOME "WHERE..." because I also need to use "constrain"..
    That why I choose to use a case when function..
    So, do you have any idea about this?
    Regards,
    AnneWhy not use two filters in your request? Have something like this:
    product_d.name IS NOT NULL
    AND
    calendar.year IS PROMPTED?
    ...instead of using a CASE statement? This way you can have both filters show the way they should in a meaningful way.

  • Group Policy - Computer Startup Scripts - Add/Set Default printer

    Good Morning.
    Let's say we have 2 offices, A and B, and only 1 user.  The user is using Roaming Profiles.  Each office has its own printer.
    What I am trying to do, is make a Startup script that is specific to the COMPUTER being logged into so when any user logs into that computer, they get the printer in that office defined and set as default.
    I am able to do this successfully with my script but ONLY if i have the script be on the USER side of GP (i.e. in the Logon script section)
    That is great that that is working however, when my user goes to Office B, they still get mapped to Office A's printer if I use that method.
    So I figured I could just modify my GP and run the same script from the STARTUP section of the computer, rather than the LOGON section of the user.  It does not work.
    Here is my script:
    Set WRFCUNetwork = CreateObject("Wscript.Network")
    PrinterPath = "\\fileserver\MAINTELLER"
    PrinterDriver = "PrinterDriver"
    WRFCUNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver
    WRFCUNetwork.SetDefaultPrinter "\\fileserver\MAINTELLER"
    This is where I Have the script placed:
         Computer Configuration -> Windows Settings -> Scripts(Startup/Shutdown)
    Once i'm in there, I double click Startup, click Add, and select my script which is named:
         MainPrinterSetup.vbs
    I have this GP applied to ONE OU, and that OU has ONE computer in it (my test computer)
    I login with a brand new user called "testuser" (creative, huh?) and basically nothing happens
    except they log in and have some Microsoft Document Image Writer printer set as default (which by the way sure does slow the PC down to the point of it almost being broke if anyone actually tries to print to that by accident)
    No Main Teller Printer, no anything.
    The strangest part about this is, if i apply this script to the user LOGON scripts, it works fine, the printer is there, and is set as default. (but see above why that wont work for my situation)
    So obviously the script works fine, but I guess i'm missing something when it comes to applying GP's to Computers rather than Users.
    Can anyone shed some light as to why the script is not running (i'm guessing the script isn't even attempting to run, rather than failing, but i have no way to know that)
    Thank you in advance!!
    Derek Conlon
    Network Administrator
    WRFCU
    EDIT:  Here are the PC's info that i'm working on:
         Server:  Windows Server 2003 Standard Edition (where my GP's are created and managed with AD)
         Target PC:  Windows XP Professional SP3
    EDIT #2:  I manually navigated to the Script file after logging in and "opened" it and it added and set the default printer no problem.  the issue is definately with the script running at startup.

    I wanted to clarify a few things:
    1. While it is true that printer connections are usually per user, it is definitely possible to create "global printers".  There are a number of ways to do this, but two methods that come to mind are using:
    a. "Rundll32 printui.dll,PrintUIEntry" option with the "/ga" switch.  The "/ga" switch is the key here since it allows you to deploy printers "per machine" instead of "per user".  More information
    about this is available at:
    http://members.shaw.ca/bsanders/NetPrinterAllUsers.htm
    http://technet.microsoft.com/en-us/library/ee624057%28WS.10%29.aspx
    http://www.computerperformance.co.uk/Logon/logon_printer_computer.htm
    http://www.robvanderwoude.com/2kprintcontrol.php
    b. The Print Management console that is available in Windows 2003 R2 and higher can help you deploy printers "per machine" in addition to "per user".  More information about this is available at:
    http://www.czsolution.com/print-management/print-management/print-management-console.htm#DeployingPrintersByGroupPolicy
    http://technet.microsoft.com/en-us/library/cc753109%28WS.10%29.aspx
    2. As Guy mentioned, Group Policy Preferences can help set the default printer.  But there is another way to accomplish this.  The problem with the computer startup portion is that it runs before the user logs in.  And applying this script
    in the login script section would not work per computer unless you used loopback processing.  So another way to do this is to place a script that sets the default printer into the "All Users" startup folder.  Items in the "All Users"
    startup folder run for any user that logs into the computer, but it runs in the user's context.  So, this script would effectively set the default printer on a "per machine" basis.  The script method is a cruder way to approach the problem,
    but it will help get the job done.  Here are some resources on setting the default printer via script:
    http://www.intelliadmin.com/index.php/2007/08/set-default-printer-from-a-script
    http://www.computerperformance.co.uk/ezine/ezine17.htm

  • Sony VAIO VGN-FW11E - can't set brightness

    Hello everyone!
    I have really annoying problem with my laptop - setting brightness just don't work. I have tested many others distributions and this work only under Ubuntu 9.10 beta. I think that is connected with this. How can I use this patch  in arch?
    Laptop: Sony VAIO VGN-FW11E
    Graphic card: ATI Radeon HD3470
    I'm sorry for my english but people in polish forum just can't help me ;p

    oskar.einstein wrote:
    @B I'm not able to make so specific changes like you said. I can build something from AUR, sometimes also make some changes to PKBUILD's but doing something with dsdt is to hard for me.
    @litemotiv
    Do you think I shoud compile new kernel with new sony-laptop module inside?
    hmm, i'm not certain that will fix it for you..
    do you already have a fixed dsdt for your laptop? if you do, the best way is to compile a kernel with these lines added to the kernel config file:
    CONFIG_STANDALONE=n
    CONFIG_ACPI_CUSTOM_DSDT=y
    CONFIG_ACPI_CUSTOM_DSDT_FILE="DSDT.hex"
    that will definitely fix the brightness issue. the sony-laptop module is built by default, so you don't have to compile that specifically (the module is needed to get the function-keys on your keyboard working, it shouldn't have any influence on the brightness itself).
    if you don't have a custom dsdt yet, you need to make one following the instructions on the vaiobuntu blog. it's a bit daunting at first, but i assure you that it's doable.
    Last edited by litemotiv (2009-10-26 21:11:30)

  • Scripting & Applying Set Percentage in Javascript

    I need to script a set percentage to an existing calculated total field in order to show a new field total with the set percentage applied. Total is already calculated in the form, but I'm not sure how to plug in the 2.25% to calculate for a final total.
    Example:
    Total ____
    Final Total ____ (new field with 2.25 percentage applied)

    Robert,
    Great – thanks! I did figure that out (eventually), but now have the issue of the Permit Fee field showing $0.26 when it should just show $0.00 until the Number field is filled in and the amount is calculated. Can you help? The error screen says that it doesn’t like the last equal sign. I’m at a loss…
    TopmostSubform.Page1.Cell[10].Permit_Fee::calculate - (FormCalc, client)
    Permit_Fee.rawValue = (4000.00Cell[8].Number + 0.25)1.0225
    If(Number.isNull | Permit_Fee = “”)
    Thanks!
    Noemi Harvell

  • Want a Script to set Computer extensionattribute in Bulk

    Want a Script to set Computer extensionattribute in Bulk by giving input from CSV Computer Name and extensionattribute.
    Regards,
    Kashi
    Kashi

    Hi Kashi,
    You can find pre-written scripts in the repository:
    http://gallery.technet.microsoft.com/scriptcenter
    If you can't find what you need, you can request a script here:
    http://gallery.technet.microsoft.com/scriptcenter/site/requests
    Let us know if you have any specific questions. This would be a pretty basic script, so you can use this requirement as a good excuse to learn how to get around in PowerShell. If you haven't had any exposure at all, you can check out the learning resources
    here:
    http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx
    Don't retire TechNet! -
    (Don't give up yet - 12,950+ strong and growing)

  • Can't set brightness after screen blanking

    After last update, I can't set brightness after the screen goes off because of inactivity, before that everything works normally.
    When I reboot brightness setting works, as is after suspend/unsuspend.
    The laptop is Dell Latitude D830.
    Any ideas?

    b4d wrote:
    After last update, I can't set brightness after the screen goes off because of inactivity, before that everything works normally.
    When I reboot brightness setting works, as is after suspend/unsuspend.
    The laptop is Dell Latitude D830.
    Any ideas?
    Can you share your kernel version and graphics controller information, please? I had a similar issue with my graphics controller after upgrading to the 3.x kernel in core.

  • Error in script to set album rating in iTunes

    Hi
    I used to use the following script to set album ratings of albums in my iTunes library.  It used to work fine, but now it's not working.  When I try to debug it I am getting the following error:
    "Scripting component error."
    on this line in the third block:
    repeat with R in (rating of tracks whose album is thisAlbum)
    I wonder if anyone can spot what the problem might be?
    Thanks,
    Nick
      --Make a list of all the selected albums:
              set theAlbums to {}
              set theAlbumsRef to a reference to theAlbums
              set tempList to album of selection
              set thePreviousTitle to ""
              repeat with thisTitle in tempList
                        set thisTitle to thisTitle as text
                        if thisTitle is not thePreviousTitle then
                                  copy thisTitle to the end of theAlbumsRef
                                  set thePreviousTitle to thisTitle
                        end if
              end repeat
              set numberOfAlbums to count theAlbums
      --Make a list containing one track for each selected album:
              set theTracks to {}
              set theTracksRef to a reference to theTracks
              repeat with thisAlbum in theAlbums
                        copy (track 1 whose album is thisAlbum) to the end of theTracksRef
              end repeat
      --Set the album rating of each album contained in the selection:
              set theRatings to ""
              set k to 0
              repeat with thisTrack in theTracks
                        set k to k + 1
                        if k mod 25 = 0 then beep 1 -- for audio feedback
                        set thisAlbum to item k of theAlbums
                        set numberOfTracks to 0
                        repeat with k from 1 to (disc count of thisTrack)
                                  try
                                            get (track count of track 1 whose (album is thisAlbum) and (disc number is k))
                                            set numberOfTracks to numberOfTracks + result
                                  end try
                        end repeat
                        set songRating to 0
                        repeat with R in (rating of tracks whose album is thisAlbum)
                                  if R > 80 then set R to 80
                                  set songRating to songRating + R
                        end repeat
                        set thisRating to round (songRating / numberOfTracks)
                        set album rating of thisTrack to thisRating
                        set theRatings to theRatings & (album artist of thisTrack & tab & thisAlbum & tab & (thisRating as text) & return)
              end repeat
              display dialog "The album “" & thisAlbum & "” has a rating of " & thisRating with icon 1 buttons {"OK"} default button 1
    end tell

    problems like this are usually solvable by splitting up the line.  It doesn't look like it, but there's a whole lot going on in that compound statement. try:
    tell application "iTunes"
              set ratingList to (rating of tracks whose album is thisAlbum)
              repeat with R in ratingList
                        if R > 80 then set R to 80
                        set songRating to songRating + R
              end repeat
    end tell

  • CC startup script to set Preference "Default Composer"?

    I have a startup script that I wrote for CS3 that controls about 20 preferences.
    One of the preferences was for Composer, which was by: app.textDefaults.composer = "Adobe Single-line Composer"
    This script has worked for CS 3, 5, 5.5, and 6 (we skipped 4)
    We're moving to CC and my script still works, but I see a new preference at Preferences > Advanced Type for "Default Composer"
    I get lost in ExtendScript's Object Model Viewer, so would someone be kind enough to tell me what to add to my startup script to set the Default Composer to Adobe Single-line Composer
    Thanks for your time
    Tom

    It seems to be related to app.textDefaults, but it seems to me that it's broken...

  • How to set brightness and contrast of video please

    Hi, how can I set brightness and contrast of video in OSMF please?
    I tried add filters to MediaContainer and VideoSurface of VideoElement, but doesn't work.

    I think I find the reason, OSMF uses StageVideo other than Video when StageVideo is available. StageVideo doesn't support filters or mask.
    So the answer would be no way unless I switch back to Video.

  • Need help: Flex  record webcam problem, how to setting Brightness,Contrast,Saturation and Sharpness

    Hello, dear all
    Please help me!
    Flex  record webcam problem, how to setting Brightness,Contrast,Saturation and Sharpness?
    nsOutGoing=new NetStream(nc);
    nsOutGoing.attachCamera(m_camera);
    nsOutGoing.publish(filename, "record");
    I want to control the Brightness,Contrast,Saturation and Sharpness for the recorded flv file.
    At present, I only can control the videodisplay object, but I can not able to control Camera.
    Thanks very much!!
    kimi
    MSN: [email protected]

    Can I change a Video object to to Camera object, If yes, How do??
    nsOutGoing.attachCamera(video as Camera);// it does not work rightly
    thanks

  • Script to set reference point

    I need a script to set transform reference point at desired position without clicking in these tiny squares in the selectors, both in control panel or transform palette.
    I will bind these scripts to numpad keys with AutoHotKey and will be happy at last.
    Help me, please, I have little experience in scripting and see entry for grabbing this task.

    Look up Transformation in the references

  • Cs5 on a new pc transferring actions/scripts/pre-sets etc?

    I have just upgraded computers and re-installed CS5 on it.
    Is it possible to cut and paste actions/scripts/pre-sets etc from old pc to new one.
    If so how/where would I find them?
    Thank you
    Tim

    each program has its own location for its settings.  eg, ps:  http://helpx.adobe.com/photoshop/kb/preference-file-functions-names-locations.html

Maybe you are looking for

  • How can i adopt the iPhone App-Structure to iTunes for Sync?

    Hello Community! I usually buy apps or games directly over the iPhone-App-Store and i also manage the folder structure directly on the iPhone Screen. Yesterday i bought a new App via the iTunes Store on my MacBook (don't know why, i thought it would

  • Apex collection.........

    i have put the below coding in application process. Using Ajax i call this process and tried to run and get the value from the collection book and display it a field. but the the value *'a'* is not storing in p_c001. How to find whether below coding

  • Problem of unit of measurment in production system

    Hi Friends, I'm facing a peculiar problem of unit of measurement like error in all quantity and curreny fields in report output after transporting a query from quality system to production system but this query is generated from multiprovdier. what m

  • VoiceOver volume too low

    I hope everybody can understand the title , as I am still an English learner Recently I got a ipod shuffle and I love it.But when it is noisy outside I am not able to hear the voiceover , for the volume is too low.Especially when changing playlists.

  • How to re-install iPhoto?? on a LION OX

    I just update iphoto and now i can not open it!! it says that i need to re-install it? but i do not have a cd, it came pre-installed!! Any ideas??. OS is LION.