AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Notepad++ autosave and launch

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
DeWild1



Joined: 30 Apr 2006
Posts: 314
Location: Shigle Springs

PostPosted: Thu Jan 31, 2008 8:25 pm    Post subject: Notepad++ autosave and launch Reply with quote

I lost a full days work yesterday! Shocked Twisted Evil Twisted Evil Evil or Very Mad Evil or Very Mad

So here is my first public script to fix that!
Cool
Code:

/*
Notepad++ autosave and launch
If notepad++ is active, and you have not touched the keyboard or mouse for 5 sec, it saves all.
Then, it checks to see if there has been no activity for 15 min, if notepad++ is still runing, even if it is not active, it brings it to the front and saves.. (lunch time) :-)
*/
DetectHiddenText, On
SetTitleMatchMode, 2
SetBatchLines -1
#SingleInstance ignore
#WinActivateForce


#notrayicon
;if notepad++ is not running
   process, exist, notepad++.exe
   If ! errorLevel
      {
      run, %A_ProgramFiles%\Notepad++\Notepad++.exe
      }
sleep, 60000

dome:
loop, 45 ;after 7.5 min,
{
sleep, 10000
if A_TimeIdlePhysical > 5000 ;after at least 5 sec of not doing anything and if notepad++ is currently active
   {
   If WinActive("ahk_class Notepad++")
      {
      blockinput, On
      send, {Control Down}{Shift Down}s{Control Up}{Shift Up} ;save all
      Blockinput, off
      }
      
   process, exist, notepad++.exe
   If ! errorLevel
      {
      exitapp ;if not running, exit
      }
   }
}
if A_TimeIdlePhysical > 900000 ;if idle time more than 15 min, then force it to activate and then save.
{
winactivate ("ahk_class Notepad++")
sleep, 1000
blockinput, On
send, {Control Down}{Shift Down}s{Control Up}{Shift Up} ;save all
Blockinput, off
goto, dome
}
goto, dome

---edit added blockinput
_________________
CPULOCK.com
virusSWAT.com
GuaranteedPCFIX.com
911PCFIX.com
Back to top
View user's profile Send private message Visit poster's website
Deep
Guest





PostPosted: Fri Oct 31, 2008 1:50 pm    Post subject: Autosave Reply with quote

How do we apply your script to notepad++
Back to top
Guest






PostPosted: Fri Oct 31, 2008 2:25 pm    Post subject: Re: Autosave Reply with quote

Deep wrote:
How do we apply your script to notepad++

Just run the script. After a period of inactivity (keyboard/mouse) it will automatically save your files.

If you start the script and notepad++ is not running, it will start it (provided it is located at %A_ProgramFiles%\Notepad++\Notepad++.exe). If you exit notepad++, the script will also exit.
Back to top
RoutnAbout
Guest





PostPosted: Sat Feb 28, 2009 3:42 pm    Post subject: Reply with quote

Can this script be used on other software also?
If so what do I need to change?
Back to top
DeWild1



Joined: 30 Apr 2006
Posts: 314
Location: Shigle Springs

PostPosted: Sat Mar 07, 2009 12:59 am    Post subject: Reply with quote

RoutnAbout wrote:
Can this script be used on other software also?
If so what do I need to change?

Just find out what keys you need it to work with by Doing ALT on your keyboard then just use the keys to find out the sequence and use Windows Spy to find out the title and stuff.
_________________
CPULOCK.com
virusSWAT.com
GuaranteedPCFIX.com
911PCFIX.com
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Fri Apr 03, 2009 7:51 am    Post subject: Re: Autosave Reply with quote

Anonymous wrote:
Deep wrote:
How do we apply your script to notepad++

Just run the script. After a period of inactivity (keyboard/mouse) it will automatically save your files.

If you start the script and notepad++ is not running, it will start it (provided it is located at %A_ProgramFiles%\Notepad++\Notepad++.exe). If you exit notepad++, the script will also exit.



I use notepad++ for a statistical software package and would like to adopt your code. But I know nothing about real programming. Where should I run your script? Could you give me some detailed instructions? I use window XP.

Many thanks Smile Smile Smile
Back to top
mike2009
Guest





PostPosted: Fri May 01, 2009 11:58 am    Post subject: Plugin for Notepad++ Reply with quote

nice script but notepad++ also has a plugin for that

check
http://fstellari.googlepages.com/npp_plugins
Back to top
chinkaling



Joined: 20 Jul 2008
Posts: 2

PostPosted: Tue Aug 04, 2009 8:16 pm    Post subject: Re: Plugin for Notepad++ Reply with quote

mike2009 wrote:
nice script but notepad++ also has a plugin for that

check
http://fstellari.googlepages.com/npp_plugins

Nice try, but that plugin's smallest time interval is 1 minute. That's completely useless to me, and many others who are concerned about losing a huge sum of data between 60 seconds... This script [with slight modifications for my purposes at least] is the perfect solution for that.

Great job on your first public script, DeWild1!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group