@GuiB
Thanks for the simple example! One thing is that I want to open the search in a new window, instead of a new tab. That's why I started to use applescript in the first place. Is there a way to improve your example so that it does that?
@deanishe
Thanks, I appreciate your help!
The purpose is to make sure my workflow opens a new window, both when the app is running and not running. If I execute
tell application "Google Chrome"
activate
open location "https://www.youtube.com"
end tell
when the app is not running, (running it for the first time after reboot), it then activates a new window on the homepage, and another window on Youtube. That's why I decided to put
that do shell line. But after your help, I changed my script around, and here's my result : \
on alfred_script(q)
if q is equal to "" then
if application "Google Chrome" is running then
tell application "Google Chrome"
activate
make new window
open location "https://www.youtube.com"
end tell
else
tell application "Google Chrome" to open location "https://youtube.com"
end if
else
if application "Google Chrome" is running then
tell application "Google Chrome"
make new window
open location "https://www.youtube.com/search?q=" & q
end tell
else
tell application "Google Chrome" to open location "https://youtube.com" & q
end if
end if
end alfred_script
I think I'm almost done here, the only problem is
1. if used q quoted form of q, then youtube searches for the actual quoted form of what I've typed in. So if I search apple, it searches for 'apple'
2. if i don't use quoted form of q, then I can't search for multiple words!
Oh, and I have no idea where to upload my workflow, I did save it as a file.
I really feel like I'm bugging you guys out with something not important at all, I really appreciate your help thanks