Help to find videos on google and/or youtube

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
XtiiGmA
Posts: 26
Joined: 21 Apr 2021, 10:22

Help to find videos on google and/or youtube

01 May 2021, 18:53

Hello friends how are you?
Could you help me with this? I would like that when I check both or a single checkbox, enter a word in the text box and press the "Search" button, open the google chrome application and search. I know that for you it is something obvious but I am learning, THANK YOU!
Another thing, how can I put the text input box next to the "Name Search" ...

Code: Select all

Gui, Add, Checkbox,Checked1,google.com
Gui, Add, Checkbox,Checked0,youtube.com
Gui, Add, Text, ,Name Search
Gui, Add, Edit, x+ y+
gui, Add, Button, Default, Search
Gui, Show
return

ButtonSearch:
	
	return

GuiClose:
ExitApp
User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Help to find videos on google and/or youtube

01 May 2021, 21:06

Code: Select all

Gui, Font, s10
Gui, Add, Checkbox,           Checked1 vgoogle  gFocus, &Google
Gui, Add, Checkbox, x+20      Checked0 vyoutube gFocus, &YouTube
Gui, Add, Text    , xm   y+10                         , &Search text:
Gui, Add, Edit    , x+m  yp-3          vstring
Gui, Add, Button  , Default                           , Search
Gosub, F3

F3::
Gui, Show,, Web search
Focus:
GuiControl, Focus, string
Sleep, 50
Send ^a
Return

ButtonSearch:
Gui, Submit
query := StrReplace(string, " ", "+")
If google
 Run, https://www.google.com/search?q=%query%
If youtube
 Run, https://www.youtube.com/results?search_query=%query%
Return

GuiEscape:
Gui, Hide
Return
GuiClose:
ExitApp
XtiiGmA
Posts: 26
Joined: 21 Apr 2021, 10:22

Re: Help to find videos on google and/or youtube

02 May 2021, 10:52

Hi mikeyww, I've been looking at your code and I don't understand some things, I also did something simple that works, could you explain the things you put in and they are not in the code that I did recently?

Code: Select all

gui, Add, Checkbox,Checked1 vGoogle,Google
gui, Add, Checkbox,Checked0 vYoutube,Youtube
gui, Add, Edit,vtext
gui, Add, Button,Default gSearch,Search
gui, Show 
return

Search:
gui, Submit
	if Google
		run, chrome.exe "http www.google.com /search?q=%text%"  Broken Link for safety
	if Youtube
		run, chrome.exe "https www.youtube.com /results?search_query=%text%"  Broken Link for safety
	ExitApp
	return

GuiClose:
ExitApp
User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Help to find videos on google and/or youtube

02 May 2021, 13:05

Sure, here is the info: g-labelPositioningGuiControl

These are just conveniences, so if your script works, go with it!

If you have questions, let me know.
garry
Posts: 3795
Joined: 22 Dec 2013, 12:50

Re: Help to find videos on google and/or youtube

02 May 2021, 15:20

@XtiiGmA your script is OK
you can add to gui commands x y w h ( x y position , width , height ) if wanted

Code: Select all

;- Help to find videos on google and/or youtube 
;- https://www.autohotkey.com/boards/viewtopic.php?f=76&t=90047
#Warn
#NoEnv
Setworkingdir,%a_scriptdir%
Gui,-dpiscale
Gui,Color,Black,Black
Gui,Font,s12 CYellow,Lucida Console
gui, Add, Checkbox,Checked1 vGoogle,Google
gui, Add, Checkbox,Checked0 vYoutube,Youtube
gui, Add, Edit, w360 vtext,jim reeves                  ;- predefined text
gui, Add, Button,Default gSearch,Search
gui, Show , x100 y100 w400 h300,SEARCH 
return
;-----------------
Search:
gui, Submit,nohide  
	if Google
		run,https://www.google.com/search?q=%text% 
	if Youtube
		run,https://www.youtube.com/results?search_query=%text%
return
;-----------------
GuiClose:
ExitApp
;==============================================

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: peter_ahk and 353 guests