 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
fogus
Joined: 28 Mar 2007 Posts: 28
|
Posted: Tue Jun 26, 2007 8:14 pm Post subject: Help me save my text |
|
|
I would like to make a program that would help me not loose what I write in a web forum if my computer crashes or web session times out. This happens a ton to my friends whose computers are not very new and crash often. They loose whole reports that they never saved at times. Just having this running in the background would be really great.
Say I am typing away at one of these autohotkey forum pages, and then I get a bluescreen. Is there a way my computer could be automatically dumping what I write to a text file? Obviously autohotkey must be monitoring everything I type. It must be pretty simple to dump this info somewhere.
Any ideas? |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Tue Jun 26, 2007 9:14 pm Post subject: |
|
|
i have an extension for firefox that saves everything in your forms. It might be a greasemonkey script - search the forum for greasemonkey, and you will find my other post related to this. It's pretty good. _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
Fuco
Joined: 21 Mar 2006 Posts: 49 Location: Slovakia, Europe :)
|
Posted: Tue Jun 26, 2007 11:25 pm Post subject: |
|
|
quick idea:
create hotkey for every key you want, something like this
| Code: | ~a::goto, l_write
~b::goto, l_write
...
... |
| Code: | l_write:
{
ifwinactive, <your browser>
{
StringTrimLeft, var, %a_thishotkey%, 1
fileappend, %var%, <yourfile>
}
} |
however this will not save #10 #13 ( carriage return ) and save only plain text....
So if you have this text:
| Quote: | something albalblalba
this is something bold
gjiorgjoer igjrieog |
it will save:
| Code: | | something albalblalba[b]this is something bold[/b] gjiorgjoer igjrieog |
this can be handled by registering enter as a new line commad ( so it will not write thishotkey, but `n ). However when you do some editing it will screw it all up... ( like deleting some lines or rewriting.
--------------------------
other option is copy edit window in clipboard and save clipboard, but i think it will blick everytime when it use CTRL+A to select all text..
this label will then be changed to:
| Code: | l_write:
{
ifwinactive, <your browser>
{
send ^a^c
filedelete, <yourfile>
fileappend, %clipboard%, <yourfile>
}
} |
_________________ RegExReplace("C:\Program Files\AutoHotkey", "(^C)(?=\W).{4}((?i)[GOD])\w{1,4}\s(\D)(?:\w+)*\\(?3)(u|o).*?(k).*" , "$3$4$l1$5$2") |
|
| Back to top |
|
 |
Dewi Morgan
Joined: 03 Oct 2005 Posts: 178
|
Posted: Tue Jun 26, 2007 11:53 pm Post subject: |
|
|
The logging of every key woudl not work: you would also need to log which fields were selected when the keys were pressed, and if someone clicked about in a textbox with a mouse, and used the cursor keys (as I have a fair bit in writing this) then recreating the content they created would be well-nigh impossible.
I really would recommend using Firefox with a session saver of your choice.
It is possible, though, that for some reason you must use IE.
Perhaps you are using a work machine and they will not let you upgrade from IE6, but will permit you to run arbitrary AHK scripts, because the IT administration at your workplace are a gang of crazed lunatic babboons with no sense of appropriate security policies whatsoever. I have worked in places like this, so I know it is hardly rare.
Or perhaps you are working in data entry, and the data entry app you have to work with uses a whole bunch of nasty ActiveX stuff that doesn't work in IE7, which apparently has session saving built in.
Whatever the reason, if you are forced to use IE, then you definitely need some form of session saving: even innocuous stuff like well-formed CSS tags, or javascript trying to display the DOM components, can crash IE, so it's important to be protected. And a fairly careful Google search shows me no session saving utilties available for IE, despite a strong demand.
So: yes, it would be a cool feature to write, and yes I can understand many reasons why people would need it; but no, I can't see a way to do it.
Sorry 'bout that. _________________ Yet another hotkeyer. |
|
| Back to top |
|
 |
Travley
Joined: 13 May 2007 Posts: 48
|
Posted: Wed Jun 27, 2007 12:07 am Post subject: |
|
|
knowing that what everyone said above is better and more of an efficent idea. i recently did this (for my own usage) and it may help you. though it's not perfect, by any means.
| Code: | #InstallKeybdHook
$,::
fileappend,
(
,
), logga.txt
send, ,
return
$space::
FileAppend, %A_Space%, logga.txt
send, {space}
Return
$enter::
FileAppend, `n, logga.txt
send, {enter}
Return
$a::
FileAppend, a, logga.txt
send, a
Return
$b::
FileAppend, b, logga.txt
send, b
Return
$c::
FileAppend, c, logga.txt
send, c
Return
$d::
FileAppend, d, logga.txt
send, d
Return
$e::
FileAppend, e, logga.txt
send, e
Return
$f::
FileAppend, f, logga.txt
send, f
Return
$g::
FileAppend, g, logga.txt
send, g
Return
$h::
FileAppend, h, logga.txt
send, h
Return
$i::
FileAppend, i, logga.txt
send, i
Return
$j::
FileAppend, j, logga.txt
send, j
Return
$k::
FileAppend, k, logga.txt
send, k
Return
$l::
FileAppend, l, logga.txt
send, l
Return
$m::
FileAppend, m, logga.txt
send, m
Return
$n::
FileAppend, n, logga.txt
send, n
Return
$o::
FileAppend, o, logga.txt
send, o
Return
$p::
FileAppend, p, logga.txt
send, p
Return
$q::
FileAppend, q, logga.txt
send, q
Return
$r::
FileAppend, r, logga.txt
send, r
Return
$s::
FileAppend, s, logga.txt
send, s
Return
$t::
FileAppend, t, logga.txt
send, t
Return
$u::
FileAppend, u, logga.txt
send, u
Return
$v::
FileAppend, v, logga.txt
send, v
Return
$w::
FileAppend, w, logga.txt
send, w
Return
$x::
FileAppend, x, logga.txt
send, x
Return
$y::
FileAppend, y, logga.txt
send, y
Return
$z::
FileAppend, z, logga.txt
send, z
Return |
|
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5049 Location: imaginationland
|
Posted: Wed Jun 27, 2007 12:17 am Post subject: |
|
|
Firefox and IE7 have options to save your browsing sessions so you don't lose your tabs/form details in crashes etc. _________________
RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
fogus
Joined: 28 Mar 2007 Posts: 28
|
Posted: Wed Jun 27, 2007 12:29 am Post subject: |
|
|
That sounds great, although I am looking for something that would be application independent and would save to a text file rather than to some random system file. For example, I would like to be able to type someones phone number in notepad as they dictate it to me over the phone, then have my computer crash, and then recover this information from a text file to which it had been written. Having a note above each section saying what application I typed it in would be especially helpful.
(posted with out reading past engunneer's first post, sorry. didn't hit refresh) |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Wed Jun 27, 2007 12:49 am Post subject: |
|
|
does your computer crash that often?
This is getting very close to a keylogger, which I don't like to see posted here. _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
Dewi Morgan
Joined: 03 Oct 2005 Posts: 178
|
Posted: Wed Jun 27, 2007 3:58 am Post subject: |
|
|
Personally I see nothing wrong with keyloggers: there is one called "AutoScriptWriter" distributed with AHK.
Using Sean's keyboard and mouse hooks would be a better way of doing this though.
But it still wouldn't give you enough information to re-fill your html forms when you restarted IE after a crash.
And the thing I *do* find morally repellent about helping with a script that would backup and fill out IE HTML forms is that such a script might encourage people to avoid moving from IE.
We're all friends here, and friends don't let friends use IE. _________________ Yet another hotkeyer. |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Wed Jun 27, 2007 4:26 am Post subject: |
|
|
| Dewi Morgan wrote: | | We're all friends here, and friends don't let friends use IE. |
I am not religious, but Amen to that.
A keylogger and a script recorder are two different things IMHO. _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
fogus
Joined: 28 Mar 2007 Posts: 28
|
Posted: Wed Jun 27, 2007 4:59 pm Post subject: |
|
|
Visit http://www.safetycouncil.bc.ca/ for why firefox does not always work (hover mouse over the "courses" menu). I do generally use firefox and only pull up IE for ActiveX controls and other bizarre web pages.
Thanks guys. This code is going to be really helpful. I will make a working version and let you guys know how it works.
One last question, if I wanted to make backspace remove a character from the end of the textfile, could this be done? |
|
| Back to top |
|
 |
Dewi Morgan
Joined: 03 Oct 2005 Posts: 178
|
Posted: Wed Jun 27, 2007 8:40 pm Post subject: |
|
|
If you have the contents of the file already stored in a variable, then just use StringLeft to copy everything but the rightmost character, write that to another file, delete the first file, and rename the other file (this is safer than just deleting the file and then rewriting it).
If you don't have it in a variable, fileread it in from the file first, then do the above.
Not trivial, I know :( _________________ Yet another hotkeyer. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|