AutoHotkey Community

It is currently May 26th, 2012, 5:12 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: January 31st, 2008, 9:25 pm 
Offline

Joined: April 30th, 2006, 6:23 pm
Posts: 358
Location: Shigle Springs
I lost a full days work yesterday! :shock: :twisted: :twisted: :evil: :evil:

So here is my first public script to fix that!
8)
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
Computer Repair Computer Service.com
911PCFIX.com


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Autosave
PostPosted: October 31st, 2008, 2:50 pm 
How do we apply your script to notepad++


Report this post
Top
  
Reply with quote  
 Post subject: Re: Autosave
PostPosted: October 31st, 2008, 3:25 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 28th, 2009, 4:42 pm 
Can this script be used on other software also?
If so what do I need to change?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 7th, 2009, 1:59 am 
Offline

Joined: April 30th, 2006, 6:23 pm
Posts: 358
Location: Shigle Springs
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
Computer Repair Computer Service.com
911PCFIX.com


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Autosave
PostPosted: April 3rd, 2009, 8:51 am 
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 :) :) :)


Report this post
Top
  
Reply with quote  
 Post subject: Plugin for Notepad++
PostPosted: May 1st, 2009, 12:58 pm 
nice script but notepad++ also has a plugin for that

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


Report this post
Top
  
Reply with quote  
 Post subject: Re: Plugin for Notepad++
PostPosted: August 4th, 2009, 9:16 pm 
Offline

Joined: July 20th, 2008, 7:53 am
Posts: 2
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!


Report this post
Top
 Profile  
Reply with quote  
 Post subject: How to run the script
PostPosted: October 17th, 2010, 6:16 am 
Deep and Guest:

I was wondering the same thing you were. I didn't recognize this scripting language, saw no comment on what it was and didn't know Notepad++ could read scripts like these.

Well, the thing is:

AutoHotKey IS a scripting language. This whole website is about writing scripts for a script engine called AutoHotkey, which you can download and install.

It lets you take control of windows and text input, and seems very handy, so I think I'll download it and write something with it myself.

But that solves the mystery for those of us who were searching for an answer about Notepad++ anyway:

This is a script which you can run in AutoHotkey, to automatically enter the "save all" keyboard-shortcut into the Notepad++ window ever so often.


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 11 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group