Jump to content

Chakshu

Member
  • Posts

    10
  • Joined

  • Last visited

Posts posted by Chakshu

  1. If you want to make this reliable, then you should not base this on time (again, because AppleScript does not understand milliseconds). More importantly, you should see if there is a way to interact with GLM directly rather than using Hotkeys that are setup.

     

    So, does GLM support AppleScript? If it provides AppleScript commands to set the volume, then you should definitely use those instead of trying to get the timing right with the delays because your results will be more accurate.

     

    I'm not sure that it does. The easiest way to tell would be to open Script Editor and then click File ->Open Dictionary. Then, if there is an entry for the GLM program, you'll see what commands are available. If that isn't there, then you can always try UI scripting (see this Stackoverflow answer: https://stackoverflow.com/questions/23847324/applescript-set-focus-to-a-slider-before-sending-key-presses-up-down).

     

    Otherwise, you can try the timing one, which should be the code above... mostly. But it doesn't look like AppleScript recognizes key down instructions for non-modifier keys (at least it doesn't seem to very well).

     

    So, the code might have to be more like

    tell application "System Events"
    	key down shift
    	key down command
    	repeat 125 times
    		keystroke (key code 123)
    	end repeat
    	key up shift
    	key up command
    end tell
    

    So that code will press the left arrow 125 times while holding shift and command down.

    Wow, thank you Shawn!

     

    I'm going to test this first time tomorrow on my day off :)

  2. What are you actually trying to do? What program are you trying to interact with?

     

    To do exactly what you want, then you do something like:

    tell application "System Events"
    	--- this is where you put the key down commands
    	delay 0.025
    	--- this is where you put the key up commands
    end tell
    

    However --- let me rephrase that: HOWEVER, AppleScript's delay command isn't very accurate as it was designed for seconds and not milliseconds, so you're likely not going to get the results that you want.

    Thank you Shawn!

     

    I have an application called GLM that changes the volume for my Genelec active digital speakers. It is a completely digital system (No D/A) with the sound running over AES protocol via XLR cables and the volume commands is send to each speaker via CAT5. This means that I can no longer change the volume for my mac using the OS volume control (it is greyed out). I can only change the volume of the sound played on my mac with this hotkey (CMD+SHIFT+Left/rightArrow that tells the GLM software to send a signal via CAT5 to the speakers.

     

    The only problem is that if the keyboard shortcut is activated for to long the sound from the speakers will eventually reach 100db and if it is pressed for to short of a time the volume will change hardly at all. It works great with the keyboard (even over VNC) but som remotes can't send the shortcut enough times per second or sometimes it cannot keep sending it for the time it needs to send it. It works pretty good with HippoRemote but that app haven't been updated for over two years and is slowly falling apart when OS X is updated.

     

    I can set the volume cmd timer in GLM to 10-50 ms but I prefer it at 50 because it works best when using the keyboard. If I put it to 10ms the volume gets really loud really fast which can enjoy the neighbors if a friend is messing around with my sound not knowing how it works

     

    So if I understand correctly the command we could try would look like this? (replacing CMD etc. with the real codes for those keys)

     

    tell application "System Events"

     to key code "CMD+SHIFT+125"

        delay 0.025

      to key code "CMD+SHIFT+125"

    end tell

     

    Then I would have to experiment (with no sound on, hehe) to find the sweet spot for milliseconds. 

     

    A feature request to Alfred Remote would be to be able to send keystrokes that keeps being send while you have your tump pressed on the button on Alfred remote.

     

    So that's it... I know it sounds like a bit of a hazel but it the sound is good :).

  3. I need help with a script that is a little bit to advanced for me...

     

    I need to send the command "CMD+SHIFT+LeftArrow" and hold it down for 25ms but Not longer. 

     

    This is what I use to control the volume on my GLM audio system. (it has a 20ms minimum for safety)

     

    I tried to write it myself but it was to complicated for me? Could anyone help me out? ;/

     

    Thanks a lot!

    /M

  4. Oh, Haha. Thank you dfay! ...But I just now finished my Plex remote using scripts... But now I know how scripts works so I got that going for me. I will try that out next time dfay. Alfred remote is great! Thanks a lot - I'm of to watching my tv series being the reason I needed help in the first place.

     

    But would Clipboard work for sending a command like ESQ or ENTER?

  5. Okey, I might be out of league here and I probably didn't understand what you meant.

     

    I googled a little bit and for volume up I got this to work:

     

    tell application "System Events" to key code "103"

     

     

    Remember to set the script in Alfred to osascript (whatever that is)

     

     

    Anyhow as a total beginner it was really fun when I just got "downarrow to work" with this script:

     

    tell application "System Events" to key code "125"

     

     

    What a feeling. ;) I'm off building the rest of the remote now with The Google.

    ;)





    So "keystroke k" makes the system louder? Thanks a lot! :D

  6. First of all... Alfred Remote is awesome! It's potential huge and it is SO fun trying it out! I want to replace LOADS of iphone apps with this one eventually :)¨

     

    FEATURE REQEUSTS

     

    1.

    "Send keystrokes and key combinations¨

    Why? Because then I can build my own iphone remote and finally diss Hipporemote and also build in functionality via my mac to control PLEX, Philips Hue, Spotify etc.  (I will try to build it with scripts while waiting but I don't really have the skills needed so google will be my friend)

     

    2.

    Screen switching (mission control)

     

    3.

    (A bit over the top maybe) - In-air mouse control or trackpad

     

    Love,

    M

     

×
×
  • Create New...