Run script or selection from Notepad++

Scripting and setups with Notepad++ and AutoHotkey.
User avatar
xMaxrayx
Posts: 136
Joined: 06 Dec 2022, 02:56
Contact:

Re: Run script or selection from Notepad++

Post by xMaxrayx » 06 Dec 2022, 03:13

Thanks, op I enjoy your code for ahk.v1 <3

---------------------------------------------------------------------

Anyone know how to make this script working for ahk.v2 ?

User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: Run script or selection from Notepad++

Post by boiler » 06 Dec 2022, 03:27

xMaxrayx wrote: Thanks, op I enjoy your code for ahk.v1 <3
Glad you like it!

xMaxrayx wrote: Anyone know how to make this script working for ahk.v2 ?
To run it using v2, it would have to be re-written. But once it’s run using v1, it should support your code in Notepad++ for whatever AHK version you have installed, just as if you double-clicked on a script file in File Explorer.

User avatar
xMaxrayx
Posts: 136
Joined: 06 Dec 2022, 02:56
Contact:

Re: Run script or selection from Notepad++

Post by xMaxrayx » 07 Dec 2022, 04:37

boiler wrote:
06 Dec 2022, 03:27
xMaxrayx wrote: Thanks, op I enjoy your code for ahk.v1 <3
Glad you like it!

xMaxrayx wrote: Anyone know how to make this script working for ahk.v2 ?
To run it using v2, it would have to be re-written. But once it’s run using v1, it should support your code in Notepad++ for whatever AHK version you have installed, just as if you double-clicked on a script file in File Explorer.
yeah really was save timer script thx<3,

I have both AHK v1 and v2 installed on my computer but I got this ERROR:

---------------------------
Selected Text - 505228453
---------------------------
Error at line 1.

This script requires AutoHotkey v2.0-beta.

Current interpreter: AutoHotkey v1.1.36.01 Unicode 64-bit
C:\Program Files\AutoHotkey\v1.1.36.01\AutoHotkeyU64.exe

The program will exit.
---------------------------
OK
---------------------------


this is the code I want it to run :

#Requires AutoHotkey v2.0-beta

LWin::
{
Return
return
}

LWin & F1::
{
MsgBox("Hello world")
return
}

User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: Run script or selection from Notepad++

Post by boiler » 07 Dec 2022, 04:57

What happens when you double-click on a script file written in v2 in File Explorer?

User avatar
xMaxrayx
Posts: 136
Joined: 06 Dec 2022, 02:56
Contact:

Re: Run script or selection from Notepad++

Post by xMaxrayx » 07 Dec 2022, 05:13

boiler wrote:
07 Dec 2022, 04:57
What happens when you double-click on a script file written in v2 in File Explorer?
it will run normally in AHKv2 without any problems,

I updated my code since there is a problem with disabling the windows key xD

new code X.X

#Requires AutoHotkey v2.0-beta


LWin & F1::
{
MsgBox("Hello world")
return
}

User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: Run script or selection from Notepad++

Post by boiler » 07 Dec 2022, 05:29

v2 needs to be the default installation. If you have v1 installed first and that approach that lexikos implemented for it to know which one to use is relied on to automatically pick v2 for v2 scripts, then this won’t work.

User avatar
xMaxrayx
Posts: 136
Joined: 06 Dec 2022, 02:56
Contact:

Re: Run script or selection from Notepad++

Post by xMaxrayx » 07 Dec 2022, 11:39

boiler wrote:
07 Dec 2022, 05:29
v2 needs to be the default installation. If you have v1 installed first and that approach that lexikos implemented for it to know which one to use is relied on to automatically pick v2 for v2 scripts, then this won’t work.
Ah, I uninstalled both AHK v1 and AHK v2 then installed AHK v2 and I got this wired message

---------------------------
AutoHotkey
---------------------------
It looks like the script you are trying to run requires AutoHotkey v1, which is not installed.

Script: RunScript_Notepad++.ahk
Rule: v1-cmd v1-def

We can try to download and install AutoHotkey v1.1.36.02 for you, while retaining the ability to use the versions already installed.

Download and install AutoHotkey v1.1.36.02?
---------------------------
Yes No
---------------------------



idk why I got this error ? my AHK version is AutoHotkey_2.0-rc.2

my code work fine in explorer fine :\

#Requires AutoHotkey v2.0-beta


LWin & F1::
{
MsgBox("Hello world")
return
}

User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: Run script or selection from Notepad++

Post by boiler » 07 Dec 2022, 13:22

