diff --git a/scripts/list_devices.sh b/scripts/list_devices.sh index a716f9c..99f0b3e 100644 --- a/scripts/list_devices.sh +++ b/scripts/list_devices.sh @@ -7,4 +7,15 @@ export PATH=${PATH}:${ANDROID_SDK_HOME}/platform-tools # adb kill-server # adb start-server -adb devices | grep -w 'device' | cut -f1 | xargs -I X sh -c 'c=$(adb -s X shell getprop ro.product.manufacturer);m=$(adb -s X shell getprop ro.product.model);s=$(echo X);echo "$s ($c $m)"' +# Get device list with manufacturer and model info +device_list=$(adb devices | grep -w 'device' | cut -f1 | xargs -I X sh -c \ + 'c=$(adb -s X shell getprop ro.product.manufacturer); m=$(adb -s X shell getprop ro.product.model); s=$(echo X); echo "$s ($c $m)"') + +# Check if device_list is empty +if [ -z "$device_list" ]; then + # Show an Automator dialog for no devices found and exit + osascript -e 'display dialog "No devices found. Please connect an Android device and try again." buttons {"Exit"} default button "Exit"' >/dev/null 2>&1 +else + # Pass device list to the next step + echo "$device_list" +fi diff --git a/scripts/run_scrcpy.sh b/scripts/run_scrcpy.sh index 10b1a80..90a3613 100644 --- a/scripts/run_scrcpy.sh +++ b/scripts/run_scrcpy.sh @@ -3,7 +3,7 @@ export ANDROID_SDK_HOME=~/Library/Android/sdk export PATH=${PATH}:${ANDROID_SDK_HOME}/platform-tools # Path of scrcpy -export PATH=${PATH}:/usr/local/bin/ +export PATH=${PATH}:/usr/local/bin/:/opt/homebrew/bin/ if [[ "$1" == "false" ]] then diff --git a/scripts/select_device.applescript b/scripts/select_device.applescript index 850687f..d4b3fcd 100644 --- a/scripts/select_device.applescript +++ b/scripts/select_device.applescript @@ -1,4 +1,7 @@ on run {input, parameters} + if (count of input) is 0 then + return "false" + end if if (count of input) is 1 then return input end if @@ -8,6 +11,6 @@ on run {input, parameters} if answer is not false then return answer end if - + return "false" end run