Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Recover missing AutoHotkey.net Files from Google Cache


  • Please log in to reply
6 replies to this topic
Wade Hatler
  • Members
  • 40 posts
  • Last active: Nov 06 2014 10:46 PM
  • Joined: 28 Sep 2004
This post is obsolete. See a better answer from Uberi here.


You'll probably notice that a lot of the hyperlinks in the forum don't work because of the crash on autohotkey.net. Quite a few of the files can be recovered from the Google cache, using this technique borrowed from this Stack Exchange page.

Manual Method

For a simple example, start on AHK Window Info forum topic which has one of Sean's handy AHK scripts to give you window information.

Click on the AHK Source Code link in the first posting, and it will give you a 404 error.

Click on the location bar in your browser and you'll see the lost URL https://ahknet.autohotkey.com/~toralf/Window_Info/AHK_Window_Info_v1.7.ahk

Hit the Home key and paste in this string at the start of the address:
http://webcache.googleusercontent.com/search?q=cache:
Hit End and paste this onto the end of the URL to get the text-only version
&hl=en&prmd=imvns&strip=1

Hit Enter and test your luck. If you get a hit, copy the text from your browser window with ^a^c and paste it into a new document.


Experimental Automated Method
The attached experimental version will read the file from the cache and save it directly. It hasn't been tested extensively, so feel free to make improvements. Directions are in the comment at the top of the file. You can get the file directly from GitHub or cut-n-paste it below.

; This experimental file will attempt to download a lost file from the Google cache based on the URL in the
; clipboard.  It has been tested for about 5 minutes, so use at your own risk.
;
; To use:
;    Navigate to a page that has a link to a file you want
;    Click the link to see if it's been restored
;    If not, copy the URL from the address bar into the clipboard, and then execute this script
;    If all goes well, you'll end up with the cached version in your Temp folder (A_Temp) and open in Notepad


    ; Make sure we have a valid URL to get from the cache
    OriginalURL := Clipboard
    if (!Instr(OriginalURL, "http:")) {
        MsgBox The clipboard doesn't appear to contain a valid URL.  Copy the URL to the clipboard and try again
        ExitApp
    }

    CacheURL   := "http://webcache.googleusercontent.com/search?q=cache:" OriginalURL "&hl=en&prmd=imvns&strip=1"
    TargetFile := A_Temp "\" RegexReplace(OriginalURL, "^.*/", "")

    ; Use brute force to convert the HTML to text by reading it into an Internet Explorer control and letting
    ; it do the work.  Not very efficient, but it is easy.
    IEDoc := IEDoc(CacheURL, False)
    Text := ie.Document.body.innerText

    ; Get rid of the Google Cache header and write the text to a file
    Text := RegexReplace(Text, "`r", "")
    Text := RegexReplace(Text, "is).*(Text-only|Full) version", "")
    Text := RegexReplace(Text, "^[\r\n ]+", "")
    Text := RegexReplace(Text, "\n", "`r`n")
    IE.Quit()

    F := FileOpen(TargetFile, "w")
    F.Write(Text)
    F.Close()

    Run Notepad.exe "%TargetFile%"

    ExitApp

;=============================================================================================================
; Open a URL in Internet Explorer
;-------------------------------------------------------------------------------------------------------------
IEDoc(URL, Visible=False) {
    global IE
    ie := ComObjCreate("InternetExplorer.Application")

    ie.Visible := Visible
    ie.Navigate(URL)
    loop 100 {
        Sleep 100
        if ie.ReadyState == 4 {
            break
        }
    }

    doc := ie.Document
    loop 100 {
        Sleep 100
        if doc.readyState == "complete" {
            break
        }
    }

    return doc
}


rbrtryn
  • Members
  • 1177 posts
  • Last active: Sep 11 2013 08:04 PM
  • Joined: 22 Jun 2011
I think this has already been done by Uberi. See post here.

My Scripts are written for the latest released version of AutoHotkey.

Need a secure, accessible place to backup your stuff? Use Dropbox!


Wade Hatler
  • Members
  • 40 posts
  • Last active: Nov 06 2014 10:46 PM
  • Joined: 28 Sep 2004
Excellent. That's way better. Would be nice to make a sticky message at the top of the forum if anyone knows how to do that.

Uberi
  • Moderators
  • 1119 posts
  • Last active: May 02 2015 06:05 PM
  • Joined: 23 Aug 2010
If necessary, I can also post the scripts I used to automate recovery. However, they would not result in the same set of files as the one I posted; some links had some strange behavior and were recovered either manually or from my own copies.

Many scripts are still missing, though, so if you have any scripts, send them to me and I will try to collect everything together.

BGM
  • Members
  • 199 posts
  • Last active: Jun 05 2015 06:26 PM
  • Joined: 12 Jan 2011

I don't know if anyone has noticed, but it seems like many of the download links that have  ~username are broken.

 

For example, the ahk Standard Library Collection

The url is:

https://ahknet.autoh...b/ahkstdlib.zip

 

Is this collection up to date?  That Library Viewer by Titan is wonderful; I'd like to see it updated, for it is dated September 2010.


(AutoHotkey 1.1.15.00 on Windows 7 Pro x64)


faqbot
  • Members
  • 997 posts
  • Last active:
  • Joined: 10 Apr 2012
@BGM: No you are the first one notice, seriously, no I mean really, nobody noticed. ever. http://www.autohotke...ests-and-fixes/

BGM
  • Members
  • 199 posts
  • Last active: Jun 05 2015 06:26 PM
  • Joined: 12 Jan 2011

@faqbot, You don't say?  You wouldn't joke about that would you?

 

I've already posted to the tail of that thread, and pm'd one of the admins asking if I could help.  I've read about half of that thread already.

 

http://www.autohotke...e-9#entry578459


(AutoHotkey 1.1.15.00 on Windows 7 Pro x64)