That's because the script of mine your running is written in v1. You have to run that using v1, but if you want it to work on v2 script files (that's different than running the tool itself), then it needs to find the v2 binary file as the default one.

You can run a v1 file without having it as the primary installation by dropping the script on a v1 binary. Or you can compile my into an exe with v1, then you have an exe file of it that doesn't care what you have installed.

Dodixon
Posts: 1
Joined: 10 Dec 2022, 13:02

Re: Run script or selection from Notepad++

Post by Dodixon » 10 Dec 2022, 13:21

xMaxrayx wrote:
07 Dec 2022, 04:37
boiler wrote:
06 Dec 2022, 03:27
xMaxrayx wrote: Thanks, op I enjoy your code for ahk.v1 <3
Glad you like it!

xMaxrayx wrote: Anyone know how to make this script working for ahk.v2 ?
To run it using v2, it would have to be re-written. But once it’s run using v1, it should support your code in Notepad++ for whatever AHK version you have installed, just as if you double-clicked on a script file in File Explorer.
yeah really was save timer script thx<3,

I have both AHK v1 and v2 installed on my computer but I got this ERROR:

---------------------------
Selected Text - 505228453
---------------------------
Error at line 1.

This script requires AutoHotkey v2.0-beta.

Current interpreter: AutoHotkey v1.1.36.01 Unicode 64-bit
C:\Program Files\AutoHotkey\v1.1.36.01\AutoHotkeyU64.exe

The program will exit.
---------------------------
OK
---------------------------


this is the code I want it to run :

#Requires AutoHotkey v2.0-beta

LWin::
{
Return
return
}

LWin & F1::
{
MsgBox("Hello world")
return
}
You're obviously doing something wrong.
1. Run the autohotkey application itself, go to settings and change the auto detection option from automatic to v2.
2. You can also left click and you can run the script with another application then you are looking for the right autohotkey version.

User avatar
josephthom12
Posts: 5
Joined: 21 May 2023, 18:55

Re: Run script or selection from Notepad++

Post by josephthom12 » 22 May 2023, 13:26

Has this issue been fixed?

divanebaba said
You're obviously doing something wrong.
1. Run the autohotkey application itself, go to settings and change the auto detection option from automatic to v2.
2. You can also left click and you can run the script with another application then you are looking for the right autohotkey version.
All Autohotkey V2 functions do not work when I try to run inside of Notepad++ . The error messages indicate that I can't or don't understand exactly what's going on. Or there's an issue with setup? Both AhkV1-V2 are installed. I followed the editor (setup by jNizM GitHub) As divanebaba said I used the editor settings to automatically default all scripts V2.
Image

Script

Code: Select all

#Requires AutoHotkey v2.0
#Warn
#SingleInstance

#Include "WiseGui.ahk"


WiseGui("unnamed")
Sleep(3000)
WiseGui("unnamed")
I'm trying to use the custom toast function by SKAN. his functions work outside of Notepad++. I can run them inside Notepad++. Its throwing errors. viewtopic.php?f=83&t=94044&sid=048d32d0b2e10b807f18ff6f61d49fe0

User avatar
josephthom12
Posts: 5
Joined: 21 May 2023, 18:55

Re: Run script or selection from Notepad++

Post by josephthom12 » 23 May 2023, 07:34

Sorry for the repeat post. I want to be specific for noobs like me so we don't have waste time. The Dynamic Run Script Selection plugin by boiler and the RunMe GitHub - francostellari/NppPlugins ONLY execute using Autohotkey Version 1? Assume there are no script errors. Just so we're on the same page. Press this button.
Image

Anything that requires V1 is ok. Confirmation please. I missed something.

Otherwise for V2 you need to use a different compatible IDE. Visual Studio, Adventure IDE, SciTE4AHK AhkStudio, JetBrains IDE. CodeQuickTester or Sublime Text. They all debug & compile V1&V2 with no issues.

User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: Run script or selection from Notepad++

Post by boiler » 23 May 2023, 08:35

josephthom12 wrote:
23 May 2023, 07:34
Sorry for the repeat post. I want to be specific for noobs like me so we don't have waste time. The Dynamic Run Script Selection plugin by boiler and the RunMe GitHub - francostellari/NppPlugins ONLY execute using Autohotkey Version 1?.
Regarding the Notepad++ tool I posted, it was written in v1, so it needs v1 to execute, but it should run v2 scripts if your machine is set up for them. If you don’t want to have both v1 and v2 installed, you should be able to compile the tool using v1 and use its executable when implementing it as a plugin to Notepad++ even without v1 installed.

Post Reply

Return to “Notepad++”