Skip to main content
Reverted code due to discovered side-effect
Source Link
hepcat72
  • 1.3k
  • 3
  • 18
  • 40

I figured out a work-around for part of my problem. I'm not going to select this (my own) answer because it doesn't solve the entire problem. The main reason I use Fluid to wrap galaxy in an "app" is because you can only have 1 galaxy browser window open. If I have 2 open, changes made in 1 window affect the other, so when I'm working on 2 different projects concurrently, I was using separate Fluid apps to keep the projects from stepping on one another's toes. I knew that private browser windows could also accomplish this, but I liked the convenience of a dock icon.

So I just worked out an Applescript, saved as an app, that opens a new private Safari window to galaxy.princeton.edu. I then added that app to Security & Privacy -> Privacy -> Accessibility. This script is slightly simplified from what I actually used:

set isRunning to is_running("Safari")

if isRunning is false then
    tell application "Safari" to activate
    delay 2
end if

--Open http://galaxy.princeton.edu/ in a new private window
tell application "System Events" to 
 perform action "AXPress" ofkeystroke menu"n" itemusing "New{shift Privatedown, Window"command ofdown}
 menu "File" of menudelay bar0.5
 item "File" of menukeystroke bar"http://galaxy"
 1 of application processkey "Safari"
delaycode 0.547
tell application "Safari" to set URL of currentkeystroke tab"princeton"
 of front window tokey "http://galaxy.princeton.edu/"

oncode is_running(appName)47
    tell applicationkeystroke "System"edu/"
 Events" to (name of processes) containskeystroke appNamereturn
end is_runningtell

Note, depending on your accessibility preferences, Applescript will not type numbers, dots, or a few other characters, thus the key code 47 for the dots.

Now, whenever I run this "app" (which I gave the galaxy icon), it will open a new Safari browser window to galaxy.

This allows me to run my automator services on DNA strings in galaxy because Safari can be given permission to send apple events to System Events.app, whereas Fluid apps can't (I believe because they're not code signed).

I figured out a work-around for part of my problem. I'm not going to select this (my own) answer because it doesn't solve the entire problem. The main reason I use Fluid to wrap galaxy in an "app" is because you can only have 1 galaxy browser window open. If I have 2 open, changes made in 1 window affect the other, so when I'm working on 2 different projects concurrently, I was using separate Fluid apps to keep the projects from stepping on one another's toes. I knew that private browser windows could also accomplish this, but I liked the convenience of a dock icon.

So I just worked out an Applescript, saved as an app, that opens a new private Safari window to galaxy.princeton.edu. I then added that app to Security & Privacy -> Privacy -> Accessibility. This script is slightly simplified from what I actually used:

set isRunning to is_running("Safari")

if isRunning is false then
    tell application "Safari" to activate
    delay 2
end if

--Open http://galaxy.princeton.edu/ in a new private window
tell application "System Events" to perform action "AXPress" of menu item "New Private Window" of menu "File" of menu bar item "File" of menu bar 1 of application process "Safari"
delay 0.5
tell application "Safari" to set URL of current tab of front window to "http://galaxy.princeton.edu/"

on is_running(appName)
    tell application "System Events" to (name of processes) contains appName
end is_running

Note, depending on your accessibility preferences, Applescript will not type numbers, dots, or a few other characters, thus the key code 47 for the dots.

Now, whenever I run this "app" (which I gave the galaxy icon), it will open a new Safari browser window to galaxy.

This allows me to run my automator services on DNA strings in galaxy because Safari can be given permission to send apple events to System Events.app, whereas Fluid apps can't (I believe because they're not code signed).

I figured out a work-around for part of my problem. I'm not going to select this (my own) answer because it doesn't solve the entire problem. The main reason I use Fluid to wrap galaxy in an "app" is because you can only have 1 galaxy browser window open. If I have 2 open, changes made in 1 window affect the other, so when I'm working on 2 different projects concurrently, I was using separate Fluid apps to keep the projects from stepping on one another's toes. I knew that private browser windows could also accomplish this, but I liked the convenience of a dock icon.

So I just worked out an Applescript, saved as an app, that opens a new private Safari window to galaxy.princeton.edu. I then added that app to Security & Privacy -> Privacy -> Accessibility. This script is slightly simplified from what I actually used:

tell application "Safari" to activate

tell application "System Events" 
    keystroke "n" using {shift down, command down}
    delay 0.5
    keystroke "http://galaxy"
    key code 47
    keystroke "princeton"
    key code 47
    keystroke "edu/"
    keystroke return
end tell

Note, depending on your accessibility preferences, Applescript will not type numbers, dots, or a few other characters, thus the key code 47 for the dots.

Now, whenever I run this "app" (which I gave the galaxy icon), it will open a new Safari browser window to galaxy.

This allows me to run my automator services on DNA strings in galaxy because Safari can be given permission to send apple events to System Events.app, whereas Fluid apps can't (I believe because they're not code signed).

Updated applescript code - thanks @user3439894
Source Link
hepcat72
  • 1.3k
  • 3
  • 18
  • 40

I figured out a work-around for part of my problem. I'm not going to select this (my own) answer because it doesn't solve the entire problem. The main reason I use Fluid to wrap galaxy in an "app" is because you can only have 1 galaxy browser window open. If I have 2 open, changes made in 1 window affect the other, so when I'm working on 2 different projects concurrently, I was using separate Fluid apps to keep the projects from stepping on one another's toes. I knew that private browser windows could also accomplish this, but I liked the convenience of a dock icon.

So I just worked out an Applescript, saved as an app, that opens a new private Safari window to galaxy.princeton.edu. I then added that app to Security & Privacy -> Privacy -> Accessibility. This script is slightly simplified from what I actually used:

