Solved

How do I have Notepad++ autorun a macro?

Posted on 2012-04-12
9
3,045 Views
Last Modified: 2012-08-13
I have a macro created in Notepad++ (v6.1) and would like for it to autorun when Notepad++ is opened without manual intervention.  Is there a command line entry option whether via batch file of some sort of script?  My initial intent is to automate a find and replace via macro for a text file.  This would be added to a macro in Microsoft Access.  The Access macro would open a specified text file via Notepadd++ perform the designated find and replace, then close the text file (Notepadd++), then continue on with the next Access macro function.
0
Comment
Question by:wmb02
9 Comments
 
LVL 52

Expert Comment

by:Bill Prew
ID: 37848444
I am not aware of a way to do that automatically or from the command line.

You can use NppExec though to create a script, possibly doing what you need done, and then mark that script to run automatically when Notepad++ starts.  But it will of course run every time NPP starts, not just when called from Access.

~bp
0
 
LVL 8

Expert Comment

by:Wiesje
ID: 37848545
Using Autohotkey - you could have Autohotkey detect when Notepad++ starts and Autohotkey could ensure the script ran.

That's how I would go about it.

If you need help with setting up Autohotkey let me know.
0
 

Author Comment

by:wmb02
ID: 37875386
Wiesje,

Please provide additional information on Autohotkey and how I would use it.

Thanks,
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 8

Accepted Solution

by:
Wiesje earned 500 total points
ID: 37875433
First you will need to download Autohotkey from http://www.autohotkey.com/download/

When you have Autohotkey downloaded and installed - you will need to start an ahk file.

I will see if I can write a basic ahk file for you that will detect that Notepad++ has started.

What is it exactly that the script in Notepad++ does? And how do you start it up manually in Notepad++?

And if I've got it straight - in Access you have a script, that when run opens op Notepad++ and then you want it to run a script in Notepad++ that replaces text. The text that needs to be replaced and the text to replace - are they provided for in Access?

Why are you using Access for this? As in - what functionality does Access have that you need Notepad++ for?

Those were all my questions for now.
Here is a simple AHK script which detects if Notepad++.exe process has started up and pops up a message if it has.

#SingleInstance FORCE

; Detect Notepad++
Loop {
Process, Wait, Notepad++.exe
MsgBox Notepad++ has started
; ****** do stuff here with Notepad++ ****** 
; then close Notepadd++ and it will loop around and wait till it starts up again
Process, Close, Notepad++.exe
}

Open in new window


You will probably want to check that Access is running too - otherwise each time you run Notepad++ it will run this script.

But this is a start... I can continue helping when you've answered my questions above.
0
 

Author Comment

by:wmb02
ID: 38234362
Closed but not accepted.
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 38249584
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Laptop recommendation for CPA accountant 8 74
Rubik's Cube Code for Effective Presentation 3 41
Import filename in batch 2 25
Zavio B7510 5M manual download 2 14
When the confidentiality and security of your data is a must, trust the highly encrypted cloud fax portfolio used by 12 million businesses worldwide, including nearly half of the Fortune 500.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Where to go on the main page to find the job listings. How to apply to a job that you are interested in from the list that is featured on our Careers page.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now