Jump to content
Welcome to InsanelyMac Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.


Activate and hide window - help, algorithm provided

1 post in this topic

Recommended Posts

Hi all


I've been trying to solve a problem.


I'm trying to write an Applescript that does the following, I have spent numerous hours trying to get it work but still not going anywhere near. The algorithm is actually simple, as below:


if (window whose title contains text "[my google email address]") does not exist


          create a new Chrome window with address "https://mail.google.com/mail/u/0"

          put the window in presentation mode


          if (window whose title contains text "[my google email address]") exists but does not have focus, or hidden

          then bring focus to the window

          else hide the window

          end if

end if



Could any one help to suggest what code would work? Thanks heaps

MacBook Air, OS X Mavericks (10.9.1)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Trung_Nguyen
      Hello everyone,
      I am trying make the fix keyboard backlight on Dell Latitude E6230. It currently works but the macOS not recognized it. There is a keyboard shortcut which had 6 states of bright. I'm using IOWMIFamily to use the display brightness shortcut(Fn Up/Down) Is there a way to make the Ultimate keyboard backlight slider like in Debian?

      P/s: By the way, what is the ADB codes for VidMirror? I want to remap it because it controlled by PS2 and currently map to cmd+P(print) Thanks again
    • By ClassicMacMan
      First, system specs:
      Abit IP35 Pro MB
      Core2Quad Q6600 CPU
      Geforce 8400GS 256MB GPU
      Corsair Dominator 4GB DDR 1066 RAM (4x1GB sticks)
      320GB WD Blue Hard Drive
      MacAlly Keyboard
      MacAlly Mouse
      Initially followed the install process from (the site that shall not be named) to get Snow Leopard installed, then used another tool from same site to upgrade to El Capitan. In the process, boot manager was changed from Chameleon to Clover.

      When Clover gets past init(6), the boot process halts and the num lock/power lights start blinking on my USB keyboard. Unplugging said keyboard allows Clover to complete boot. Luckily, I still have a PS2 keyboard which works with Clover (it now stays plugged in at the same time as the USB keyboard). When I had Snow Leopard installed, it didn't do this, so I'm assuming it's a Clover problem.

      I've tried:
      - Plugging keyboard into all USB ports (both with and without the PS2 keyboard plugged in)
      - Changing BIOS Keyboard settings to both "OS" and "BIOS".
      - Updating Clover to latest version and installing UsbKbDxe-64 driver.

      I tried searching for a DSDT, but only found one for the non-Pro IP35.

      Other Google searching has fixes for UEFI booting systems and different MacOS versions, but nothing that applies to this MB.


    • By soumaxetuirk
      Many People gets confuse due to their wrong keyboard hotkeys or completely disabled hotkeys while using VoodooPS2Controller.kext. today I am writing a little guide for newbies to Enable Possible Every disabled Hotkeys on laptop with their personalised shortcuts.
      Common Issues Can be Solved Using this guide:
      Media Hotkeys not working Brightness Hotkeys not working Wrong keyboard entries Completely dead keys Bringing Every Windows hotkeys to Mac  Basics:
      While our laptop keyboards use PS2 Methods for input in windows, Mac Uses ADB Codes for Its Keyboard.VoodooPS2Controller convert those PS2 codes to Mac compatible ADB Codes. All the PS2 Scan codes for universal keys like ( A-z, 1-0, !-+) are same for almost every laptops but OEM Hotkeys are different. All laptop has Different Functional keys.So hot keys usually don't work properly without proper edits.
      To Solve this issue First find the codes for your system then remap them to specific Mac ADB codes to do the same exact output in system.
      (Note : I learned about all these things from different people and different posts, I will try to link Original Posts.)
      !!Huge Thanks to RehabMan & All VoodooPS2Controller tester and developer!!
      1.Check your Functional keys
      First of all you need to check wether your functional keys transmits PS2 or EC scan codes. Install latest version VoodooPS2 kext debug version, and watch your console while pressing keys. A. PS2 Scan Codes
      If It is a PS2 Scancode then you will get some report as like this. (moniter Using ApplePS2 in search box and "NOW" option activated.)
      ApplePS2.. : Sending e022=69 down ApplePS2.. : Sending e022=69 up The first value is your PS2 Scan codes and the value after equal to is the ADB code injected to system. If nothing happens then it might be a EC Query. VooDooPS2 Github Link B. EC Queries
      Install ACPI Debug kext: https://github.com/R...OS-X-ACPI-Debug Open MaciASL and click on patch.(Add rehab man repo) Apply "Add DSDT Debug Methods" and "Instrument EC Queries" Patch Save the DSDT and restart Now go to console and search for "ACPIDebug" and press those keys ACPI Debug Github Link You will get some result like this ACPIDebug : EC _Q12 2.Get your new Keys
      A.Direct ADB
      Some hotkeys like play/pause, scan next track,Brightness,Lunchpad are exist in real Mac so you can find there ADB codes directly. You can remap your hotkeys directly to those ADB Codes. Some ADB Codes Play/Pause : 34 Next Track : 42 Prev.Track : 4d Others ADB codes can be found in this page. You can check those ADB Codes you can easily. Convert the ADB codes to Decimal from hexadecial. While VOODooPS2 Debug version is installed,Hold the right alt and press the decimal value then leave the alt key and you can see the Executed ADB code.( For e.g. ADB code for next track is 34 so in decimal it will be 66. So press alt then type 66 and release the alt.your track will be changed in your music player) B. Extra Function Key
      Some Hot keys like Lock windows,Print Screen,HP/Dell Support key, print, Multi monster setup are not present in Mac. In that Case you need to Assign those hotkeys to function keys like (f15, f16,f17...f20). After that in Mac Keyboard shortcut preference you can set them for various commands  (Note: take help of Automator to create more personalised shortcuts)
      ADB Codes for function Keys f16=6a f17=40 f18=4f f19=50 f20=5a  
      3.Remap Keys 
      A. PS2 Codes
      Go to your latest VoodooPS2 kext. Detailed specification on Github Page. Open " VoodooPS2Controller.kext/Contents/PlugIns/VoodooPS2Keyboard.kext/Contents/info.plist" with Xcode or Plist Editor. Go to Custom PS2 to ADB Map Section Information Property List >> IOKitPersonalities >> ApplePS2Keyboard >> Platform Profile >> Default >> Custom ADB Map  enter your PS2 Scancodes = ADB Value you want to use( In Hex)
      <key>Custom ADB Map</key>        <array>             <string>e022=34</string>             <string>e024=4f</string>         </array> B. EC Contolled Keys
      With Proper DSDT Edit you can Notify to PS2M for any EC Controlled Queries. Example for Brightness Fix (Original Post)
      into method label _Q11 replace_content begin // Brightness Down\n Notify(\_SB.PCI0.LPCB.PS2M, 0x0205)\n Notify(\_SB.PCI0.LPCB.PS2M, 0x0285)\n end; into method label _Q12 replace_content begin // Brightness Up\n Notify(\_SB.PCI0.LPCB.PS2M, 0x0206)\n Notify(\_SB.PCI0.LPCB.PS2M, 0x0286)\n end; Custom EC Queries Shortcuts  can be done by similar process.(Will Be updated Soon)
    • By Cyberdevs
      This is a little app that will help you to easily hide or show your desktop icons.
      Let's say you want to record a video of your desktop or you want to capture some screenshots of your desktop and you have a lot of files on your desktop already but you don't want to move them somewhere else, with this app you can easily make them invisible and once you're done you can make them visible again.
    • By gulios
      I;m trying to fix keyboard lights in that laptop.
      FN keys:
      FN: ACPIDebug: "EC _QD3 enter" ACPIDebug: "EC _QD3 exit" ACPIDebug: "EC _QD4 enter" ACPIDebug: "EC _QD4 exit" ---------------------------------------------------- ---------------------------------------------------- ---------------------------------------------------- FN+F1:  sleep/hibernate? ACPIDebug: "EC _Q0A enter" ACPIDebug: "EC _Q0A exit" ---------------------------------------------------- FN+F2: airplane mode ACPIDebug: "EC _Q0B enter" ACPIDebug: "EC _Q0B exit" ---------------------------------------------------- FN+F3: keyboard light down ACPIDebug: "EC _Q0C enter" ACPIDebug: "EC _Q0C exit" ---------------------------------------------------- FN+F4: keyboard light up ACPIDebug: "EC _Q0D enter" ACPIDebug: "EC _Q0D exit" ---------------------------------------------------- FN+F5: brightness down ACPIDebug: "EC _Q0E enter" ACPIDebug: "EC _Q0E exit" ---------------------------------------------------- FN+F6: brightness up ACPIDebug: "EC _Q0F enter" ACPIDebug: "EC _Q0F exit" ---------------------------------------------------- FN+F7: disable display ACPIDebug: "EC _Q10 enter" ACPIDebug: "EC _Q10 exit" ---------------------------------------------------- FN+F8: toggles displays ACPIDebug: "EC _Q11 enter" ---------------------------------------------------- FN+F9: enable/disable touchpad ACPIDebug: "EC _Q12 enter" ACPIDebug: "EC _Q12 exit" ---------------------------------------------------- FN+F10: No output - mute audio ---------------------------------------------------- FN+F11: No output - decrease audio ---------------------------------------------------- FN+F12: No output - increase audio ---------------------------------------------------- FN+A: toggles ALS Sensor on/off ACPIDebug: "EC _Q76 enter" ACPIDebug: "EC _Q76 exit" ---------------------------------------------------- FN+space: ACPIDebug: "EC _Q71 enter" ACPIDebug: "EC _Q71 exit" ----------------------------------------------------   so _Q0C and _Q0D are responsible for keyboard lights.
      when i pres FN+F3/4 i'm getting:
      default    20:06:22.148557 +0200    kernel    ACPIDebug: "EC _QD3 enter" default    20:06:22.148780 +0200    kernel    ACPIDebug: "EC _QD3 exit" default    20:06:22.481433 +0200    kernel    ACPIDebug: "EC _Q0C enter" default    20:06:22.481644 +0200    kernel    ACPIDebug: "EC _Q0C exit" default    20:06:22.481902 +0200    kernel    ACPI Exception: AE_AML_BUFFER_LIMIT, default    20:06:22.481926 +0200    kernel    Index (0x00000000B) is beyond end of object (length 0x4) default    20:06:22.481932 +0200    kernel     (20160930/exoparg2-531) default    20:06:22.481935 +0200    kernel     (20160930/exoparg2-531) default    20:06:22.481943 +0200    kernel    [SKBL] @0006D #0088: default    20:06:22.481946 +0200    kernel    [SKBL] @0006D #0088: default    20:06:22.481951 +0200    kernel    P default    20:06:22.481952 +0200    kernel    P default    20:06:22.481955 +0200    kernel    W default    20:06:22.481956 +0200    kernel    W default    20:06:22.481958 +0200    kernel    K default    20:06:22.481959 +0200    kernel    K default    20:06:22.481961 +0200    kernel    B default    20:06:22.481962 +0200    kernel    B default    20:06:22.481966 +0200    kernel     [ default    20:06:22.481967 +0200    kernel     [ default    20:06:22.481970 +0200    kernel    Local0 default    20:06:22.481972 +0200    kernel    Local0 default    20:06:22.481974 +0200    kernel    ] default    20:06:22.481976 +0200    kernel    ] default    20:06:22.481978 +0200    kernel   default    20:06:22.481980 +0200    kernel   default    20:06:22.481984 +0200    kernel   Initialized Local Variables for method [SKBL]: default    20:06:22.481986 +0200    kernel   Initialized Local Variables for method [SKBL]: default    20:06:22.481991 +0200    kernel       Local0: default    20:06:22.481993 +0200    kernel       Local0: default    20:06:22.481998 +0200    kernel    ffffff801e709000 default    20:06:22.482000 +0200    kernel    ffffff801e709000 default    20:06:22.482003 +0200    kernel    <Obj> default    20:06:22.482004 +0200    kernel    <Obj> default    20:06:22.482008 +0200    kernel     Integer default    20:06:22.482009 +0200    kernel     Integer default    20:06:22.482011 +0200    kernel     000000000000000B default    20:06:22.482014 +0200    kernel     000000000000000B default    20:06:22.482016 +0200    kernel   default    20:06:22.482018 +0200    kernel   default    20:06:22.482020 +0200    kernel   default    20:06:22.482021 +0200    kernel   default    20:06:22.482027 +0200    kernel    Initialized Arguments for Method [SKBL]:  (0 arguments defined for method invocation) default    20:06:22.482030 +0200    kernel    Initialized Arguments for Method [SKBL]:  (0 arguments defined for method invocation) default    20:06:22.482037 +0200    kernel       Arg0: default    20:06:22.482038 +0200    kernel       Arg0: default    20:06:22.482043 +0200    kernel    ffffff801ea950f0 default    20:06:22.482044 +0200    kernel    ffffff801ea950f0 default    20:06:22.482047 +0200    kernel    <Obj> default    20:06:22.482048 +0200    kernel    <Obj> default    20:06:22.482051 +0200    kernel     Integer default    20:06:22.482053 +0200    kernel     Integer default    20:06:22.482056 +0200    kernel     000000000000000B default    20:06:22.482058 +0200    kernel     000000000000000B default    20:06:22.482060 +0200    kernel   default    20:06:22.482061 +0200    kernel   default    20:06:22.482064 +0200    kernel   default    20:06:22.482065 +0200    kernel   default    20:06:22.482073 +0200    kernel    ACPI Error: default    20:06:22.482107 +0200    kernel    ACPI Error: default    20:06:22.482111 +0200    kernel    Method parse/execution failed default    20:06:22.482113 +0200    kernel    Method parse/execution failed default    20:06:22.482117 +0200    kernel    [\_SB.ATKD.SKBL] (Node ffffff801c8b2060) default    20:06:22.482120 +0200    kernel    [\_SB.ATKD.SKBL] (Node ffffff801c8b2060) default    20:06:22.482123 +0200    kernel    , AE_AML_BUFFER_LIMIT default    20:06:22.482125 +0200    kernel    , AE_AML_BUFFER_LIMIT default    20:06:22.482128 +0200    kernel     (20160930/psparse-632) default    20:06:22.482129 +0200    kernel     (20160930/psparse-632) default    20:06:22.688511 +0200    kernel    ACPIDebug: "EC _QD4 enter" default    20:06:22.688722 +0200    kernel    ACPIDebug: "EC _QD4 exit" It's 4 levels change lights
      Name (PWKB, Buffer (0x04)             {                  0x00, 0x55, 0xAA, 0xFF                                      }) I'm using AsusNBFnKeys.kext and  I've tried all 'Asus DSDT patches" without success.
      any ideas how to fix it?
      Thank you