Page 3 of 4

Posted: 06.03.2023 21:00
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.

Posted: 07.03.2023 09:50
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)

Re: External Tools plugin how-to?

Posted: 14.01.2024 19:11
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.

Re: External Tools plugin how-to?

Posted: 14.01.2024 20:31
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?

Re: External Tools plugin how-to?

Posted: 14.01.2024 20:46
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?

Re: External Tools plugin how-to?

Posted: 15.01.2024 03:43
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)

Re: External Tools plugin how-to?

Posted: 15.01.2024 09:04
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.

Re: External Tools plugin how-to?

Posted: 15.01.2024 11:56
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.

Re: External Tools plugin how-to?

Posted: 15.01.2024 16:18
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.

Re: External Tools plugin how-to?

Posted: 15.01.2024 17:16
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".