Jump to content

Opening new safari tab beside current tab


Recommended Posts

Posted

I'm actually creating a workflow for the TYPO3 community http://www.typo3.org(an open source cms system) which should add features like

 

  • Open TYPO3 backend in a new tab,
  • Open TYPO3 install tool in a new tab.

 

Therefore my script already supports Chrome and Safari. 

 

My problem is, that the safari tab isn't created after my current tab. It seems it isn't possible to changing The index value of a tab.

 

Is there any possibility to make this working with a workaround?

 

 

thx

Jousch

 

This is my actual script:

on alfred_script(q)

global backendPathSegment
set backendPathSegment to "/typo3/index.php"

tell application "System Events" to set frontApp to name of first process whose frontmost is true



# SAFARI/WEBKIT
if (frontApp = "Safari") or (frontApp = "Webkit") then
	using terms from application "Safari"
		tell application frontApp to set currentTabUrl to URL of front document
		set currentTabUrl to currentTabUrl & backendPathSegment
		tell application frontApp to set currentTabIndex to index of current tab of front window
		set newTabindex to currentTabIndex + 1
		tell application frontApp
			tell front window
				set current tab to (make new tab with properties {URL:currentTabUrl})
			end tell
		end tell
	end using terms from
	
	
	# CHROME
else if (frontApp = "Google Chrome") or (frontApp = "Google Chrome Canary") or (frontApp = "Chromium") then
	using terms from application "Google Chrome"
		tell application frontApp to set currentTabUrl to URL of active tab of front window
		tell application frontApp to set currentTabTitle to title of active tab of front window
		tell application frontApp to set n to active tab index of front window
		tell application frontApp to set myTab to make new tab at after tab n of front window with properties {URL:currentTabUrl & backendPathSegment}
	end using terms from
	
	
	
	# ELSE (Firefox has no applescript support to my knowledge)	
else
	return "You need a supported browser as your frontmost app"
end if

end alfred_script

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...