set isRunning to is_running("Safari")

if isRunning is false then
    tell application "Safari" to activate
 
    delay 0.52
end if

--Open http://galaxy.princeton.edu/ in a new private window
tell application "System Events"
  to perform action keystroke"AXPress" "n"of usingmenu {shiftitem down,"New commandPrivate down}
Window" of menu "File" delayof 0.5
menu bar item "File" keystrokeof "http://galaxy"
menu bar 1 of keyapplication codeprocess 47"Safari"
  delay 0.5
tell keystrokeapplication "princeton"
"Safari" to set URL keyof codecurrent 47
tab of front window keystroketo "edu"http://galaxy.princeton.edu/"

on is_running(appName)
    keystroketell returnapplication "System Events" to (name of processes) contains appName
end tellis_running

Note, depending on your accessibility preferences, Applescript will not type numbers, dots, or a few other characters, thus the key code 47 for the dots.

Now, whenever I run this "app" (which I gave the galaxy icon), it will open a new Safari browser window to galaxy.

This allows me to run my automator services on DNA strings in galaxy because Safari can be given permission to send apple events to System Events.app, whereas Fluid apps can't (I believe because they're not code signed).

I figured out a work-around for part of my problem. I'm not going to select this (my own) answer because it doesn't solve the entire problem. The main reason I use Fluid to wrap galaxy in an "app" is because you can only have 1 galaxy browser window open. If I have 2 open, changes made in 1 window affect the other, so when I'm working on 2 different projects concurrently, I was using separate Fluid apps to keep the projects from stepping on one another's toes. I knew that private browser windows could also accomplish this, but I liked the convenience of a dock icon.

So I just worked out an Applescript, saved as an app, that opens a new private Safari window to galaxy.princeton.edu. I then added that app to Security & Privacy -> Privacy -> Accessibility. This script is slightly simplified from what I actually used:

tell application "Safari" to activate
 
delay 0.5

--Open http://galaxy.princeton.edu/ in a new private window
tell application "System Events"
     keystroke "n" using {shift down, command down}
    delay 0.5
    keystroke "http://galaxy"
    key code 47
    keystroke "princeton"
    key code 47
    keystroke "edu/"
    keystroke return
end tell

Note, depending on your accessibility preferences, Applescript will not type numbers, dots, or a few other characters, thus the key code 47 for the dots.

Now, whenever I run this "app" (which I gave the galaxy icon), it will open a new Safari browser window to galaxy.

This allows me to run my automator services on DNA strings in galaxy because Safari can be given permission to send apple events to System Events.app, whereas Fluid apps can't (I believe because they're not code signed).

I figured out a work-around for part of my problem. I'm not going to select this (my own) answer because it doesn't solve the entire problem. The main reason I use Fluid to wrap galaxy in an "app" is because you can only have 1 galaxy browser window open. If I have 2 open, changes made in 1 window affect the other, so when I'm working on 2 different projects concurrently, I was using separate Fluid apps to keep the projects from stepping on one another's toes. I knew that private browser windows could also accomplish this, but I liked the convenience of a dock icon.

So I just worked out an Applescript, saved as an app, that opens a new private Safari window to galaxy.princeton.edu. I then added that app to Security & Privacy -> Privacy -> Accessibility. This script is slightly simplified from what I actually used:

set isRunning to is_running("Safari")

if isRunning is false then
    tell application "Safari" to activate
    delay 2
end if

--Open http://galaxy.princeton.edu/ in a new private window
tell application "System Events" to perform action "AXPress" of menu item "New Private Window" of menu "File" of menu bar item "File" of menu bar 1 of application process "Safari"
delay 0.5
tell application "Safari" to set URL of current tab of front window to "http://galaxy.princeton.edu/"

on is_running(appName)
    tell application "System Events" to (name of processes) contains appName
end is_running

Note, depending on your accessibility preferences, Applescript will not type numbers, dots, or a few other characters, thus the key code 47 for the dots.

Now, whenever I run this "app" (which I gave the galaxy icon), it will open a new Safari browser window to galaxy.

This allows me to run my automator services on DNA strings in galaxy because Safari can be given permission to send apple events to System Events.app, whereas Fluid apps can't (I believe because they're not code signed).

Source Link
hepcat72
  • 1.3k
  • 3
  • 18
  • 40

I figured out a work-around for part of my problem. I'm not going to select this (my own) answer because it doesn't solve the entire problem. The main reason I use Fluid to wrap galaxy in an "app" is because you can only have 1 galaxy browser window open. If I have 2 open, changes made in 1 window affect the other, so when I'm working on 2 different projects concurrently, I was using separate Fluid apps to keep the projects from stepping on one another's toes. I knew that private browser windows could also accomplish this, but I liked the convenience of a dock icon.

So I just worked out an Applescript, saved as an app, that opens a new private Safari window to galaxy.princeton.edu. I then added that app to Security & Privacy -> Privacy -> Accessibility. This script is slightly simplified from what I actually used:

tell application "Safari" to activate

delay 0.5

--Open http://galaxy.princeton.edu/ in a new private window
tell application "System Events"
    keystroke "n" using {shift down, command down}
    delay 0.5
    keystroke "http://galaxy"
    key code 47
    keystroke "princeton"
    key code 47
    keystroke "edu/"
    keystroke return
end tell

Note, depending on your accessibility preferences, Applescript will not type numbers, dots, or a few other characters, thus the key code 47 for the dots.

Now, whenever I run this "app" (which I gave the galaxy icon), it will open a new Safari browser window to galaxy.

This allows me to run my automator services on DNA strings in galaxy because Safari can be given permission to send apple events to System Events.app, whereas Fluid apps can't (I believe because they're not code signed).