How do I keep an application window hidden when not accessed?

I have an application running constantly to control my FW audio interface outputs etc. I use system events applescripts to control it's UI with a USB controller (PowerMate) - and that by necessity brings the application window to the front every time accessed. That's fine.
But I want to have a script that hides this application window when it's not used after 2 seconds. Maybe there is an "on idle" script that could run to check if that window is visible. I imagine something including lines like this:
-- a routine that checks if the window is visible every 2 seconds or so.
-- the window reference
window "Studio Monitor Express" of application process "Studio Monitor Express"
-- if it is, then hide it
-- for hiding the window/app
keystroke "h" using command down
-- if it's not, then ignore
I'm not sure whether to use system events or finder events etc. I have a bunch of other apps running obviously, but I just want this particular window to disappear when not needed.

I solved it. I know. Easy:
on idle
tell application "System Events"
set visible of process "Studio Monitor Express" to false
end tell
return 2
end idle

Similar Messages

  • Re: How do I keep an application from being started morethan once?

    Here are some quick ideas. None of them should be too hard to implement,
    although each has some drawbacks.
    1. Have a login server track who is logged on, and if there is already a
    logon for a given user or a given machine, then deny the application
    startup. The nice thing about this is that a user will not be able to have
    multiple logins even by going to another machine. Then again, this may not
    be so nice, and you also get a possible single point of failure on the
    login server for which you will have to prepare.
    2. Drop to the operating system, and get a list of processes for the client
    machine. If the name of one of them matches the name of application that
    is being run, then deny startup. This avoids a network hit, but requires
    some OS specific code. Also, a clever user could change the name of an
    executable to get around this. Note that a user could have another login
    on another machine.
    3. Write to a file on the local machine. You can hide the file in some
    suitable place, and can also scramble some information so that a user
    cannot get around having this file present by reading from the file at
    startup and then writing to it. Based on the state of your application,
    the file will have some scrambled information indicating if an instance of
    an application can be started. If you retain the write lock (i.e. do not
    close) the file for the duration of the application, you increase your
    security at the risk of a confused user if the application gets terminated
    without releasing the lock. Depending on the OS where the client will run,
    this could be an issue. If you like this option, perform some experiments
    first on all configurations of an example client machine to determine the
    behavior. Again, this only works to prevent an extra login on a single
    machine, not system wide.
    If you are not concerned about your users hacking around too much and don't
    care about a login on another machine, I would opt for some version of
    number 3. Otherwise, I would venture number 1.
    Regards
    CSB
    At 07:47 AM 2/18/98 -0500, Martin G Nystrom wrote:
    A user can launch an application, then launch it again. How do we make it so
    that the user can only run one instance of the application?
    Martin Nystrom
    Eli Lilly and Company
    ([email protected])
    Curtis Bragdon, Senior Consultant, Forte Software
    [email protected]
    Voice Mail: (510) 986-3807
    Paging: (888) 687-6723
    "I've seen dozens of triggering towns." - Richard Hugo

    Yet another quick and dirty solution is to use local ExternalConnections.
    This is a single instance per machine solution.
    Example is attached.
    (See attached file: TestOne.pex)
    [email protected] on 02/18/98 10:01:07 PM
    Please respond to [email protected]
    To: [email protected]
    cc: [email protected]
    Subject: Re: How do I keep an application from being started more than
    once?
    Martin,
    there are two ways to read your question
    (a) no more than one instance of an application per machine
    (b) no more than one instance of an application per "user"
    now if a user has only one machine, and your system has "userids" and you
    only want
    one active "session" per "user" then the distinction is irrelevant.
    However, many systems
    let people share logins, so a token based thing enforcing one login will be
    problematic.
    The downside of #1 approach suggested by Curtis happens when a machine gets
    hosed without "logging" the user off the security system, then they can't
    get in until their ticket expires or a sysadmin gets involved. Should be
    manageable, however. But this enforces one application
    instance per user, unless you check both for the presence of an active
    token for that user as well as the presence of a token tied to that
    particular node name. Otherwise there is nothing to prevent the same user
    from launching the app again and logging in as a different user. This is
    definitely the best approach of the bunch, and can be adapted for either
    (a) or (b).
    Suggestion # 2 won't work unless the application is built as a compiled
    client,
    since the process name will be 'ftexec' and not the "name" of the
    application. And it doesn't
    prevent a user from launching the app from a different machine (or people
    sharing logins). So again it depends on what you are trying to achieve.
    #3 also only prevents multiple instances per machine, not necessarily by
    user. Of course
    most people don't have multiple machines. The point is that you may be
    trying to
    prevent your users from sharing logins. In which case the file thing won't
    do it.
    Some other ideas:
    1. You could, however, enforce one application per machine using the
    installed partition agent's ExecutingPartition instrument name. As long as
    the user doesn't run the app in a different environment, you can have the
    app check at startup time if there is another
    ActivePartition running under the same InstalledPartition name.
    (ActivePartitions are child agents
    of InstalledPartitions).
    2. use the ObjectLocationManager and bind a simple object into the naming
    system using a naming scheme such as
    /MyApplication/MyNode or
    /MyApplication/MyUserId
    the presence of either one would indicate that another instance of that
    application is running on either that machine or that user. Of course
    these have to be cleaned out, and subject to similar downside as
    alternative #1. So you'd essentially be using the forte naming system as a
    distributed lock manager (ouch).
    3. Have the application remove the shortcut to launch it upon startup, and
    recreate it when it is finished, or move it to a hidden place. There it
    is - the worst idea I've ever come up with. Don't
    do this!
    Regards,
    John
    From: Curtis Bragdon <[email protected]>
    Date: Wed, 18 Feb 1998 16:36:58 -0500
    Subject: Re: How do I keep an application from being started more than
    once?
    Here are some quick ideas. None of them should be too hard to implement,
    although each has some drawbacks.
    1. Have a login server track who is logged on, and if there is already a
    logon for a given user or a given machine, then deny the application
    startup. The nice thing about this is that a user will not be able to have
    multiple logins even by going to another machine. Then again, this may not
    be so nice, and you also get a possible single point of failure on the
    login server for which you will have to prepare.
    2. Drop to the operating system, and get a list of processes for the client
    machine. If the name of one of them matches the name of application that
    is being run, then deny startup. This avoids a network hit, but requires
    some OS specific code. Also, a clever user could change the name of an
    executable to get around this. Note that a user could have another login
    on another machine.
    3. Write to a file on the local machine. You can hide the file in some
    suitable place, and can also scramble some information so that a user
    cannot get around having this file present by reading from the file at
    startup and then writing to it. Based on the state of your application,
    the file will have some scrambled information indicating if an instance of
    an application can be started. If you retain the write lock (i.e. do not
    close) the file for the duration of the application, you increase your
    security at the risk of a confused user if the application gets terminated
    without releasing the lock. Depending on the OS where the client will run,
    this could be an issue. If you like this option, perform some experiments
    first on all configurations of an example client machine to determine the
    behavior. Again, this only works to prevent an extra login on a single
    machine, not system wide.
    If you are not concerned about your users hacking around too much and don't
    care about a login on another machine, I would opt for some version of
    number 3. Otherwise, I would venture number 1.
    Regards
    CSB
    At 07:47 AM 2/18/98 -0500, Martin G Nystrom wrote:
    A user can launch an application, then launch it again. How do we make itso
    that the user can only run one instance of the application?
    Martin Nystrom
    Eli Lilly and Company
    ([email protected])
    Curtis Bragdon, Senior Consultant, Forte Software
    [email protected]
    Voice Mail: (510) 986-3807
    Paging: (888) 687-6723
    "I've seen dozens of triggering towns." - Richard Hugo
    John Jamison
    Vice President of Technology
    Sage IT Partners, Inc.
    415 392 7243 x 306
    [email protected]

  • Hello everyone. I have my itunes account for some years, and i've purchased far too many apps and music. Now the company i work for, has to change my account in the iphone, in order to use the corporate mails and calendar. How can i keep my applications?

    Hello everyone. I have my itunes account for some years, and i've purchased far too many apps and music. Now the company i work for, has to change my account in the iphone, in order to use the corporate mails and calendar. How can i keep my applications and music?

    Read here:
    http://support.apple.com/kb/ht5621
    Changing your Apple ID to your current, working email address will not create another Apple ID, it will only change it to your working email address.

  • How do I keep all the windows on my MacBook  open at the same time?

    How do I keep all the windows on my MacBook  open at the same time?

    They are always open until you close or minimize them.  They may be behind other windows, but if you haven't physically closed them, then they are still open.

  • How can i keep the indesign window to stay a certain size?

    How can i keep the indesign window to stay a certain size? After writing files the Indesign window defaults to original size and I need it to stay a certain size. Can anyone help?
    Thank you
    Ray Jimenez

    Hi, the only possibility I can see is making multiple copies of...
    /System/Library/Components/KeyboardViewer.component/Contents/SharedSupport/Keybo ardViewerServer.app
    And running one in each Space.

  • How can I keep the browser window stretched across my two displays?

    I run am trying to run dual monitor setup and have the Firefox browser span the two monitors. Whenever a Firefox dialog opens, such as Preferences or Print, the window zooms to fit the one primary monitor. How can I keep the browser window stretched across my two displays?

    Thanks very much for your response to my question -very helpful.
    Do you have any recommendations for a good book on Edge Animate?
    Thanks,
    Shaun
    Date: Thu, 25 Oct 2012 17:10:43 -0600
    From: [email protected]
    To: [email protected]
    Subject: How can I change the browser window background color when playing an Edge animation?
        Re: How can I change the browser window background color when playing an Edge animation?
        created by heathrowe in Edge Animate - View the full discussion
    ADD this to compositionReady handler, change the hex color code to your desired color //Force body of webpage to a specific color$("body").css("background-color","#5d5e61"); Darrell
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/4801409#4801409
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4801409#4801409
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4801409#4801409. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Edge Animate by email or at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • How do I keep the source document open when linking to a target document using the destination option in Adobe X?

    How do I keep the source document open when linking to a target document using the destination option in Adobe X? Have several links to create in the source document and want to keep the source document and target document open at the same time.

    Go to Edit - Preferences - Documents and un-tick "Open cross-document links
    in the same window".

  • How to save the credentials in windows security when opening a report?

    How to save the credentials in windows security when opening a report?
    in Silverlight program, user click a link to SQL server report services link, it pops up a new IE window and ask for windows security.
    Type the user name password in and check save password. reports showed and close IE. user click again, the same windows security popup dialog showed up. how to really remember the credentials?
    If keep the IE open, reports shows in second tab of the same IE window for the second click, and it didn't ask for the windows security.

    Hi Lascorpion,
    According to your description, users need to type username and password before they can open the SSRS report when reopening IE, right? If I have anything misunderstood, please point it out.
    Base on my research, this issue offten occurs on IE9 which ships with Windows 7 operating systems. In this case, to avoid this issue we can add the report URL to the trust site, for the detail information, please refer to the link below.
    SSRS Prompt for username and password in IE
    Regards,
    Charlie Liao
    TechNet Community Support

  • How do I set the default window size when I open a Numbers 3.0 document

    How do I set the default window size when I open a Numbers 3.0 document?
    When I open an existing document it always open too small, I resize it but next time I open it it's small again! Please help! I used to be able to resize them then they stayed that size until I resized it no matter how many times I opened and closed it before upgrading to 3.0!!!!

    This document can help you set the print settings for any type of printing. Not just for photos as the title suggests. You should not have to keep setting it every time.
    Printer settings
    007OHMSS
    I was a support engineer for HP.
    If the advice resolved the situation, please mark it as a solution. Thank you.

  • I had to re-download itunes for my computer, how do I keep the songs that I did not buy from itunes?

    I had redownload itunes because I had to get a new harddrive for my computer. Some of the songs from my ipod are not purchased from itunes. They are from cds and songs I have downloaded from the computer. How do I keep those from being erased when I sync my ipod onto itunes?

    Ideally you should restore your library from a recent backup - hard drives fail, usually without warning, so you should always maintain a backup of all data that you value.  Otherwise, see turingtest2's user tip on Recover your iTunes library from your iPod or iOS device.

  • How to restrict users working on Windows 7 clients from accessing Windows Explorer and other systems in the network through Group Policy with a domain controller running on Windows Server 2008 r2

    Dear All,
    We are having an infrastructure setup of around 500 client computers managed through group policy.
    Recently the domain controllers have been migrated from Windows Server 2003 to Server 2008 R2.
    Since this account requires extremely strict environment, we need to figure the solution for restricting the users from access anything locally.
    It would be great if you can assist me with the following query.
    How to restrict users logged on Windows 7 clients from accessing Windows Explorer and browsing other systems in the network through Group Policy with a domain controller running on Windows Server 2008 r2 ?
    Can we disable Network Tab on the left hand pane ?
    explorer.exe is blocked already, but users are able to enter the Windows Explorer by clicking on the name which is visible on the Start Menu.

    >   * explorer.exe is blocked already, but users are able to enter the
    >     Windows Explorer by clicking on the name which is visible on the
    >     Start Menu.
    You cannot block explorer.exe when you do not replace the shell - the
    desktop you see effectively IS explorer.exe...
    Your requirement sounds like you need a custom shell:
    http://gpsearch.azurewebsites.net/#2812
    Martin
    Mal ein
    GUTES Buch über GPOs lesen?
    NO THEY ARE NOT EVIL, if you know what you are doing:
    Good or bad GPOs?
    And if IT bothers me - coke bottle design refreshment :))

  • How do I keep McAfee from being downloaded when I update Acrobat?

    How do I keep McAfee from being downloaded when I update Acrobat?  I'm being spamed by Acrobat!

    If you are talking about this proble, the answer is in the thread:
    http://forums.adobe.com/thread/1065811?tstart=120

  • How do I keep my music from stopping when my ipad autolocks?

    How do I keep my music from stopping when I close my ipad or it autolocks?

    My wife has the same problem. I believe I found the solution. Activate "do not disturb" in settings - do not disturb - manual. Make sure to also go to allow calls from and set it to no one. A moon will appear in the status bar. You will see notifications of missed calls but it does not interrupt Pandora. Let me know if this works for you.

  • HT6012 imovie 9 had aspect ratio.  10 doesn't. How do I keep my movies at  4/3 not 16/9?

    imovie 9 had aspect ratio.  10 doesn't. How do I keep my movies at  4/3 not 16/9?

    You might have better luck in the iMovie community. I'll ask the hosts to relocate your discussion there.
    iMovie

  • How can I keep emails and read later when off line please

    How can I keep email to read later when off line please

    I'm not sure how it works on your iPad, but once the email has been downloaded onto my iPad, I can read them even in Airplane mode with WiFi disabled. I don't see the images that are in the emails, but I can read the messages. I have one POP account and three IMAP accounts and it works for all four accounts.

Maybe you are looking for

  • Sales Order schedule line from CN to CP

    Hi, When i  update the sales order schedule line from CN to CP , the quantity is not showing in the MDO4. Can any one help me. Thanks in advance Suresh S

  • Scanning into iPhoto -where are files landing, and how to get copies?

    Maybe if I describe my current situation, I can better understand what a good way of maintaining the archive of photos I've kept for 13 years is in a cross-platform manner. I just scanned a photo, and chose to tell the scanning software to send it in

  • Business place and section code

    Hi SAP experts, With respect to India customization relating to section code and business place, i understand that business place is with respect to VAT regn and section code is with respect to TAN number held by a company. But do we need to create a

  • Adobe Flash Pro Volume License Install

    I have use various methods of including the volume license in the install of Adobe Flash Professional and none of these methods actually prevent the Validation screen from appearing on the first load of Adobe Flash Professional version 8. I have use

  • How do you send comma dilimited email via cfmail?

    Hi All, Can anyone help what I need to do is to send email via cfmail in a comma dilimited format.  Is there an easy way to do this? Best, Joy