![]() |
|
how to instant save in notepad - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: C, C++, & Obj-C (https://sinister.li/Forum-C-C-Obj-C) +--- Thread: how to instant save in notepad (/Thread-how-to-instant-save-in-notepad) Pages:
1
2
|
how to instant save in notepad - devendra - 09-02-2013 Hi guys First I introduce myself I know c,c++. And I have a query that I have to create a software which save whatever I am typing in notepad into the duration of 2-2 seconds. Can someone give me a small idea about that? RE: how to instant save in notepad - Slarek - 09-02-2013 So you want some kind of keylogger? Or have i misunderstood? RE: how to instant save in notepad - ArkPhaze - 09-02-2013 Save every 2 seconds? What a waste of CPU resources... Take a look at this function: http://msdn.microsoft.com/en-us/library/ms646302 Otherwise, you can use a Timer implementation of your own probably. What exactly are you trying to save from Notepad? The text that is in there to a new file someplace, or invoke the Notepad application to save it for you? The whole idea behind this seems unethical, perhaps until you provide more explanation. RE: how to instant save in notepad - The Real Slim Shady - 09-03-2013 It sounds simple enough to me. He wants whatever he writes into notepad to be saved every few seconds. Dont know why but nothing about it seems to be unethical or shady about it to me. Hell he could be the guy in my lectures with windows 8 that quite literally crashes every 3 minutes lol RE: how to instant save in notepad - ArkPhaze - 09-03-2013 (09-03-2013, 01:47 AM)Geoff Wrote: It sounds simple enough to me. He wants whatever he writes into notepad to be saved every few seconds. The solution is simple, press Ctrl + S more often. Why have another program saving every 2 seconds? If your OS is crashing every 3 minutes, then you have bigger problems to worry about than creating a program that does something like this. To think you need to create a program that will save things for you every 2 seconds just because an OS crashes every ~3 minutes is ridiculous. It would be like trying to use gum to fix a leak for the plumbing in your home. If that *was* the case, then fix your OS... It's the most logical thing here. RE: how to instant save in notepad - 1234hotmaster - 09-03-2013 Code: $Path = @HomeDrive & "\NotepadSaveFolder\"
If Not FileExists($Path) Then DirCreate($Path)
While 1
$CurTime = @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & "-" & @MIN & "-" & @SEC
FileWrite($Path & $CurTime & ".txt", WinGetText("[CLASS:Notepad]"))
Sleep(2000)
WEndHeres a Autoit3 script of what you want. RE: how to instant save in notepad - The Real Slim Shady - 09-03-2013 (09-03-2013, 04:29 AM)ArkPhaze Wrote: The solution is simple, press Ctrl + S more often. Why have another program saving every 2 seconds? If your OS is crashing every 3 minutes, then you have bigger problems to worry about than creating a program that does something like this. To think you need to create a program that will save things for you every 2 seconds just because an OS crashes every ~3 minutes is ridiculous. It would be like trying to use gum to fix a leak for the plumbing in your home. If that *was* the case, then fix your OS... It's the most logical thing here. lol i why does one become a programmer? essentially to find solutions to repetitive problems that a computer can do for us. Whether it be every 3 seconds, or every minute... or 5 - having an automatic save and not having to press ctrl+s is more efficient, and something he see's as an issue he would like to solve. Word processors have this feature and quite frankly, its saved my ass a few times. Whats wrong with him building this feature into notepad as well? As for my classmate... yes he needs to get his shit fixed. id suggest he remove windows 8 - however that was just an example of someone that could put a program like this to use. at least until he finds a solution. I doubt he specifically spend time building an app like this for his specific problem cause you're right, that would be kind of stupid. RE: how to instant save in notepad - ArkPhaze - 09-03-2013 (09-03-2013, 07:04 AM)Geoff Wrote:(09-03-2013, 04:29 AM)ArkPhaze Wrote: The solution is simple, press Ctrl + S more often. Why have another program saving every 2 seconds? If your OS is crashing every 3 minutes, then you have bigger problems to worry about than creating a program that does something like this. To think you need to create a program that will save things for you every 2 seconds just because an OS crashes every ~3 minutes is ridiculous. It would be like trying to use gum to fix a leak for the plumbing in your home. If that *was* the case, then fix your OS... It's the most logical thing here. "lol i why does one become a programmer? essentially to find solutions to repetitive problems that a computer can do for us." - Not by making the 1's and 0's do illogical tasks though. Without the full context, the way you said it is only partially correct. Understand that optimization, efficiency, the concept of logical belong to that sentence that you mangled as well... A programmer is a problem solver. And a smart problem solver would fix his computer first if that was *his* case.. With your logic, it makes just about as much sense as saying that we should get rid of all the water in the world so that people couldn't drown. -> Having an overkill interval on an autosave feature implemented by a program that saves notepad's data for you, because a computer crashes constantly; a *bandaid fix* as I call it. An (eventual to-be) good programmer, becomes a programmer not to create programs that will hog all the CPU and memory up. A good programmer is considerate of these things, and adapts to better solutions based on current knowledge of the end goal; a problem solver. That doesn't mean all programmers are good programmers... A programmer becomes one for many different reasons too, I don't see how you can generalize that for everybody quite honestly, so this is my opinion of a good programmer. Quote:Whether it be every 3 seconds, or every minute... or 5 - having an automatic save and not having to press ctrl+s is more efficient Where did you get that belief (in regards to the interval)? I can tell you that most autosave programs do not invoke to save the data every 2 seconds. Try 2, 3, 5, 10, or 15 minutes, depending on what is to be saved. I will give you the benefit of the doubt and assume that you are not a programmer though. 2 seconds is overkill. :S And efficient autosave mechanisms actually use activity and inactivity levels to their advantage to decide the best times to autosave so that they aren't saving the same data which had been unchanged for several minutes, for 2 second intervals each. This is the reason I provided a link to that function in my first post. He posted this in the "C, C++, Objective-C, and other C-based" forum. Just because Word processors have that feature doesn't mean you can invoke the autosave to happen every 2 seconds, or that you should. If I had an interval of every half second or every second, it doesn't make it that much better. And honestly, how much would you lose within a period of 2 seconds that would set you back far enough to be annoyed? And as a matter of fact, no word processor I've even seen autosaves every 2 seconds. I didn't say there was anything wrong with implementing autosave, but for the scenario YOU provided, it makes more sense to just fix whatever may be *broken* with your computer doesn't it? Any logic derived from common sense could dictate that. You fix the source of the problem first. Quote:id suggest he remove windows 8 lol, there's nothing wrong with Windows 8 just because he's having issues with it however. That's the kind of logic that I've seen from most uneducated computer users I've dealt with (to be brutally honest). They have issues with something and call it junk, even if the real issue is because they don't know how to work it properly. edit: If all he wanted was autosave, (and forget computer crashing issues in his case,) then perhaps he could find a notepad editor that came with an autosave feature. That would be my first suggestion. If he happens to find one, then there's no need for a *bandaid fix* like this to be created. Because you'd have to worry about always starting the autosave program everytime you open up notepad as well. And chances are if you have autosave in a program, it's already better than notepad. Notepad++ has this just as a mention: http://lifehacker.com/5303634/autosave-adds-reassurance-to-notepad%252B%252B-editing, and I would use Notepad++ over notepad anyday. None of this mickey mouse $h*t, and you've got something which is probably more reliable than invoking notepad to save for you, and in the end, a better editor. This doesn't have anything to do with being a programmer, this is just thinking with a bit of common sense. *shrugs* :S ~ArkPhaze RE: how to instant save in notepad - The Real Slim Shady - 09-03-2013 You seem to be going out of your way to twist what im saying. or at least confuse the fact that I am not the OP. the example i gave is completely unrelated to the goal of the OP. I have no idea what purpose the OP has for wanting an autosave every 3 seconds. I specified 3 seconds because that was the goal of the OP. Focus on the purpose of the supposed application, not an apparently bad example of someone putting it to use. As far as it being overkill... you're probably right. Thats not to say that a computer cannot do it. The interval in his goal might be excessive, but we really dont know what his goal is yet. Now you may consider 3 seconds to be illogical and abusive. As far as user efficiency goes though it makes sense to a user that his file get saved immediately after every change without needing to save it himself. As for windows 8, ive only met a handful of people with it, but most of the handful has some sort of issue. Have you not noticed a trend with Microsoft? every second operating system tends to have significant faults and hardware issues. Windows 95 was okay (for the time). windows 98 sucked, windows 98se was okay, windows ME sucked, windows XP was okay, windows vista sucked, windows 7 was okay, windows 8, so far, is living up to the pattern. So while removing windows 8 might seem "simplistic" to you, in this case he either needs to do that, or carry around an external wireless adapter for his laptop because his new laptop ships with integrated hardware who's latest drivers are apparently incompatible with windows 8. And it wasnt an upgrade, this laptop shipped with W8. Problem has been present since he bought it a couple months ago. So ya... i consider removing faulty software to be a good move. and theres nothing simplistic or basic about it. RE: how to instant save in notepad - devendra - 09-03-2013 (09-03-2013, 06:00 AM)1234hotmaster Wrote: Looks like i found the solution thanks you for your code by using this I'll make my way clear. |