Page 1 of 1

AutoIT CudaLint help

Posted: 13.11.2024 16:20
by sl23
Hi, I tried installing the plugins to help with AutoIT. I am only learning the language and would prefer to use CudaText over SCiTe4AutoIT.

After installing the plugins, I first tried the Linter for AutoIT, which request the path to Au3Check.exe.
I think I found the correct file to edit:
D:\SyMenu\ProgramFiles\SPSSuite\SyMenuSuite\CudaText_(x64)_sps\py\cuda_lint_autoit\linter.py
The current code for this appears to be:

Code: Select all

cmd = 'Au3Check -q -I'
But as I need the full path, I am assuming I put the full path here? So I tried that and got:

Code: Select all

cmd = '"D:\SyMenu - Other\ProgramFiles\MyApps\X-SciTE4AutoIt3\Bin\3.3.16.1\Au3Check.exe" -q -I'
Is that correct?

I then opened the bottom panel and found that I am getting errors:

Code: Select all

ERROR: Cannot find data: D:\SyMenu\ProgramFiles\SPSSuite\SyMenuSuite\CudaText_(x64)_sps\data\toolbaricons\Fugue_16x16
Python 3.8.19
Init: cuda_config_toolbar
Loading toolbar config (0ms)
Init: cuda_lint
Init: cuda_project_man
ERROR: autoit cannot locate "D:\SyMenu - Other\ProgramFiles\MyApps\X-SciTE4AutoIt3\Bin.3.16.1\Au3Check.exe"
ERROR: autoit cannot locate "D:\SyMenu - Other\ProgramFiles\MyApps\X-SciTE4AutoIt3\Bin.3.16.1\Au3Check.exe"
Loaded session: "history session.json", 90ms, 8 file(s)
First, I have no idea why the error appears for the toolbar icons as they are all showing correctly.

Now, about the path to Au3Check.exe...
Why is the path missing two characters? It should be:
D:\SyMenu - Other\ProgramFiles\MyApps\X-SciTE4AutoIt3\Bin\3.3.16.1\Au3Check.exe
But I am getting:
D:\SyMenu - Other\ProgramFiles\MyApps\X-SciTE4AutoIt3\Bin.3.16.1\Au3Check.exe

Notice that after the folder 'Bin' I am missing '\3' in the file path for some reason, even though it is specified in the linter.py!

Here is the full code of that linter:

Code: Select all

"""This module exports the AutoIt plugin class."""

from cuda_lint import Linter, util
import os


class AutoIt(Linter):
    """Provides an interface to Au3Check.exe."""

    cmd = '"D:\SyMenu - Other\ProgramFiles\MyApps\X-SciTE4AutoIt3\Bin\3.3.16.1\Au3Check.exe" -q -I'
    syntax = 'AutoIt'
    tempfile_suffix = 'au3'

    # "D:\Test\File.au3"(38,5) : error: asda(): undefined function.

    regex = r'"(?P<match>.*)"\((?P<line>\d+),(?P<col>\d+)\)\s:\s(?P<type>.*?):\s(?P<message>.*)'
    error_stream = util.STREAM_STDOUT


    def split_match(self, match):
        """Return the components of the error."""
        split_match = super(AutoIt, self).split_match(match)
        match, line, col, error, warning, message, near = split_match
        message = '{} (Col {})'.format(message, col)

        if match and match.group('type') == 'error':
            error = 1
            message = 'Error: ' + message
        elif match and match.group('type') == 'warning':
            warning = 1
            message = 'Warning: ' + message

        return match, line, col, error, warning, message, ''


    def run(self, cmd, code):
        """Overwrite linter function for adding include dir parameter."""
        cmd.append(os.path.dirname(self.filename))
        return self.tmpfile(cmd, code, suffix=self.get_tempfile_suffix())
Any idea what's wrong? It's likely my fault. Maybe I have the wrong file, entered the path in the wrong place, or something else, but the instructions weren't too clear on what to do. At least not for a complete novice to this stuff! :oops:

