Jump to content

Recommended Posts

Posted (edited)

Hi,

I am trying to work with an artificial intelligence to help me write faster some scrpits. Here is the website https://chat.openai.com/chat

apparently it's a pretty fast learning machine but it seems to make basic mistakes. 

Please note that I don't need help to wite the code it self. I'm just trying some basics tests wit AI and it fells it.

So let's say I ask "write me an autoit script that converts a csv file into a 2d array and display the array. Here is the path of the csv file "C:\Users\Utilisateur\Downloads\ here is the name of the csv file 20221229.csv"

It will give e the following code : 

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

# Read the CSV file into a string
$fileContents = FileRead("C:\Users\Utilisateur\Downloads\20221229.csv")

# Split the string into lines
$lines = StringSplit($fileContents, @LF)

# Initialize the 2D array
$csvData = []

# Iterate through each line
For $i = 0 To UBound($lines) - 1
  # Split the line into fields
  $fields = StringSplit($lines[$i], ",")

  # Add the fields to the 2D array
  ReDim $csvData[$i][UBound($fields)]
  For $j = 0 To UBound($fields) - 1
    $csvData[$i][$j] = $fields[$j]
  Next
Next

# Display the array
For $i = 1 To UBound($csvData) - 1
  For $j = 1 To UBound($csvData[$i]) - 1
    ConsoleWrite($csvData[$i][$j] & " ")
  Next
  ConsoleWriteLine("")
Next




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

 

when I run it, it gives me that $csvData = [] is a syntax error. I argue with the AI and it tells me it's a correct syntax.

 

Is there a way that I can access to all the datas of functions that were made in pdf or text files, (i know it's gonna be 1000 of pages but it's a fast learner!))  send it to the AI so it can learn correclty?

 

Edited by Jos
added codebox... please use <> next time.
  • Developers
Posted

Moved to the appropriate AutoIt General Help and Support forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted
On 12/29/2022 at 9:38 PM, MathieuLap said:

send it to the AI so it can learn correclty?

The openAI chat AI does not learn from all interactions, past the current conversation, without gbeing handpicked by the developers, if their FAQ page is anything to go by.
Also, i've played with the AI for a few days and it does seem to understand AutoIt functions fine. What is the biggest issue with the AI and AutoIt seems to be the way it thinks AutoIt array works (JS like arrays with push, and such methods on the array object).

If you can make it understand that the array are a fixed length and cannot be accessed via method calls on the array variable itself, your results will get a lot more plug and play like.

 

But i don't see that as anything worth spending time on, honestly. The AI is fine for HOW you COULD approach a problem, but you should not expect it to produce code that will run without issues, for it is not what the CHAT AI was designed for.

My thoughts anyways....

Posted

ChatGPT is advanced autocorrect, and isn't particularly concerned with the correctness of its response. It's focus seems to be on "sounding" as human-like as possible, using natural language, not fact-checking its output.
It's not very useful for coding IMO, unless you're using something very popular like Python and your problem is something for which there are ample examples and solutions in the dataset that ChatGPT has been trained on. I've tried using it with AutoIt and it keeps making up libraries and functions that don't exist. It does the same for Python as well, but slightly less often. Even for python snippets, errors aren't uncommon.

I've found ChatGPT to be useful for pseudocode generation (describe the problem and ask the chatbot to respond in pseudocode) because the particular details of language use etc are abstracted away. I've also found it somewhat useful for refactoring existing code snippets, when I want to clean up a function, use SESE or single responsibility to trim spaghetti code etc.

  • 2 years later...
Posted

I using Cursor.sh to create fast scripts 
If you want to use it you must specify in .cursorrules you are working on Autoit script
in settings/Docs you should add Autoit documentation for better results

image.thumb.png.96e7da751f90506a8722b17dd56718a6.png

  • Moderators
Posted

arlinamid,

Please read the forum rules before you post again.

As the image only shows a partial script, I see no need to do more than that.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

Sorry I'm newbie In the forum

So.  .cursorrules  it's specific file format Cursor uses as Main/system  prompt it should be placed into project root
You can define the AI model howto response.  
This is mine but you can edit it.
 

Role
You are an AutoIt Script Engineer (Windows automation, GUI apps, COM, WinAPI, file/window control, reliable tool-building).

Action

Understand the task and proactively clarify any gaps.

Write AutoIt v3-compatible, robust, well-commented code (with UDFs where helpful).

Build an event-driven GUI with status indicators and logging.

Implement solid error handling (@error/@extended), return codes, and graceful cleanup.

When needed: COM automation (Excel/Word), WinAPI calls, image-based detection (PixelSearch/ImageSearch UDF), window/process control.

Provide self-tests per major function and basic timing/metrics.

Include build/run instructions and config tips.


Steps

Requirements summary → inputs/outputs, target OS (Win10/11), permissions.

Design → modules, UDFs (#include), GUI flow, logging strategy.

Implementation → clear #Region/#EndRegion blocks, consistent naming ($g_s, $a, Func PascalCase).

Error handling → guards, fallbacks, resource disposal.

Tests → function self-tests, synthetic data, edge cases.

Performance → tuned sleeps, correct WinWait/Control* usage.

Documentation → README (run, params, known limits), changelog.

Release → Aut2Exe build options, versioning, code-sign/AV false positive tips.

Context

Typical use-cases: desktop automation (form fill, buttons), stable GUI bots, Excel report generation, screen-based detection (icons, buttons, coordinates).

Environment: Windows 10/11 x64, AutoIt v3 + SciTE; optional external UDFs (e.g., ImageSearch.au3; if unavailable, provide PixelSearch+tolerance alternative).

Non-goal: brittle fixed-delay scripts; prefer state-driven and window-control-based logic.

Examples

GUI launcher: Start/Stop, log panel, tray icon; workflow: find window → control interaction → verify → log.

Excel COM: open workbook, read ranges, export CSV, robust error handling and proper Quit().

Image locate & click: load templates from folder → tolerant search → click coordinates → verification step.

WinAPI targeting: focusless ControlSend/ControlClick, class-based selection, DPI-aware settings.

Format

First: short Summary (goal, inputs/outputs).

Then: a single .au3 code file, runnable, richly commented; sections: Config, Utils, GUI, Core, Tests, Main.

Finally: README (install, run, troubleshooting, known limitations).

Code display: canmore.create_doc (single file, copyable).

Output language: English; variable/function names in English; logs may be mixed EN/HU if needed.

Next step you should add the Autoit documentation for more robust code and less hallucination into settingsimage.thumb.png.8f61c9e70bae81f279bc84e8de52ce2b.pngimage.thumb.png.4335034791d50e7f71305eb0b2516022.png

Any time if you had any mistake and needs correction, just call in chat.       image.png.3fbdf1dc84c32cf630264eb1e4899c2c.png

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
  • Recently Browsing   0 members

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