--
You received this message because you are subscribed to the Google Groups "Quicksilver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blacktree-quicks...@googlegroups.com.
To post to this group, send email to blacktree-...@googlegroups.com.
Visit this group at https://groups.google.com/group/blacktree-quicksilver.
For more options, visit https://groups.google.com/d/optout.
using terms from application "Quicksilver"
on process text theURL
tell application "Google Chrome"
make new window with properties {mode:"incognito"}
activate
set URL of active tab of first window to theURL
end
tell
end process text
on get direct types
return {"NSStringPboardType", "Apple URL pasteboard type"}
end get direct types
end using terms from
using terms from application "Quicksilver"
on process text theURLs
if not running of application "Google Chrome" then ¬
tell application "Google Chrome" to close front window
if theURLs contains "," then ¬
set theURLs to theURLsToCSV(theURLs)
if (count of theURLs) is 2 and item 1 of theURLs contains "***" then ¬
set theURLs to theURLsToWebSearch(theURLs)
repeat with theURL in theURLs as list
if theURL does not start with "http" then set theURL to "http://" & theURL
tell application "Google Chrome"
activate
if not ((some window whose mode is "incognito") exists) then
make new window with properties {mode:"incognito"}
set URL of active tab of first window to theURL
else
make new tab at (front window whose mode is "incognito") with properties {URL:theURL}
end if
end tell
end repeat
-- Full Screen Mode
tell application "System Events"
if not (value of attribute "AXFullScreen" of front window of process "Google Chrome") then ¬
keystroke "f" using {command down, control down}
end tell
-- Presentation Mode
(** tell application "Google Chrome" to tell front window
if not presenting then enter presentation mode
end tell **)
end process text
on get direct types
return {"NSStringPboardType", "Apple URL pasteboard type"}
end get direct types
end using terms from
on theURLsToCSV(theURLs)
-- for multiple values use comma-separated text
-- comma trick doesn't work with text nor URLs #1727
set ASTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to ","
set theCSURLs to text items of theURLs
set AppleScript's text item delimiters to ASTID
return theCSURLs
end theURLsToCSV
on theURLsToWebSearch(theURLsAsWebSearch)
-- usage: select QS Web Search, change to text mode, add search terms after a comma
-- example: http://www.google.com/search?hl=en&q=***,søren kierkegaard
set theSearchTerms to urlEncode(item 2 of theURLsAsWebSearch)
set QSWebSearchURL to item 1 of theURLsAsWebSearch
set theWebSearchURL to findReplace("***", theSearchTerms, QSWebSearchURL)
return theWebSearchURL
end theURLsToWebSearch
on urlEncode(theSearchTerms)
return do shell script "php -r 'echo urlencode(\"" & theSearchTerms & "\");'"
end urlEncode
on findReplace(findText, replaceText, sourceText)
set ASTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to findText
set sourceText to text items of sourceText
set AppleScript's text item delimiters to replaceText
set sourceText to sourceText as text
set AppleScript's text item delimiters to ASTID
return sourceText
end findReplace
To unsubscribe from this group and stop receiving emails from it, send an email to blacktree-quicksilver+unsub...@googlegroups.com.
By the way, I made .scpt files in the appropriate directory for each of these, but I can't get either of them to work.
using terms from application "Quicksilver" on process text theURL
tell application "Safari" set window_ids to id of every window activate end tell tell application "System Events" to keystroke "N" using {command down, shift down} tell application "Safari" repeat 10 times if id of front window is not in window_ids then set the URL of its front window's current tab to theURL exit repeat end if delay 0.1 end repeat
end tell end process text on get direct types return {"NSStringPboardType", "Apple URL pasteboard type"} end get direct typesend using terms from
--
You received this message because you are subscribed to a topic in the Google Groups "Quicksilver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/blacktree-quicksilver/pb11EIZALYg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to blacktree-quicks...@googlegroups.com.
If you're feeling generous, I'd love a way to do it, but if not, you've already helped me a great deal and I can use the script you gave me to do what I want (though it has a lot more features I don't understand yet)
I'm on QS 1.3.4, and on Yosemite
using terms from application "Quicksilver"
on process text theURLs
if theURLs contains "," then ¬
set theURLs to theURLsToCSV(theURLs)
if (count of theURLs) is 2 and item 1 of theURLs contains "***" then ¬
set theURLs to theURLsToWebSearch(theURLs)
tell application "Safari"
activate
if running then ¬
tell application "System Events" to tell process "Safari" to ¬
tell menu bar 1 to tell menu bar item "Safari" to tell menu 1
try
tell menu item "Private Browsing…"
try
set checkMark to value of attribute "AXMenuItemMarkChar"
log checkMark -- errors when undefined
on error
click
tell application "System Events" to tell process "Safari" to tell first window to click button "OK"
end try
end tell
end try
tell application "Safari"
activate
if not (exists (every window whose id ≥ 1)) then make new document
repeat with theURL in theURLs as list
if theURL does not start with "http" then set theURL to "http://" & theURL
tell first window to make new tab with properties {URL:theURL}
end repeat
tell first window to set current tab to last tab
end tell
end tell
end tell
tell application "System Events"
if not (value of attribute "AXFullScreen" of front window of process "Safari") then ¬
keystroke "f" using {command down, control down}
end
tell
end process text
on get direct types
return {"NSStringPboardType", "Apple URL pasteboard type"}
I forgot to mention that you need to enable access for assistive devices.
Wow, thanks for all your hard work.I’m on a version where I don’t have “Private Browsing…” but rather “New Private Window”I tried to change that in your Applescript but it didn’t work.Let me know if you’d like a copy of my book, as a thank you :)