Hello all. So I've been trying to set up a workflow (since I couldn't find any online) that lets me search the web using a new private window in Safari. If it could work exactly like the default web search, but in a private window, that would be great, but I am having some trouble.
First off I am not a programmer, and all the related answers I found online were using Applescript, so that's what I've been trying to use. Yeah I realize it isn't the best of languages, but I had nothing else to go on unfortunately. What I did was basically take a similar script I found online and try to modify it to search the web after opening the private window. I was able to do so, but now my next challenge has been trying to use Alfred's variables inside my Applescript, and I am totally lost. This is the script below:
on alfred_script(q)
tell application "Safari"
activate
tell application "System Events"
tell process "Safari"
keystroke "N" using {shift down, command down}
delay 0.5
tell application "Safari" to search the web for (system attribute "search")
end tell
end tell
end tell
end alfred_script
Where I have "(system attribute "search")", is where to search using the terms I input into Alfred. I configured my keyword to be "gp", so ideally I'd just type "gp hello" and it'd search for "hello" in a new, private window in Safari. What is happening, though, is that it is just opening a new private window without any input at all. I assume I am doing something wrong with the variable in Alfred and/or Applescript, but I haven't been able to find any help online and everything I've tried hasn't worked.
Right now I have the connector between the Keyword and the Applescript being an Arg and Vars, with only 1 new variable created in it (name: search, value: {query}). I've also tried configuring this variable using the Workflow Environment Variables and still, nothing.
Please help. Here's the link to the workflow, as well.
Thanks.