Jump to content

I need a workflow to open a specific url in private browsing mode for Firefox


Recommended Posts

You will have to use system events to type keystrokes for you.

 

Here's the applescript:

tell application "Firefox" to activate

tell application "System Events"
    
    keystroke "p" using {shift down, command down} -- Open New Private Window
    keystroke "l" using {command down} -- Select the URL field
    
    keystroke "http://www.hotmail.com/" & return -- Paste URL and hit ENTER
    
end tell

Just change the hotmail URL within the quotes to whatever your URL is.

Link to comment

Okay, here's what I did. I pasted the above into the window called "Run NSAppleScript" so that it now looks like this:

 

on alfred_script(q)
  -- tell application "Firefox" to activate

tell application "System Events"
    
    keystroke "p" using {shift down, command down} -- Open New Private Window
    keystroke "l" using {command down} -- Select the URL field
    
    keystroke "http://intjforum.com/" & return -- Paste URL and hit ENTER
    
end tell
end alfred_script

 

The only thing is, it seems Firefox must be the active application when I use my keyword (in this case, "intj") for it to work (e.g. I can't be in an iTunes Window, then toggle Alfred, then type in my keyword). Can it be modified to account for this?

 

Also, you'll notice I changed the url . . . that is the site I'd like to use for this. I was wondering if there'd be any way to modify the applescript so that the "user name" and "password" fields are filled and the "Remember Me?" box is ticked and the "Login" button is pressed. Thank you.

Link to comment

Also, I would like to modify the workflow so that if I want to bring up another site, it would be just another private tab instead of a private window. This would be similar to the basic alfred keyword "google" then search term (it just opens in another tab if a firefox window is already open instead of another window).

Link to comment

Okay, here's what I did. I pasted the above into the window called "Run NSAppleScript" so that it now looks like this:

 

The only thing is, it seems Firefox must be the active application when I use my keyword (in this case, "intj") for it to work (e.g. I can't be in an iTunes Window, then toggle Alfred, then type in my keyword). Can it be modified to account for this?

 

Also, you'll notice I changed the url . . . that is the site I'd like to use for this. I was wondering if there'd be any way to modify the applescript so that the "user name" and "password" fields are filled and the "Remember Me?" box is ticked and the "Login" button is pressed. Thank you.

 

REMOVE the "--" in front of 'tell application "Firefox" to activate'  that is an applescript comment delimiter, therefore, the command AFTER the "--" is ignored: This is why Firefox was not activating.

 

Question: If you are Private browsing, is the "remember me" really going to be saved to the HD? I thought the idea of Private Browsing was that no cookies would be saved to the HD?

 

One way I think you could add the login and password would be to add more keystrokes.

For instance: if you hit TAB on your keyboard, does the focus go to the User Name Field for you? Then, another TAB and it moves to Password...etc.

 

So: adding the following after the 'keystroke "http://intjforum.com/" & return -- Paste URL and hit ENTER':

delay 2 -- Adds a delay after the URL is entered to allow for loading the site
keystroke tab -- Selects the User Name field
keystroke "yourusernamehere"
keystroke tab & return -- Selects the Password field
keystroke "yourpasswordhere" & enter

KEEP IN MIND: your password and login will be clearly obtainable if anyone looks through your Alfred workflows and happens upon this script.

 

About the new private TAB, I'm not entirely sure how to do that in an already active window ... perhaps someone else can chime in on that to modify the applescript.

Link to comment
  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...