Hi guys, first post here.
I've used AHK for a while now, started using it on Skyrim, now I use it to work with AUTOCAD and EXCEL, just basic simple macros with "Send", "Loop", etc, never used it with google chrome.
Where I work the internet access is blocked to some sites, but if I add "https://" before the site URL the access is permited, imgur always works, but it's boring to always go there and type it haha
Is there a way to automate this proccess on autohotkey?
This is the error message that displays:
http://imgur.com/WYlYrd5
With "https://":
http://imgur.com/l1znf9Q
Add "https://" in URL if specific error page is displayed on Google Chrome
Re: Add "https://" in URL if specific error page is displayed on Google Chrome
Hotkey
Hotstring
Code: Select all
!i::Run, "<yourPathTo>\chrome.exe" "https://imgur.com" ; press Alt+i to call imgur.com
Code: Select all
::imgur.com::https://imgur.com ; once you type imgur.com it should replace it with https://imgur.com
Re: Add "https://" in URL if specific error page is displayed on Google Chrome
That should work only for imgur, I want the script to detect the error image and then add "https://" on the beginning of the URL for every site.BoBo wrote:HotkeyHotstringCode: Select all
!i::Run, "<yourPathTo>\chrome.exe" "https://imgur.com" ; press Alt+i to call imgur.com
Code: Select all
::imgur.com::http://imgur.com
As I browse reddit for example, I open a reddit image on another tab and the error image is displayed, I want the script to detect that error image and add https:// to the url start so I can see the image
Re: Add "https://" in URL if specific error page is displayed on Google Chrome
Well, that wasn't said/requested in your inital post.Bragatp wrote:That should work only for imgur, I want the script to detect the error image and then add "https://" on the beginning of the URL for every site.BoBo wrote:HotkeyHotstringCode: Select all
!i::Run, "<yourPathTo>\chrome.exe" "https://imgur.com" ; press Alt+i to call imgur.com
Code: Select all
::imgur.com::http://imgur.com
As I browse reddit for example, I open a reddit image on another tab and the error image is displayed, I want the script to detect that error image and add https:// to the url start so I can see the image
Best case, you provide your full requirements in the beginning.
Otherwise you end up acting like my wife
IMHO it makes sense to "correct"/pimp your entries before you call a webpage, instead of messing around how to detect a servers online response.
Let's guess your admin will get a nice salary to monitor your behaviour via the server logs and will block any variants of calling blacklisted pages sooner or later.
Good luck
Last edited by BoBo on 28 Jun 2017, 09:37, edited 1 time in total.
Re: Add "https://" in URL if specific error page is displayed on Google Chrome
You misunderstood me, imgur was only an example of a site that works with https.BoBo wrote:Well, that wasn't said/requested in your inital post.Bragatp wrote:That should work only for imgur, I want the script to detect the error image and then add "https://" on the beginning of the URL for every site.BoBo wrote:HotkeyHotstringCode: Select all
!i::Run, "<yourPathTo>\chrome.exe" "https://imgur.com" ; press Alt+i to call imgur.com
Code: Select all
::imgur.com::http://imgur.com
As I browse reddit for example, I open a reddit image on another tab and the error image is displayed, I want the script to detect that error image and add https:// to the url start so I can see the image
Best case, you provide your full requirements in the beginning.
Otherwise you end up acting like my wife
As I said, I want to automate all the proccess to type https, implied that the script must detect the error page then type https on the url
Re: Add "https://" in URL if specific error page is displayed on Google Chrome
This might be good, refresh a page as https://. Possible hotkey: ^F5:: (ctrl+F5). It uses the Acc library:
Code: Select all
;Acc library (MSAA) and AccViewer download links - AutoHotkey Community
;https://autohotkey.com/boards/viewtopic.php?f=6&t=26201
q:: ;url 'special refresh', reload page as 'https://'
WinGet, hWnd, ID, A
oAcc := Acc_Get("Object", "window.client.client.client2.tool_bar2.grouping1.editable_text", 0, "ahk_id " hWnd)
vUrl := oAcc.accValue(0)
if (SubStr(vUrl, 1, 7) = "http://")
vUrl := SubStr(vUrl, 8)
if (SubStr(vUrl, 1, 8) = "https://")
vUrl := SubStr(vUrl, 9)
vUrl := "https://" vUrl
oAcc.accValue(0) := vUrl
;oAcc.accDoDefaultAction(0) ;didn't work
SendInput !d{Enter}
oAcc := ""
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Add "https://" in URL if specific error page is displayed on Google Chrome
Didn't workjeeswg wrote:This might be good, refresh a page as https://. Possible hotkey: ^F5:: (ctrl+F5). It uses the Acc library:
Code: Select all
;Acc library (MSAA) and AccViewer download links - AutoHotkey Community ;https://autohotkey.com/boards/viewtopic.php?f=6&t=26201 q:: ;url 'special refresh', reload page as 'https://' WinGet, hWnd, ID, A oAcc := Acc_Get("Object", "window.client.client.client2.tool_bar2.grouping1.editable_text", 0, "ahk_id " hWnd) vUrl := oAcc.accValue(0) if (SubStr(vUrl, 1, 7) = "http://") vUrl := SubStr(vUrl, 8) if (SubStr(vUrl, 1, 8) = "https://") vUrl := SubStr(vUrl, 9) vUrl := "https://" vUrl oAcc.accValue(0) := vUrl ;oAcc.accDoDefaultAction(0) ;didn't work SendInput !d{Enter} oAcc := "" return
When I press the hotkey the URL just gets highlighted, but nothings happens beyond that
Re: Add "https://" in URL if specific error page is displayed on Google Chrome
A slightly improved (logic) version of the original script, with a ToolTip line that should contain the original url (that can be commented out), and a simple version that uses the clipboard. So hopefully at least the clipboard script should work. Try AccViewer to identify the correct Acc path. Otherwise it could be possible issues like Admin windows.
[EDIT:] I've also commented out the original Acc path, and added a numeric version instead. It may be that the string version only works on English language PCs, whereas the numeric version should probably work on any PC.
[EDIT:] I've also commented out the original Acc path, and added a numeric version instead. It may be that the string version only works on English language PCs, whereas the numeric version should probably work on any PC.
Code: Select all
q:: ;url 'special refresh', reload page as 'https://'
WinGet, hWnd, ID, A
;oAcc := Acc_Get("Object", "window.client.client.client2.tool_bar2.grouping1.editable_text", 0, "ahk_id " hWnd)
oAcc := Acc_Get("Object", "4.1.2.2.3.5.2", 0, "ahk_id " hWnd)
vUrl := oAcc.accValue(0)
ToolTip, % "url: " vUrl
if (SubStr(vUrl, 1, 7) = "http://") ;http to https
vUrl := "https://" SubStr(vUrl, 8)
else if !(SubStr(vUrl, 1, 8) = "https://") ;not http/https, prepend https
vUrl := "https://" vUrl
oAcc.accValue(0) := vUrl
;oAcc.accDoDefaultAction(0) ;didn't work
SendInput !d{Enter}
oAcc := ""
return
;==================================================
;q:: ;url 'special refresh', reload page as 'https://'
WinGet, hWnd, ID, A
ClipSaved := ClipboardAll
Clipboard := ""
SendInput !d
Sleep 1000
SendInput ^c
ClipWait
vUrl := Clipboard
ToolTip, % "url: " vUrl
if (SubStr(vUrl, 1, 7) = "http://") ;http to https
vUrl := "https://" SubStr(vUrl, 8)
else if !(SubStr(vUrl, 1, 8) = "https://") ;not http/https, prepend https
vUrl := "https://" vUrl
Clipboard := vUrl
SendInput !d^v{Enter}
Clipboard := ClipSaved
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Who is online
Users browsing this forum: JKJadan, Psych0p4th and 266 guests