idasen-controller-mac icon indicating copy to clipboard operation
idasen-controller-mac copied to clipboard

Apple script stand-up and sit-down do not work

Open akucharczyk opened this issue 3 years ago • 7 comments

I currently writing raycast extension which works with your application and gets the following issue.

Since the new version, the following two apple scripts do not work anymore. I did not get any error message when I run the script. You can check out my code in the following Mr https://github.com/raycast/extensions/pull/1964.

tell application "Desk Controller"
    move "to-sit" // or "to-stand"
end tell

akucharczyk avatar Jun 28 '22 10:06 akucharczyk

To add, specifying the height manually does work in AppleScript.

tell application "Desk Controller"
    move to "125cm"
end tell

diotav avatar Jul 06 '22 13:07 diotav

looks like it's simple copy-paste mistake. both command codes in deskcontroller.sdef are the same.

JulianWielga avatar Sep 19 '22 15:09 JulianWielga

Same for me. I'm running the script in Script Editor and setting the height works, but setting "to-stand" (or "to-sit") doesn't. No errors, no messages.

I'm in the latest Ventura release.

Let me know if I can do anything for debugging.

alvarogonzalez-packlink avatar Jan 25 '23 13:01 alvarogonzalez-packlink

@alvarogonzalez-packlink I fixed it in my forked branch and added Notification. There is currently no signed or build version uploaded, so you need this to build by your own on your local system.

akucharczyk avatar Jan 25 '23 13:01 akucharczyk

I wrote a bash script for this which works for me and I thought I'd share if anyone wanted something like it;

#!/bin/bash

ACTION=$1
HEIGHT=$2

# preset heights
SIT="80cm"
STAND="110cm"

# height check values
MAX_HEIGHT=115
MIN_HEIGHT=75

# colours
NOCOLOUR='\033[0m'
RED='\033[0;31m'
ORANGE='\033[0;33m'

warning() {
    echo -e "${RED}$1${NOCOLOUR}"
}

hint() {
    echo -e "${ORANGE}$1${NOCOLOUR}"
}

desk_move() {
    osascript <<EOD
    tell application "Desk Controller"
        move to "$1"
    end tell
EOD
}

height_check() {
    if [ -z $HEIGHT ]; then
        warning "ERROR!"
        echo "Height not supplied"
        exit
    elif (($HEIGHT > $MAX_HEIGHT)); then
        warning "ERROR!"
        echo "Height $HEIGHT is too high"
        exit
    elif (($HEIGHT < $MIN_HEIGHT)); then
        warning "ERROR!"
        echo "Height $HEIGHT is too low"
        exit
    fi
}

if [ "$ACTION" == "sit" ] || [ "$ACTION" == "stand" ]; then
    if [ "$ACTION" == "sit" ]; then VALUE=$SIT; else VALUE=$STAND; fi
    echo "Moving Desk to $ACTION - $VALUE"
    desk_move $VALUE
elif [ "$ACTION" == "height" ]; then
    height_check $HEIGHT
    echo "Moving Desk to height - $HEIGHT"
    desk_move "${HEIGHT}cm"
else
    warning "Missing action"
    hint "Available actions:"
    echo "desk sit"
    echo "desk stand"
    echo "desk height <NUMBER>"
fi

gmhabchi avatar Feb 20 '23 01:02 gmhabchi

To add, specifying the height manually does work in AppleScript.

tell application "Desk Controller"
    move to "125cm"
end tell

Thanks this is good workaround

user928 avatar Mar 29 '23 09:03 user928

This used to work on my previous Mac but strangely it no longer works. Interestingly Script Editor automatically changes move "to-sit" to move to "to-sit"

tell application "Desk Controller"
	move to "to-sit"
end tell

patrickrushton avatar Feb 22 '24 15:02 patrickrushton