Skip to main content
added 5 characters in body
Source Link
user956609
  • 405
  • 2
  • 5
  • 12
res=$(osascript -e 'tell"tell application "System\"System Events"Events\" to get name of application processes whose frontmost is true and visible is true'true");
if [ $res == "Kim" ]
then
    osascript -e 'tell"tell application "System\"System Events"Events\" to set visible of process "Kim"\"Kim\" to false'"false"
else
    open -a 'Kim.app'
fi

I did it like this, it works but excutes very slow, how to optimize this?

res=$(osascript -e 'tell application "System Events" to get name of application processes whose frontmost is true and visible is true');
if [ $res == "Kim" ]
then
    osascript -e 'tell application "System Events" to set visible of process "Kim" to false'"
else
    open -a 'Kim.app'
fi

I did it like this, it works but excutes very slow, how to optimize this?

res=$(osascript -e "tell application \"System Events\" to get name of application processes whose frontmost is true and visible is true");
if [ $res == "Kim" ]
then
    osascript -e "tell application \"System Events\" to set visible of process \"Kim\" to false"
else
    open -a 'Kim.app'
fi

I did it like this, it works but excutes very slow, how to optimize this?

deleted 50 characters in body
Source Link
nohillside
  • 104.5k
  • 42
  • 222
  • 275
mycommand="osascriptres=$(osascript -e 'tell application \"System"System Events\"Events" to get name of application processes whose frontmost is true and visible is true'";
res=$(eval $mycommandtrue');
if [ $res == "Kim" ]
then
    eval "osascriptosascript -e 'tell application \"System"System Events\"Events" to set visible of process \"Kim\""Kim" to false'" 
else
    eval "openopen -a 'Kim.app'"app'
fi

I did it like this, it works but excutes very slow, how to optimize this?

mycommand="osascript -e 'tell application \"System Events\" to get name of application processes whose frontmost is true and visible is true'";
res=$(eval $mycommand);
if [ $res == "Kim" ]
then
    eval "osascript -e 'tell application \"System Events\" to set visible of process \"Kim\" to false'" 
else
    eval "open -a 'Kim.app'"
fi

I did it like this, it works but excutes very slow, how to optimize this?

res=$(osascript -e 'tell application "System Events" to get name of application processes whose frontmost is true and visible is true');
if [ $res == "Kim" ]
then
    osascript -e 'tell application "System Events" to set visible of process "Kim" to false'"
else
    open -a 'Kim.app'
fi

I did it like this, it works but excutes very slow, how to optimize this?

[Edit removed during grace period]
Source Link
user956609
  • 405
  • 2
  • 5
  • 12
added 7 characters in body
Source Link
anki
  • 11.9k
  • 7
  • 35
  • 71
Loading
Source Link
user956609
  • 405
  • 2
  • 5
  • 12
Loading