Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8349269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:56:32+00:00 2026-06-09T07:56:32+00:00

Im trying to check if an application is open via an AppleScript This is

  • 0

Im trying to check if an application is open via an AppleScript

This is the following code :

on run {input, parameters}

quit application "KeyboardViewer"


return input
end run

However I want it to check if KeyboardViewer is open in the first place, if it is then quit application, if not, then launch it. In a way, the code should toggle the application.

I am not familiar with coding for AppleScript (first timer here) so I would appreciate some insight.

Thanks

edit

I have been trying to work with it and this seems to work, is there a more efficient way ? I would like to see your inputs please

on run {input, parameters}

    if application "KeyboardViewer" is running then

        quit application "KeyboardViewer"

    else
        activate application "KeyboardViewer"

    end if

    return input
  end run

There is a small (less than 1s) delay when using this script. Is there a way to make it faster ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:56:34+00:00Added an answer on June 9, 2026 at 7:56 am

    This seems to work :

    on run {input, parameters}
    
        if application "KeyboardViewer" is running then
    
            quit application "KeyboardViewer"
    
        else
            activate application "KeyboardViewer"
    
        end if
    
        return input
      end run
    

    What I learned is that if application "APPLICATION NAME" is running checks if the application is open.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was trying to run my application and check for some output on the
I am trying to make an application using AppleScript which can remind to check
I'm trying the following: I want to open an existing PDF Document and check
I am trying to check the security of my MVC application. When I try
I'm trying to check what framework version a other .NET application is working with
I'm trying to use check unit testing framework for my C application. But I
I was trying out a simple JSF application, in which I need to check
I'm trying to check if a file exists. If I use this: NSData *data
I am trying to check the following and all throw an out of bounds
I'm trying to check a checkbox, i've tried doing the following :- $('#someId').attr('checked','checked'); $('#someId').attr('checked',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.