Needed help with Automator - System Prefs

Hi,
I'm hoping to make an automator workflow that changes some system preferences that I have to change frequently in switching between a work computer and media center.
When it's used as a media center it's setup with a lower resolution to match the TV and the energy settings and screensaver are set to never be used when in media center mode.
Is there a way to use automator or even apple script to change the resolution, energy, and screensaver settings back to my normal settings?
I tried using the record option in Automator but it doesn't seem to recognize anything specific at all.
Could someone please help me set this up?

See http://discussions.apple.com/thread.jspa?threadID=2039384 and Introduction to Automator tutorial at http://automator.us/leopard/video/index.html

Similar Messages

  • Help with automating "System Update"

    edit:
    please help - who do I contact in Lenovo / IBM to get real help with this ?
    this is a corporate project and I need to resolve this as soon as possible.
    does anyone from Lenovo actually read this forum?
    I've opend a support call in Lenovo's helpdesk (via email) but no reply except an automated one for... like a week.
    help! help! help! we don't mind paying for it, we NEED to resolve this.
    any help at all would be greatly appretiacted. please point me at the right direction?
    sorry for this venting but really, I just need to get a move on this already... :-0
    can anyone at all help ?
    any idea where I can find more information / expert assistance ?
    thanks for any help...
    -Shay
    Hi,
    I've been able to fully automate System Update distribution using Group Policy. this works perfectly.
    I am now trying to achive the same functionality using scritps.
    the problem: I get quite a few prompts for "License Agreement" - not the "master" initial one, only a few for the different installs.
    here's my setup:
    1. a local server is the repository.
    2. I import a .reg file before installing "System Update" using an automated install.
    3. after a restart, a command runs on the local machine.
    here are the details:
    registry settings:
    [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Lenovo\System Update]
    "LanguageOverride"="EN"
    [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Lenovo\System Update\UserSettings\General]
    "IgnoreLocalLicense"="YES"
    "DisplayLicenseNotice"="NO"
    "DisplayLicenseNoticeSU"="NO"
    "ExtrasTab"="NO"
    "RepositoryLocation1"="***my internal server here ****"
    "RepositoryLocation2"=""
    "RepositoryLocation3"=""
    "NotifyInterval"="36000"
    [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Lenovo\System Update\UserSettings\Scheduler]
    "SchedulerAbility"="YES"
    "SchedulerLock"="LOCK"
    [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Lenovo\MND\TVSUAPPLICATION]
    *** network drive mapping here, this part works ***
    also, I use this command to run the updates:
    call "C:\Program Files\Lenovo\System Update\tvsu.exe" /CM -search A -action INSTALL -IncludeRebootPackages 1,3,4 -noicon
    I am just about desperate... I would REALLY REALLY appreciate any help, hint etc :-)
    Thanks for ...even trying... lol
    regards,
    Shay
    Message Edited by catman2u on 03-18-2008 05:04 AM
    Message Edited by catman2u on 03-25-2008 02:41 AM

    catman2u wrote:
    does anyone from Lenovo actually read this forum?
    From the Communiy Rules in the Welcome section....
     Objectives of Lenovo Discussion Forums
    These communities have been created to provide a high quality atmosphere in which users of Lenovo products and services may share experiences and expertise. While members from Lenovo may participate at intervals to engage in the discussions and offer advice and suggestions, this forum is not designed as a dedicated and staffed support channel. This is an informal and public forum, and Lenovo does not guarantee the accuracy of information and advice posted here -- see important Warranty information below.
    No amount of ranting is going to get you anything more than you will achieve with a clear exposition of your issue... so you might want to try doing that instead of ranting and assuming that everyone already knows what you know etc etc.
    Cheers,
    Bill
    I don't work for Lenovo

  • Need help with Automating Printer and LPR installation

    I work for someone who has a need for automating the print installation of LPR print port to mac laptops. Obviously this will need to cover anything OS X 10.3 and above. All of this needs to be done command line via a batch file of sorts.
    I am a windows and Linux guy, however I just bought a Mac and starting to like the new Leopard OS and the capabilities of boot camp.
    What I need:
    1) how to install LPR port to the laptop
    2) installing a printer from a some sort of cab file with correct port and drivers. (in windows we use print migrator, however the cab files we use for windows will obviously not work with different port types and drivers)
    3) finally some clean up type script that will clean up any temp files I had to create or such.
    I kind of need this soon so if anyone knows how or could point me in the right direction. It would be greatly appreciated.

    If you force restart the computer on the freeze up, or force quit the printer adding window, does the printer appear in the print and scan system preference?   In other words, did the printer successfully install?  (is it possible that the setup part of the install failed, but the actual install worked?)
    If so, you might be able to set the configurations yourself.
    Open up the print and scan system preference.  Double click on the printer.
    When the printer queue window opens up, you should be able to click on the printer setup button.
    Go through all the tabs and set things up the way you like.
    HTH
    -Graham

  • Need help with File system creation fro Oracle DB installation

    Hello,
    I am new to Solaris/Unix system landscape. I have a Sun enterprise 450 with 18GB hard drive. It has Solaris 9 on it and no other software at this time. I am planning on adding 2 more hard drives 18gb and 36gb to accommodate Oracle DB.
    Recently I went through the Solaris Intermediate Sys admin training, knows the basic stuff but not fully confident to carry out the task on my own.
    I would appreciate some one can help me with the sequence of steps that I need perform to
    1. recognize the new hard drives in the system,
    2. format,
    3. partition. What is the normal strategy for partitioning? My current thinking is to have 36+18gb drives as data drives. This is where I am little bit lost. Can I make a entire 36GB drive as 1 slice for data, I am not quite sure how this is done in the real life, need your help.
    4. creating the file system to store the database files.
    Any help would be appreciated.

    Hello,
    Here is the rough idea for HA from my experience.
    The important thing is that the binaries required to run SAP
    are to be accessible before and after switchover.
    In terms of this file system doesn't matter.
    But SAP may recommend certain filesystem on linux
    please refer to SAP installation guide.
    I always use reiserfs or ext3fs.
    For soft link I recommend you to refer SAP installation guide.
    In your configuration the files related to SCS and DB is the key.
    Again those files are to be accessible both from hostA and from hostB.
    Easiest way is to use share these files like NFS or other shared file system
    so that both nodes can access to these files.
    And let the clustering software do mount and unmount those directory.
    DB binaries, data and log are to be placed in shared storage subsystem.
    (ex. /oracle/*)
    SAP binaries, profiles and so on to be placed in shared storage as well.
    (ex. /sapmnt/*)
    You may want to place the binaries into local disk to make sure the binaries
    are always accessible on OS level, even in the connection to storage subsystem
    losts.
    In this case you have to sync the binaries on both nodes manually.
    Easiest way is just put on shared storage and mount them!
    Furthermore you can use sapcpe function to sync necessary binaries
    from /sapmnt to /usr/sap/<SID>.
    For your last question /sapmnt should be located in storage subsystem
    and not let the storage down!

  • Need help with automating text import/pasting/macro between Photoshop and Excel

    Hey everyone,
    I'm working on a large project now that seems extremely daunting, but I was hoping there would be some way to automate it using either Actions or some sort of macro program.  Here's the gist:
    I've created a template with 24 differently sized text boxes in the photoshop image file.  Each text feild has unique text that needs to be be pasted into it, which has been compiled in excel.  This wouldn't be too dificult to do, except I have to recreate this image and all 24 text fields aproximately 350 times.  None of the text boxes will remain static through all 350 images as text is the title, description, and demographic ratings/percentages/data for the topic of each image.  I did something similar manually last year and it took me about 3, non-stop 18 hour days to complete it.
    (the test template)
    Can anyone think of any way I could automate this process?  I'm thinking some sort of macro that copies cell 1 in excel, switches to photoshop, opens layer 1, pastes, switches back to excel, goes to cell 2, copies, back to photoshop, layer 2, pastes, etc, etc, then does a 'save as' in photoshop and revets to PS layer 1, EX cell 1 (on tab 2) to start the process all over again.  I have no idea if this would work or if there is another way to do this but I would really appreciate any help or advice you guys could give.  I don't have really any expreience using PS Actions or macro programs/scripts, so I may be over my head or overlooking a really simple way to do this.  If there's a way to do it, I'm persistent enough to figure it out and get it working. Doesn't really matter how it gets done, I just need to fill those text boxes as best as I can and as quickly as I can.
    Any help you all could give is really appreciated.

    Have you read up on the Variables support in Photoshop?

  • Need help with Inventory System

    I am trying to throw together a semi-elegant inventory
    viewing system for a web site I am creating. The current website is
    going to be scrapped and remade relatively soon, so I really just
    want a quick and dirty solution. As such, I have been using some
    spry with xml datasets. I happened upon an article
    here
    that clued me in to a particularly interesting method of presenting
    the data, so I am attempting a similar design, along with code from
    spry samples (lots of cut-n-paste unfortunately, which is probably
    a major reason why I have so many problems). Anyway, here is the
    relevant info:
    Right now I have folders for each category, with an xml file
    for each size category. I arranged it this way, because I was
    originally going to use straight html files for each size category
    and in each folder, obviously not very practical. I played around
    with the idea of putting all sizes into one file and letting some
    spry+xml magic sort it out, but since I can't even get this to work
    I haven't really tried it. If you experts would clue me in as to
    which version might be more efficient or if you have any other
    ideas please feel free to put me in my place.
    Before I go any further, my main problem is the third line of
    the first piece of code, I'm having trouble getting the dsStock xml
    to load properly. The original example I cited above was using
    Coldfusion, but I guesstimated that it wouldn't be a problem to
    just load some straight xml files. Before I go any further I would
    at least like to know if what I am attempting is possible.
    Code to load in data for menus, category selection, and
    actual inventory etc........
    quote:
    var dsCategories = new Spry.Data.XMLDataSet("diamond.xml",
    "diamonds/diamond");
    var dsSize = new Spry.Data.XMLDataSet("size.xml",
    "sizes/size");
    var dsStock = new
    Spry.Data.XMLDataSet("{dsCategories::@id}/{dsSize::name}.xml",
    "inventory/product");
    diamond.xml
    quote:
    <?xml version="1.0" encoding="utf-8"?>
    <diamonds>
    <diamond
    id="AS"><name>Asscher</name><img>../img/diamond/thumb/asscher_diamond_chicago.jpg</img></ diamond>
    <diamond
    id="CU"><name>Cushion</name><img>../img/diamond/thumb/cushion_diamond_chicago.jpg</img></ diamond>
    </diamonds>
    size.xml
    quote:
    <?xml version="1.0" encoding="utf-8"?>
    <sizes>
    <size><name>0.70-0.99</name></size>
    <size><name>1.00-1.49</name></size>
    </sizes>
    snip of some inventory
    quote:
    <?xml version="1.0" encoding="utf-8"?>
    <inventory>
    <product
    id="B801-508"><shape>Asscher</shape><weight>0.7</weight><color>G</color>
    <clarity>VVS2</clarity><depth>71.1</depth><table>61</table><flo>None
    </flo><polish>Excellent</polish>
    <symmetry>Very
    Good</symmetry><dim>4.97x4.77x3.39</dim><price>2592.1</price>
    </product>
    <product
    id="B800-125"><shape>Asscher</shape><weight>0.7</weight><color>G</color>
    <clarity>VS1</clarity><depth>68.2</depth><table>58</table><flo>None
    </flo><polish>Very Good</polish>
    <symmetry>Very
    Good</symmetry><dim>4.93x4.78x3.26</dim><price>2366.7</price>
    </product>
    </inventory>
    Here is the actual code in the site (this seems to work out
    alright). I haven't rewritten the actual inventory portion yet,
    since I can't really get it to load properly. If I can get the xml
    I know that I can get it on the page.
    quote:
    <ul spry:region="dsCategories"
    spry:repeatchildren="dsCategories">
    <li class="product" spry:selectgroup="1"
    spry:select="selected" spry:hover="hover"
    spry:setrow="dsCategories">{dsCategories::name}</li>
    </ul>
    <ul spry:region="dsSize" spry:repeatchildren="dsSize">
    <li class="product" spry:selectgroupd="2"
    spry:select="selected" spry:hover="hover"
    spry:setrow="dsSize">{dsSize::name}</li>
    </ul>
    Sorry for the long post, but thanks for taking the time to
    give it a read and see if you can help me out. I will be eternally
    grateful.

    Hi StevenMig,
    I'm not seeing anything obvious. Have you tried loading your
    XML files directly to see if there are errors in the XML? Is your
    server serving up XML files with a Content-Type of text/xml or
    application/xml?
    If you post a sample page, perhaps me or someone else on the
    forum can take a look?
    --== Kin ==--

  • Need help with andriod system -flash player.

    Am using an andriod tablet ZTE with vrsion 4.0 plus as per manufacturer info pamphlet. I have tried to install/ download flash player for this tablet and no luck at all. Can Adobe AIR  work well enough to view content on training video presentations even when it says that I need a flash player. I am new to this computer and android stuff and have no luck with help from my teenage kids either. Any info , assistance and guides is super greatly appreciated . Any direct answers can be sent to [email protected] or leave message here and I will check again in the mornings . Thanks for any feedback. Cheers and best regards rickyrem51.

    There is no Flash Player for Android anymore, and there won't be another. Android (Google) recommends using a "serverside" browser if you need to view Flash content with an Android device. The recommend "Dolphin" or "Puffin". BOTH are free in the GooglePlay Store.

  • Need help with Automator code.

    So I am trying to make the toggle hidden files Service and I pretty much have it but there is one thing that annoys me.  So the code so far is:
    STATUS=`defaults read com.apple.finder AppleShowAllFiles`
    if [ $STATUS == TRUE ];
    then
        defaults write com.apple.finder AppleShowAllFiles FALSE
    else
        defaults write com.apple.finder AppleShowAllFiles TRUE
    fi
    killall Finder
    The problem with this (At least on Mavericks) is it's not reopening my Finder window.  Of course I would love it to open to the same folder, or even open so the window is in the same location on the screen,  but it's not even reopening the window anywhere and I have to reopen it at the dock.  Now I know this isn't a huge deal but It's really bugging me and (not saying this is a bad thing) I have 3 screens so whin finder is open on the far right and then I have to go to the dock on the far left it takes up way more time then just a wuick jot down.  So I tried to add code where I just open the app (then I would deal with window in nsame area and same folder later, so I added this:
    open /System/Library/CoreServices/Finder.app
    And it did nothing.  Not even opening a window at default location.  So if anyone out there knows how to solve all three of these problems or ven just one your help would be greatly appreciated.  Thank you for your time and I hope to hear from you shortly.

    Do this:
    killall Finder
    Add a pause.  I found 3 seconds seems to be good.  2 seconds might work.
    open .
    Kills Finder and then reopens.  If you don't include the pause it doesn't work.
    The trick is to figure out how to set your current directory as a variable and then kill Finder, and then reopen it, using the variable as your path so it will reopen to the directory you were previously in.  If you figure that out let me know.

  • Need help with control system that reduces a flat output signal every time a certain input exceeds given value

    I'm having difficulty setting up a closed loop control system that reduces one of my voltage outputs (connected to a high voltage system) by 30% every time a measured voltage exceeds a certain threshold value.  I'm using a USB 6229 DAQ.  I've been trying to create a waveform that looks like a DC signal, but the only waveforms that I can seem to manipulate while my VI is running are the stock waveform types.  Also, I've tried to use a formula node or conditional structure to update the output value every time the measured voltage exceeds a given value, but everything I do reinitializes the output value every time it runs or won't store the previous signal value.  I'm using LabVIEW 8.6 and don't have the PID or similar express VI's.  I've attached the mess I've got working right now.  Can anyone help?  I'm really stuck!
    Thanks! 
    Attachments:
    HiV step down.vi ‏40 KB
    output control.vi ‏100 KB

    I'm sorry it's such a mess; I'm still pretty new at this.  These are both little driver programs for a larger overall control program. 
    Output control is meant to send a flat signal to the DAQ whose value can be manipulated while the VI is running.  I have the second activated segment merely to check the values being output.  I didn't realize I attached a version with a meaningless control...I had a control where the user would put in the stating voltage (the high voltage source has a 1V-100V setting for external control).  I've attached this slightly different but equally dysfunctional version.  Ideally, I would have liked something like the analog signal generator vi to come with an input wiring for offset on the DC signal.  Most of the code was diabled because it is copied from an example; it is largely rubbish.  I initially used the DAQ Assistant, but when things weren't working out I switched to putting in each step manually to try to troubleshoot.
    As far as HiV step down is concerned, I've tried something different with a nested case structure (if that's the right terminology?), and I've attached that file.  I think this problem has been solved, but you never know!
    Attachments:
    output control slightly different.vi ‏100 KB
    HiV step down w case structures.vi ‏44 KB

  • Need help with ink system failure Oxc19a0020

    I have followed instructions on HP site for general "ink system failure".  I have cleaned printer head and disconnected power and commnunication cables.  I have cleaned heads twice and disconnected the cables at least three times.  Disconnection has been for a minimum of 60 seconds and as long as several hours.  When I restart printer, it goes through it start-up procedure and immediately displays ink system failure with code Oxc19a0020.
    HP site does not list this code.  HELP!

    Here is a document that deals with all 0x... errors, just in case you haven't done all the steps:
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c00489814&cc=us&dlc=en&lc=en
    007OHMSS
    I was a support engineer for HP.
    If the advice resolved the situation, please mark it as a solution. Thank you.

  • I need help with automator work flows

    im having troube adding songs to my itunes with autmator i ke getting error mesaage 1752 ...anyine know how i can resolve this issue ?

    viguy_ wrote:
    i was told the error means that the process is taking too long to finish so it just times out
    That would have been handy to know, earlier.
    I have know idea if this will work, but you might try editing the timeout of the action.
    If you right-click on the Action, you can choose "show in Finder"
    Make a copy of the action in your home somewhere. Right-click on that copy and select Show package contents.
    Go into the contents folder and open the info.plist file with a text editor like TextWrangler. Change the timeout value to something greater than the default of 3600 seconds. Is it really taking longer than an hour? If it is not, then I doubt this will work.
    Save the file, and then Import it into Automator (File menu).

  • Need Help with File System

    Hi,
    We are implementing HA NW2004s , the SCS is going to be in active-passive cluster.Suppose we have four system.
    Host A --SCS(active)/DB(active)
    Host B--SCS(inactive)/DB (acttive)
    Host C--CI
    Host D--- DI
    Please find the <a href="https://weblogs.sdn.sap.com/weblogs/images/251750294/SAP.JPG">Image</a> attached .Based on the above diagram i have following question .
    1) what all are the file systems.
    2) which of them are soft links.
    3) which all file system are on local or shared.
    Also can some one suggest the cluster solution which can be used to cluster SCS instance in SAP NW2004s JAVA.
    The CI and DI instance resuires the files availble in /sapmnt .In case the /sapmnt fails on Node A . how does the failure on NOde B takes care that /sapmnt content is available for CI and DI.
    Can anyone please provide me some solution to these questions.

    Hello,
    Here is the rough idea for HA from my experience.
    The important thing is that the binaries required to run SAP
    are to be accessible before and after switchover.
    In terms of this file system doesn't matter.
    But SAP may recommend certain filesystem on linux
    please refer to SAP installation guide.
    I always use reiserfs or ext3fs.
    For soft link I recommend you to refer SAP installation guide.
    In your configuration the files related to SCS and DB is the key.
    Again those files are to be accessible both from hostA and from hostB.
    Easiest way is to use share these files like NFS or other shared file system
    so that both nodes can access to these files.
    And let the clustering software do mount and unmount those directory.
    DB binaries, data and log are to be placed in shared storage subsystem.
    (ex. /oracle/*)
    SAP binaries, profiles and so on to be placed in shared storage as well.
    (ex. /sapmnt/*)
    You may want to place the binaries into local disk to make sure the binaries
    are always accessible on OS level, even in the connection to storage subsystem
    losts.
    In this case you have to sync the binaries on both nodes manually.
    Easiest way is just put on shared storage and mount them!
    Furthermore you can use sapcpe function to sync necessary binaries
    from /sapmnt to /usr/sap/<SID>.
    For your last question /sapmnt should be located in storage subsystem
    and not let the storage down!

  • I need help with changing my verizon vm to the system voicemail

    I need help with changing my verizon vm to the system voicemail

    Deleting the iTunes account is not the solution as you will very likely lose any and all purchases ever made with the account.
    If you cannot find the option on the site, contact iTunes support.

  • Need help with JTextArea and Scrolling

    import java.awt.*;
    import java.awt.event.*;
    import java.text.DecimalFormat;
    import javax.swing.*;
    public class MORT_RETRY extends JFrame implements ActionListener
    private JPanel keypad;
    private JPanel buttons;
    private JTextField lcdLoanAmt;
    private JTextField lcdInterestRate;
    private JTextField lcdTerm;
    private JTextField lcdMonthlyPmt;
    private JTextArea displayArea;
    private JButton CalculateBtn;
    private JButton ClrBtn;
    private JButton CloseBtn;
    private JButton Amortize;
    private JScrollPane scroll;
    private DecimalFormat calcPattern = new DecimalFormat("$###,###.00");
    private String[] rateTerm = {"", "7years @ 5.35%", "15years @ 5.5%", "30years @ 5.75%"};
    private JComboBox rateTermList;
    double interest[] = {5.35, 5.5, 5.75};
    int term[] = {7, 15, 30};
    double balance, interestAmt, monthlyInterest, monthlyPayment, monPmtInt, monPmtPrin;
    int termInMonths, month, termLoop, monthLoop;
    public MORT_RETRY()
    Container pane = getContentPane();
    lcdLoanAmt = new JTextField();
    lcdMonthlyPmt = new JTextField();
    displayArea = new JTextArea();//DEFINE COMBOBOX AND SCROLL
    rateTermList = new JComboBox(rateTerm);
    scroll = new JScrollPane(displayArea);
    scroll.setSize(600,170);
    scroll.setLocation(150,270);//DEFINE BUTTONS
    CalculateBtn = new JButton("Calculate");
    ClrBtn = new JButton("Clear Fields");
    CloseBtn = new JButton("Close");
    Amortize = new JButton("Amortize");//DEFINE PANEL(S)
    keypad = new JPanel();
    buttons = new JPanel();//DEFINE KEYPAD PANEL LAYOUT
    keypad.setLayout(new GridLayout( 4, 2, 5, 5));//SET CONTROLS ON KEYPAD PANEL
    keypad.add(new JLabel("Loan Amount$ : "));
    keypad.add(lcdLoanAmt);
    keypad.add(new JLabel("Term of loan and Interest Rate: "));
    keypad.add(rateTermList);
    keypad.add(new JLabel("Monthly Payment : "));
    keypad.add(lcdMonthlyPmt);
    lcdMonthlyPmt.setEditable(false);
    keypad.add(new JLabel("Amortize Table:"));
    keypad.add(displayArea);
    displayArea.setEditable(false);//DEFINE BUTTONS PANEL LAYOUT
    buttons.setLayout(new GridLayout( 1, 3, 5, 5));//SET CONTROLS ON BUTTONS PANEL
    buttons.add(CalculateBtn);
    buttons.add(Amortize);
    buttons.add(ClrBtn);
    buttons.add(CloseBtn);//ADD ACTION LISTENER
    CalculateBtn.addActionListener(this);
    ClrBtn.addActionListener(this);
    CloseBtn.addActionListener(this);
    Amortize.addActionListener(this);
    rateTermList.addActionListener(this);//ADD PANELS
    pane.add(keypad, BorderLayout.NORTH);
    pane.add(buttons, BorderLayout.SOUTH);
    pane.add(scroll, BorderLayout.CENTER);
    addWindowListener( new WindowAdapter()
    public void windowClosing(WindowEvent e)
    System.exit(0);
    public void actionPerformed(ActionEvent e)
    String arg = lcdLoanAmt.getText();
    int combined = Integer.parseInt(arg);
    if (e.getSource() == CalculateBtn)
    try
    JOptionPane.showMessageDialog(null, "Got try here", "Error", JOptionPane.ERROR_MESSAGE);
    catch(NumberFormatException ev)
    JOptionPane.showMessageDialog(null, "Got here", "Error", JOptionPane.ERROR_MESSAGE);
    if ((e.getSource() == CalculateBtn) && (arg != null))
    try{
    if ((e.getSource() == CalculateBtn) && (rateTermList.getSelectedIndex() == 1))
    monthlyInterest = interest[0] / (12 * 100);
    termInMonths = term[0] * 12;
    monthlyPayment = combined * (monthlyInterest / (1 - (Math.pow (1 + monthlyInterest,  -termInMonths))));
    lcdMonthlyPmt.setText(calcPattern.format(monthlyPayment));
    if ((e.getSource() == CalculateBtn) && (rateTermList.getSelectedIndex() == 2))
    monthlyInterest = interest[1] / (12 * 100);
    termInMonths = term[1] * 12;
    monthlyPayment = combined * (monthlyInterest / (1 - (Math.pow (1 + monthlyInterest,  -termInMonths))));
    lcdMonthlyPmt.setText(calcPattern.format(monthlyPayment));
    if ((e.getSource() == CalculateBtn) && (rateTermList.getSelectedIndex() == 3))
    monthlyInterest = interest[2] / (12 * 100);
    termInMonths = term[2] * 12;
    monthlyPayment = combined * (monthlyInterest / (1 - (Math.pow (1 + monthlyInterest,  -termInMonths))));
    lcdMonthlyPmt.setText(calcPattern.format(monthlyPayment));
    catch(NumberFormatException ev)
    JOptionPane.showMessageDialog(null, "Invalid Entry!\nPlease Try Again", "Error", JOptionPane.ERROR_MESSAGE);
    }                    //IF STATEMENTS FOR AMORTIZATION
    if ((e.getSource() == Amortize) && (rateTermList.getSelectedIndex() == 1))
    loopy(7, 5.35);
    if ((e.getSource() == Amortize) && (rateTermList.getSelectedIndex() == 2))
    loopy(15, 5.5);
    if ((e.getSource() == Amortize) && (rateTermList.getSelectedIndex() == 3))
    loopy(30, 5.75);
    if (e.getSource() == ClrBtn)
    rateTermList.setSelectedIndex(0);
    lcdLoanAmt.setText(null);
    lcdMonthlyPmt.setText(null);
    displayArea.setText(null);
    if (e.getSource() == CloseBtn)
    System.exit(0);
    private void loopy(int lTerm,double lInterest)
    double total, monthly, monthlyrate, monthint, monthprin, balance, lastint, paid;
    int amount, months, termloop, monthloop;
    String lcd2 = lcdLoanAmt.getText();
    amount = Integer.parseInt(lcd2);
    termloop = 1;
    paid = 0.00;
    monthlyrate = lInterest / (12 * 100);
    months = lTerm * 12;
    monthly = amount *(monthlyrate/(1-Math.pow(1+monthlyrate,-months)));
    total = months * monthly;
    balance = amount;
    while (termloop <= lTerm)
    displayArea.setCaretPosition(0);
    displayArea.append("\n");
    displayArea.append("Year " + termloop + " of " + lTerm + ": payments\n");
    displayArea.append("\n");
    displayArea.append("Month\tMonthly\tPrinciple\tInterest\tBalance\n");
    monthloop = 1;
    while (monthloop <= 12)
    monthint = balance * monthlyrate;
    monthprin = monthly - monthint;
    balance -= monthprin;
    paid += monthly;
    displayArea.setCaretPosition(0);
    displayArea.append(monthloop + "\t" + calcPattern.format(monthly) + "\t" + calcPattern.format(monthprin) + "\t");
    displayArea.append(calcPattern.format(monthint) + "\t" + calcPattern.format(balance) + "\n");
    monthloop ++;
    termloop ++;
    public static void main(String args[])
    MORT_RETRY f = new MORT_RETRY();
    f.setTitle("MORTGAGE PAYMENT CALCULATOR");
    f.setBounds(600, 600, 500, 500);
    f.setLocationRelativeTo(null);
    f.setVisible(true);
    }need help with displaying the textarea correctly and the scroll bar please.
    Message was edited by:
    new2this2020

    What's the problem you're having ???
    PS.

  • Need Help With File Matching Records

    I need help with my file matching program.
    Here is how it suppose to work: FileMatch class should contain methods to read oldmast.txt and trans.txt. When a match occurs (i.e., records with the same account number appear in both the master file and the transaction file), add the dollar amount in the transaction record to the current balance in the master record, and write the "newmast.txt" record. (Assume that purchases are indicated by positive amounts in the transaction file and payments by negative amounts.)
    When there is a master record for a particular account, but no corresponding transaction record, merely write the master record to "newmast.txt". When there is a transaction record, but no corresponding master record, print to a log file the message "Unmatched transaction record for account number ..." (fill in the account number from the transaction record). The log file should be a text file named "log.txt".
    Here is my following program code:
    // Exercise 14.8: CreateTextFile.java
    // creates a text file
    import java.io.FileNotFoundException;
    import java.lang.SecurityException;
    import java.util.Formatter;
    import java.util.FormatterClosedException;
    import java.util.NoSuchElementException;
    import java.util.Scanner;
    import org.egan.AccountRecord;
    import org.egan.TransactionRecord;
    public class CreateTextFile
      private Formatter output1;  // object used to output text to file
      private Formatter output2;  // object used to output text to file
      // enable user to open file
      public void openTransFile()
        try
          output1 = new Formatter("trans.txt");
        catch (SecurityException securityException)
          System.err.println("You do not have write access to this file.");
          System.exit(1);
        } // end catch
        catch (FileNotFoundException filesNotFoundException)
          System.err.println("Error creating file.");
          System.exit(1);
      } // end method openTransFile
      // enable user to open file
      public void openOldMastFile()
        try
          output2 = new Formatter("oldmast.txt");
        catch (SecurityException securityException)
          System.err.println("You do not have write access to this file.");
          System.exit(1);
        } // end catch
        catch (FileNotFoundException filesNotFoundException)
          System.err.println("Error creating file.");
          System.exit(1);
      } // end method openOldMastFile
      // add transaction records to file
      public void addTransactionRecords()
        // object to be written to file
        TransactionRecord record1 = new TransactionRecord();
        Scanner input1 = new Scanner(System.in);
        System.out.printf("%s\n%s\n%s\n%s\n\n",
          "To terminate input, type the end-of-file indicator",   
          "when you are prompted to enter input.",
          "On UNIX/Linux/Mac OS X type <ctrl> d then press Enter",
          "On Windows type <ctrl> z then press Enter");
        System.out.printf("%s\n%s",
           "Enter account number (> 0) and amount.","? ");
        while (input1.hasNext())  // loop until end-of-file indicator
          try // output values to file
            // retrieve data to be output
            record1.setAccount(input1.nextInt());    // read account number
            record1.setAmount(input1.nextDouble());  // read amount
            if (record1.getAccount() > 0)
              // write new record
              output1.format("%d %.2f\n", record1.getAccount(), record1.getAmount());
            } // end if
            else
              System.out.println("Account number must be greater than 0.");
            } // end else
          } // end try
          catch (FormatterClosedException formatterClosedException)
            System.err.println("Error writing to file.");
            return;
          } // end catch
          catch (NoSuchElementException elementException)
            System.err.println("Invalid input. Please try again.");
            input1.nextLine(); // discard input so user can try again
          } // end catch
          System.out.printf("%s %s\n%s", "Enter account number (> 0) ",
            "and amount.","? ");
        } // end while
      } // end method addTransactionRecords
      // add account records to file
      public void addAccountRecords()
        // object to be written to file
        AccountRecord record2 = new AccountRecord();
        Scanner input2 = new Scanner(System.in);
        System.out.printf("%s\n%s\n%s\n%s\n\n",
          "To terminate input, type the end-of-file indicator",   
          "when you are prompted to enter input.",
          "On UNIX/Linux/Mac OS X type <ctrl> d then press Enter",
          "On Windows type <ctrl> z then press Enter");
        System.out.printf("%s\n%s",
           "Enter account number (> 0), first name, last name and balance.","? ");
        while (input2.hasNext())  // loop until end-of-file indicator
          try // output values to file
            // retrieve data to be output
            record2.setAccount(input2.nextInt());    // read account number
            record2.setFirstName(input2.next());      // read first name
            record2.setLastName(input2.next());       // read last name
            record2.setBalance(input2.nextDouble());  // read balance
            if (record2.getAccount() > 0)
              // write new record
              output2.format("%d %s %s %.2f\n", record2.getAccount(), record2.getFirstName(),
                record2.getLastName(), record2.getBalance());
            } // end if
            else
              System.out.println("Account number must be greater than 0.");
            } // end else
          } // end try
          catch (FormatterClosedException formatterClosedException)
            System.err.println("Error writing to file.");
            return;
          } // end catch
          catch (NoSuchElementException elementException)
            System.err.println("Invalid input. Please try again.");
            input2.nextLine(); // discard input so user can try again
          } // end catch
          System.out.printf("%s %s\n%s", "Enter account number (> 0),",
            "first name, last name and balance.","? ");
        } // end while
      } // end method addAccountRecords
      // close file
      public void closeTransFile()
        if (output1 != null)
          output1.close();
      } // end method closeTransFile
      // close file
      public void closeOldMastFile()
        if (output2 != null)
          output2.close();
      } // end method closeOldMastFile
    } // end class CreateTextFile--------------------------------------------------------------------------------------------------
    // Exercise 14.8: CreateTextFileTest.java
    // Testing class CreateTextFile
    public class CreateTextFileTest
       // main method begins program execution
       public static void main( String args[] )
         CreateTextFile application = new CreateTextFile();
         application.openTransFile();
         application.addTransactionRecords();
         application.closeTransFile();
         application.openOldMastFile();
         application.addAccountRecords();
         application.closeOldMastFile();
       } // end main
    } // end class CreateTextFileTest-------------------------------------------------------------------------------------------------
    // Exercise 14.8: TransactionRecord.java
    // A class that represents on record of information
    package org.egan; // packaged for reuse
    public class TransactionRecord
      private int account;
      private double amount;
      // no-argument constructor calls other constructor with default values
      public TransactionRecord()
        this(0,0.0); // call two-argument constructor
      } // end no-argument AccountRecord constructor
      // initialize a record
      public TransactionRecord(int acct, double amt)
        setAccount(acct);
        setAmount(amt);
      } // end two-argument TransactionRecord constructor
      // set account number
      public void setAccount(int acct)
        account = acct;
      } // end method setAccount
      // get account number
      public int getAccount()
        return account;
      } // end method getAccount
      // set amount
      public void setAmount(double amt)
        amount = amt;
      } // end method setAmount
      // get amount
      public double getAmount()
        return amount;
      } // end method getAmount
    } // end class TransactionRecord -------------------------------------------------------------------------------------------------
    // Exercise 14.8: AccountRecord.java
    // A class that represents on record of information
    package org.egan; // packaged for reuse
    import org.egan.TransactionRecord;
    public class AccountRecord
      private int account;
      private String firstName;
      private String lastName;
      private double balance;
      // no-argument constructor calls other constructor with default values
      public AccountRecord()
        this(0,"","",0.0); // call four-argument constructor
      } // end no-argument AccountRecord constructor
      // initialize a record
      public AccountRecord(int acct, String first, String last, double bal)
        setAccount(acct);
        setFirstName(first);
        setLastName(last);
        setBalance(bal);
      } // end four-argument AccountRecord constructor
      // set account number
      public void setAccount(int acct)
        account = acct;
      } // end method setAccount
      // get account number
      public int getAccount()
        return account;
      } // end method getAccount
      // set first name
      public void setFirstName(String first)
        firstName = first;
      } // end method setFirstName
      // get first name
      public String getFirstName()
        return firstName;
      } // end method getFirstName
      // set last name
      public void setLastName(String last)
        lastName = last;
      } // end method setLastName
      // get last name
      public String getLastName()
        return lastName;
      } // end method getLastName
      // set balance
      public void setBalance(double bal)
        balance = bal;
      } // end method setBalance
      // get balance
      public double getBalance()
        return balance;
      } // end method getBalance
      // combine balance and amount
      public void combine(TransactionRecord record)
        balance = (getBalance() + record.getAmount()); 
      } // end method combine
    } // end class AccountRecord -------------------------------------------------------------------------------------------------
    // Exercise 14.8: FileMatch.java
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.lang.IllegalStateException;
    import java.util.NoSuchElementException;
    import java.util.Scanner;
    import java.util.Formatter;
    import java.util.FormatterClosedException;
    import org.egan.AccountRecord;
    import org.egan.TransactionRecord;
    public class FileMatch
      private Scanner inTransaction;
      private Scanner inOldMaster;
      private Formatter outNewMaster;
      private Formatter theLog;
      // enable user to open file
      public void openTransFile()
        try
          inTransaction = new Scanner(new File("trans.txt"));
        } // end try
        catch (FileNotFoundException fileNotFoundException)
          System.err.println("Error opening file.");
          System.exit(1);
        } // end catch
      } // end method openTransFile
      // enable user to open file
      public void openOldMastFile()
        try
          inOldMaster = new Scanner(new File("oldmast.txt"));
        } // end try
        catch (FileNotFoundException fileNotFoundException)
          System.err.println("Error opening file.");
          System.exit(1);
        } // end catch
      } // end method openOldMastFile
      // enable user to open file
      public void openNewMastFile()
        try
          outNewMaster = new Formatter("newmast.txt");
        catch (SecurityException securityException)
          System.err.println("You do not have write access to this file.");
          System.exit(1);
        } // end catch
        catch (FileNotFoundException filesNotFoundException)
          System.err.println("Error creating file.");
          System.exit(1);
      } // end method openNewMastFile
      // enable user to open file
      public void openLogFile()
        try
          theLog = new Formatter("log.txt");
        catch (SecurityException securityException)
          System.err.println("You do not have write access to this file.");
          System.exit(1);
        } // end catch
        catch (FileNotFoundException filesNotFoundException)
          System.err.println("Error creating file.");
          System.exit(1);
      } // end method openLogFile
      // update records
      public void updateRecords()
        TransactionRecord transaction = new TransactionRecord();
        AccountRecord account = new AccountRecord();
        try // read records from file using Scanner object
          System.out.println("Start file matching.");
          while (inTransaction.hasNext() && inOldMaster.hasNext())
            transaction.setAccount(inTransaction.nextInt());     // read account number
            transaction.setAmount(inTransaction.nextDouble());   // read amount
            account.setAccount(inOldMaster.nextInt());     // read account number
            account.setFirstName(inOldMaster.next());      // read first name 
            account.setLastName(inOldMaster.next());       // read last name
            account.setBalance(inOldMaster.nextDouble());  // read balance
            if (transaction.getAccount() == account.getAccount())
              while (inTransaction.hasNext() && transaction.getAccount() == account.getAccount())
                account.combine(transaction);
                outNewMaster.format("%d %s %s %.2f\n",
                account.getAccount(), account.getFirstName(), account.getLastName(),
                account.getBalance());
                transaction.setAccount(inTransaction.nextInt());     // read account number
                transaction.setAmount(inTransaction.nextDouble());   // read amount
            else if (transaction.getAccount() != account.getAccount())
              outNewMaster.format("%d %s %s %.2f\n",
              account.getAccount(), account.getFirstName(), account.getLastName(),
              account.getBalance());         
              theLog.format("%s%d","Unmatched transaction record for account number ",transaction.getAccount());
          } // end while
          System.out.println("Finish file matching.");
        } // end try
        catch (NoSuchElementException elementException)
          System.err.println("File improperly formed.");
          inTransaction.close();
          inOldMaster.close();
          System.exit(1);
        } // end catch
        catch (IllegalStateException stateException)
          System.err.println("Error reading from file.");
          System.exit(1);
        } // end catch   
      } // end method updateRecords
      // close file and terminate application
      public void closeTransFile()
        if (inTransaction != null)
          inTransaction.close();
      } // end method closeTransFile
      // close file and terminate application
      public void closeOldMastFile()
        if (inOldMaster != null)
          inOldMaster.close();
      } // end method closeOldMastFile
      // close file
      public void closeNewMastFile()
        if (outNewMaster != null)
          outNewMaster.close();
      } // end method closeNewMastFile
      // close file
      public void closeLogFile()
        if (theLog != null)
          theLog.close();
      } // end method closeLogFile
    } // end class FileMatch-------------------------------------------------------------------------------------------------
    // Exercise 14.8: FileMatchTest.java
    // Testing class FileMatch
    public class FileMatchTest
       // main method begins program execution
       public static void main( String args[] )
         FileMatch application = new FileMatch();
         application.openTransFile();
         application.openOldMastFile();
         application.openNewMastFile();
         application.openLogFile();
         application.updateRecords();
         application.closeLogFile();
         application.closeNewMastFile();
         application.closeOldMastFile();
         application.closeTransFile();
       } // end main
    } // end class FileMatchTest-------------------------------------------------------------------------------------------------
    Sample data for master file:
    Master file                         
    Account Number            Name                     Balance
    100                            Alan Jones                   348.17
    300                            Mary Smith                    27.19
    500                            Sam Sharp                   0.00
    700                            Suzy Green                   -14.22Sample data for transaction file:
    Transaction file                    Transaction
    Account Number                  Amount
    100                                         27.14
    300                                         62.11
    300                                         83.89
    400                                         100.56
    700                                         80.78
    700                                         1.53
    900                                         82.17  -------------------------------------------------------------------------------------------------
    My FileMatch class program above has bugs in it.
    The correct results for the newmast.txt:
    100  Alan  Jones  375.31
    300  Mary  Smith  173.19
    500  Sam  Sharp  0.00
    700  Suzy Green  68.09The correct results for the log.txt:
    Unmatched transaction record for account number 400Unmatched transaction record for account number 900------------------------------------------------------------------------------------------------
    My results for the newmast.txt:
    100 Alan Jones 375.31
    300 Mary Smith 111.08
    500 Sam Sharp 0.00
    700 Suzy Green -12.69My results for the log.txt
    Unmatched transaction record for account number 700-------------------------------------------------------------------------------------------------
    I am not sure what is wrong with my code above to make my results different from the correct results.
    Much help is appreciated. Please help.

    From the output, it looks like one problem is just formatting -- apparently you're including a newline in log entries and not using tabs for the newmast output file.
    As to why the numbers are off -- just from glancing over it, it appears that the problem is when you add multiple transaction values. Since account.combine() is so simple, I suspect that you're either adding creating transaction objects incorrectly or not creating them when you should be.
    Create test input data that isolates a single case of this (e.g., just the Mary Smith case), and then running your program in a debugger or adding debugging code to the add/combine method, so you can see what's happening in detail.
    Also I'd recommend reconsidering your design. It's a red flag if a class has a name with "Create" in it. Classes represent bundles of independant state and transformations on that state, not things to do.

Maybe you are looking for

  • BI Portal is not displaying Dashboard while Executing from BI Dev System

    HI Friends, I have created Dashboard based on Bex Query using SAP Netweaver Connection and published it to BI Dev System. it was running good but past 3-4 days it is not working. When I am executing it from BI Dev its not showing the output in BI por

  • I download Firefox 4 via Safari and follow instructions and I get a message bar that says it failed to launch with a number 10661

    I have a G4 Mac OSX10.4.11. I've used Firefox for 4-5 years through TimeWarner Cable and updated as the updates appeared. When Firefox 4 appeared I updated and it did not launch. I tried to get it through Safari and the same happened in addition to a

  • Adobe DNG Converter failure

    I have used Adobe DNG Converter 8.6 for a few weeks (on Windows 7 Ultimate 64) without incident to batch convert my Canon RAW files to DNG.  However, now when I try to open the program it does not work.  The problem seems to be that the GUI interface

  • XSQL and logging

    Hi, I am using the XSQL servlet to get dynamic XML data from remote servers in one application. I would like to keep track of the request/reply information(error,timing,parameters...) in a log file that I could search through easily. Is there built i

  • Bootcamp assistant fails to launch

    Bootcamp assistant fails to launch. Tells me I need to update my firmware. But I have already upgraded the firmware! Trying to run the SMC firmware updater again does not let me proceed because... the mac is already updated! MacBook Pro 1.83 Ghz Mac