Jump to content

How to launch an au3 script from Notepad++


gsx
 Share

Recommended Posts

Hi there,

I'm trying to run an autoit script from Notepad++ v5.4.5.

1-1. I saved the following code as notepad.au3

Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Send("Hello World")

1-2.

a. When I press F5 and press 'Run!', nothing happens.

b. When I press F5, type '"$(FULL_CURRENT_PATH)"', and press 'Run!', it is opened by SciTE4AutoIt3.

c. When I press F6 and press OK, nothing happens.

2-1. I saved the above code as notepad.txt

2-2.

a. When I press F5 and press 'Run!', nothing happens.

b. When I press F5, type '"$(FULL_CURRENT_PATH)"', and press 'Run!', it is opened by Notepad.

c. When I press F6 and press OK, nothing happens.

3. When I double click notepad.au3 from Explorer, the script runs and echos 'Hello World.'

I'd like to see the script start running when I hit F5 in Notepad++. So does anybody know how?

Edited by gsx
Link to comment
Share on other sites

1) Press F5 to bring up the Run Dialog.

2) Type the correct path to AutoIt3.exe::

$(sys.PROGRAMFILES)\AutoIt3\AutoIt3.exe $(FULL_CURRENT_PATH) $(ARGV)

3)Click the save button in the dialog, this should bring up anotherwindow in which you name your menu item + set the shortcut keys for it.

4) Click ok, now the item should be added to the Run Menu for easy invocation.

If you are using the Exec (F6) ability of Npp, Put the same line of code into the command(s) edit box, click save and name the internal script to Au3Exec (or similar).

Now when you press (F6) you can choose your script from the combo box, or preferably you can open the Npp console and type:

NPP_EXEC Au3Exec

or

NPP_EXEC Au3Exec arg1 arg2 arg3 etc...
Edited by Mobius

wtfpl-badge-1.png

Link to comment
Share on other sites

Thank you for the reply.

When I pressed F6, typed the following path, and pressed OK, I got an error.

$(sys.PROGRAMFILES)\AutoIt3\AutoIt3.exe $(FULL_CURRENT_PATH)

AutoIt Error
Line 0  (File "C:\Documents"):
Error: Error opening the file.

So, I tried the path to have quotation marks and it worked. Thank you so much.

$(sys.PROGRAMFILES)\AutoIt3\AutoIt3.exe "$(FULL_CURRENT_PATH)"

However, when I do it from F5, nothing happens. I tried the following four lines for F5,

$(sys.PROGRAMFILES)\AutoIt3\AutoIt3.exe $(FULL_CURRENT_PATH)

$(sys.PROGRAMFILES)\AutoIt3\AutoIt3.exe "$(FULL_CURRENT_PATH)"

C:\Program Files\AutoIt3\AutoIt3.exe $(FULL_CURRENT_PATH)

C:\Program Files\AutoIt3\AutoIt3.exe "$(FULL_CURRENT_PATH)"

Just for now, I'll go with the F6 solution, but if anybody knows what I should do with F5 please let me know.

Edit:

the following line worked for F5. Thanks.

"C:\Program Files\AutoIt3\AutoIt3.exe" "$(FULL_CURRENT_PATH)"
Edited by gsx
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...