External Tools plugin how-to?

Plugins for SynWrite and CudaText...
qwerky
Posts: 172
Joined: 21.10.2013 00:58

Post by qwerky »

Thanks for the assistance.

The AHK help file contains a sample script which is a very simple text editor. It uses the edit control (I wonder whether that is a native Windows control?). My simple viewer is based on that sample script, and also used the edit control, in read-only mode. It is adequate, though I wish there were a way to hide the caret, and have the arrow keys actually scroll the text up/down/left/right, without having to first move the caret to the top/bottom/left/right of the window. I also wish there were a way to have the horizontal scroll bar appear only when required, such as when the window is resized.

Looking at Scratchpad, it also uses the edit control, though it is a much more complete product than that sample script. I'm sure there's things there for me to learn from.
Stefan
Posts: 112
Joined: 06.10.2012 15:06

Post by Stefan »

qwerky wrote:... hide the caret, and have the arrow keys actually scroll the text ...
All legit requests. The ahk forum is a good hunting-ground for helpful answers.
Good luck and have fun! (I am sure you will, using CudaText as your code editor)
Stem75
Posts: 55
Joined: 09.01.2024 15:29

Re: External Tools plugin how-to?

Post by Stem75 »

I have set external tools for Autohotkey like this:

Name; AutoHotkeyU64
File name: path to\AutoHotkeyU64

Parameters: {ContentAsTemp}

Test it and it works fine. It executes all the .ahk files and even the not saved text from the editor.



Now for the CMD i am setting it like this:

Name; CMD
File name: path to\cmd

Parameters: {ContentAsTemp}

Basically the same,
but it only opens the CMD window with the path where the file is in.

I also tried all the File... like {FileNameOnly} and other such as {SelectedText}
but i can't make it work.

I need some help.
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Re: External Tools plugin how-to?

Post by main Alexey »

You did not specify other params?
For CMD (Windows) you need param /c or /k.
e.g. "cmd /c myfile.cmd".
https://learn.microsoft.com/en-us/windo ... mmands/cmd
Does it help?
Stem75
Posts: 55
Joined: 09.01.2024 15:29

Re: External Tools plugin how-to?

Post by Stem75 »

A lot. Thank you.

I added like this /c {ContentAsTemp} and it runs an already saved test.bat file.
Is there a way to run with a new unsaved file?
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Re: External Tools plugin how-to?

Post by main Alexey »

Try to do quotes + add extension .cmd:
cmd /c "{ContentAsTemp}.cmd"

Try to see the resulting command line like this:
echo cmd /c "{ContentAsTemp}.cmd"
(must be used with "[x] Shell" option)
Stem75
Posts: 55
Joined: 09.01.2024 15:29

Re: External Tools plugin how-to?

Post by Stem75 »

with existing saved file as .bat

[] shell command

Parameters: /c {ContentAsTemp}

Capture output [ignore]

It works and opens the windows command window.


with unsaved file and selected text (without its not working)

[x] shell command

Parameters: /c {SelectedText}

Capture output [output panel]

It works but it shows only the first line and only the output panel, it doesn't open
the windows command window.

If anyone has a better way please tell.
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Re: External Tools plugin how-to?

Post by main Alexey »

>[x] shell command
>Parameters: /c {SelectedText}
In this case the command CMD is run with parameters like:

cmd /c text_line1<EOL>text_line2<EOL>text_line3

it is not good for CMD.
So this macro {SelectedText} is not ok here.
macro {ContentAsTemp} should be OK in all cases: named file, unnamed tab.
Stem75
Posts: 55
Joined: 09.01.2024 15:29

Re: External Tools plugin how-to?

Post by Stem75 »

First of all thanks for replying.

I don't want to bother you or anybody else with my stupid questions
because of my ignorance, but i cant understand how it works sorry. (poor to no programming knowledge).
On the other hand all this might be informative for other newbies like me with the program.

Here are some examples of what i am trying (based on your suggestions).
Hint: replace - with \ and _ with . for the paths. Tried quote and code but it blocks me.

For New tab unsaved with untitled1 as name

Text in editor:

echo Line one
echo Line two
pause

1 --------------------------------------------------------------

File name: C:-Windows-System32-cmd_exe

[x] shell command

Parameters: cmd /c {ContentAsTemp}

Capture output [output panel]

[output panel] results
'C:-___TEMP-cudatext-.text1.' is not recognized as an internal or external command,
operable program or batch file.

2 --------------------------------------------------------------

File name: C:-Windows-System32-cmd_exe

[] shell command

Parameters: cmd /c {ContentAsTemp}

Capture output [output panel]

[output panel] results
'C:-___TEMP-cudatext-.text1.' is not recognized as an internal or external command,
operable program or batch file.

3 --------------------------------------------------------------

File name: C:-Windows-System32-cmd_exe

[x] or [] shell command

Parameters: cmd /c {ContentAsTemp}

Capture output [ignore]

The windows CMD window opens and closes very fast. (don't know what it shows)

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

if i add Parameters: cmd /c {ContentAsTemp}.bat it shows 'C-___TEMP-cudatext-.text1..bat'
if i add Parameters: cmd /c {ContentAsTemp}bat it shows 'C-___TEMP-cudatext-.text1.bat'

##############################################################
##############################################################
##############################################################
##############################################################


With tab saved (opened outside as test.bat file)

Text in editor(file):

echo Line one
echo Line two
pause


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

File name: C:-Windows-System32-cmd_exe

[] shell command

Parameters: cmd /c {ContentAsTemp}

Capture output [ignore]



The windows CMD window opens and displays this (the same as if i was running the .bat file with double click)

C:-Users-Stem75-Desktop>echo Line one
Line one

C:-Users-Stem75-Desktop>echo Line two
Line two

C:-Users-Stem75-Desktop>pause
Press any key to continue . . .



Be alert. More questions are coming.
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Re: External Tools plugin how-to?

Post by main Alexey »

Parameters: cmd /c {ContentAsTemp}
[output panel] results
'C:-___TEMP-cudatext-.text1.' is not recognized as an internal or external command
Because CMD wants that file has .cmd or .bat extension, and you have it with empty extension. So try:

Parameters: cmd /c {ContentAsTemp}.cmd

with ending ".cmd" or w/o dot "cmd".
Post Reply