I am also getting problems with the other AutoIT plugins, but I'll get this sorted first.

Thanks for your help. :D

Re: AutoIT CudaLint help

Posted: 13.11.2024 19:45
by main Alexey
What you can try

1. add path to AutoIT checker .exe file to OS PATH (in the OS control panel).
2. if you still write full path - must ESCAPE backslashes!!! you did not. make each '\' char doubled.
2b. i am not sure the full quoted path will be supported, did not test. you can fix the full path using Windows SHORT filename. and then remove quotes. maybe OS File Properties dlg shows short path to copy it? FarManager program allowed to copy short path to clpbd.

method 2 is bad anyway. because you edited .py file and each addon update will RESET your change.
method 1 is ok?

3. maybe you only need to add ".exe" to linter.py? if so I will fix it for unix+windows.
cmd = 'Au3Check.exe -q -I'

Re: AutoIT CudaLint help

Posted: 13.11.2024 20:52
by sl23
Thanks for your reply.

Sorry, my lack of knowledge on this is making it hard to understand.
1. I don't know what you mean by add path to OS PATH. Where is that? What is that? Do you mean use a shortcut file where AutoIt is normally installed and point it to where it is now?
2. Okay I'll reset it back to default.
2b. No idea what short path is. Do you mean the 8.3 type? Quotes are required if there are spaces in a path name aren't they? The backslash should be treated as a string as it's enclosed in quotes, yes?
3. I doubt this will work as I am using the portable version of AutoIT/SCiTe so they are not installed. It's unlikely the plugin will find the checker exe.

This is the brief instruction that came with the plugin:
Linter for CudaLint plugin.
It adds support for AutoIt lexer.
It uses "Au3Check.exe -q".

If Au3Check.exe is not in PATH change the line
cmd = 'Au3Check -q'
in linter.py to the correct path.

Or create file "Au3Check.cmd" in any dir of PATH which contains the correct path:

"P:/Portable/AutoIt3/Au3Check.exe" %1 %2 %3 %4 %5 %6 %7 %8 %9

Author: Tom Braider
It says about creating a CMD file with the path, but I'm not sure how to do this or where I should place that file.
For example, what are the %1, %2, %3, etc, for?

Re: AutoIT CudaLint help

Posted: 14.11.2024 03:22
by main Alexey
>I don't know what you mean by add path to OS PATH. Where is that?
Windows has PATH variable.
https://stackoverflow.com/questions/442 ... -screensho
https://windowsloop.com/how-to-add-to-windows-path/
https://www.shellhacks.com/windows-cmd- ... echo-path/
you can find the same info about Windows7 if you use win7.

if program is placed in dir which is in OS PATH,
in the CMD prompt, enter "Au3Check" [Enter]. program must run. w/out full path.
>Do you mean use a shortcut
no. shortcut is not adding to PATH.
>No idea what short path is. Do you mean the 8.3 type?
yes, 8.3.
>Quotes are required if there are spaces in a path name aren't they?
yes. for 8.3 path, path has NO spaces so for 8.3 path you dont need quotes.
>The backslash should be treated as a string as it's enclosed in quotes, yes?
no. in python, backslash must be doubled. ie escaped.

Code: Select all

  cmd = 'c:\\Progra~1\\AutoIt3\\Au3Check.exe  -q -I'
this is some 8.3 path.

>For example, what are the %1, %2, %3, etc, for?
it is special CMD things. write it like shown in readme, only replace full path

"P:/Portable/AutoIt3/Au3Check.exe" %1 %2 %3 %4 %5 %6 %7 %8 %9

here is full path is P:/Portable/AutoIt3, so replace it to your full path.
keep %1 %2 etc.

Re: AutoIT CudaLint help

Posted: 14.11.2024 09:31
by sl23
Ok, so this is telling you to create a new Windows system environment variable.
Thank you

Re: AutoIT CudaLint help

Posted: 14.11.2024 10:29
by main Alexey
not creating, but using the existing PATH variable.
it always exists.
it has N folders with ';' separator (AFAIR).