is AI + WinBatch good?

Started by kdmoyers, April 25, 2024, 06:58:29 AM

Previous topic - Next topic

kdmoyers

I use ChatGPT4 daily for help coding SQL.  It's like having a fairly smart colleague
sitting next to me, answering questions.  I code SQL faster and better.

But, as you might guess, both ChatGPT4 and Claude3 do a terrible job with WinBatch.
I won't bore you -- it's all terrible hallucinations, delivered confidently.

In my day job, we are beginning to learn about adding schema to our website
to control or effect the way these AI engines train on our content.  In our case,
we would like to (somehow) get the engines to refer back to us, since we sell
a physical product. Failing that, we'd like them to buzz off.

But maybe Island Lake can actually benefit from the AI engines giving accurate
advice about WinBatch? It seems like that could only help Island Lake.

Which raises some questions to the group, in case anyone has done this before:

* Does it seem advantageous for AI Engines to know WinBatch?

* How can a person get OpenAI or Anthropic to pay attention to your content?

* is there special formatting or schema that the engines parse well?

* Would this even help? Is the corpus of training info large enough that an
  AI engine would become an adept in WinBatch?  Or it this a waste of effort?


The mind is everything; What you think, you become.

td

Interesting ideas. According to multiple sources, much of the training for ChatGPT4 (and therefore MSFT's copilot) comes from an army of minimum wage grunts feeding information into the model as part of model building. I am sure web scraping plays a major role as well. That's not to mention the latest and greatest idea of using AI to train AI models. One can imagine how that might turn out.

I suspect that AI web scraping can or will be handled similarly to the way search engines are handled today. It involves the addition of special files on the web server, adding undisplayable elements to web pages, and possibly hiring third parties to figure it all out for you.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

Maybe we need an AI Extender ;-)

td

Well, it is not like it hasn't been thought about... Just not for very long.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

spl

Quote from: kdmoyers on April 25, 2024, 06:58:29 AMI use ChatGPT4 daily for help coding SQL.  It's like having a fairly smart colleague
sitting next to me, answering questions.  I code SQL faster and better.

But, as you might guess, both ChatGPT4 and Claude3 do a terrible job with WinBatch.
I won't bore you -- it's all terrible hallucinations, delivered confidently.


I'm been using CoPilot which is free so far. It does a great job with PS, .NET, SQL Sever [or general SQL] and for WB I ask for VBA code and re-format.

I can't imagine an iterative AI learning from it's coding mistakes w/out licen$$ing. According to some critics AI is basically stolen code from a huge web-scrape.

That being said, using AI to support WB CLR scripts would be hopefully appreciated.

[OOPS] forgot to mention Python, CoPilot works super with that
Stan - formerly stanl [ex-Pundit]

spl

As a follow-up

I asked CoPilot if it could "convert $xl = New-Object -ComObject Excel.Application to Winbatch language". Got more than I asked for but seems they scraped enough together to answer the basic question

; Create an Excel application object
xl = CreateObject("Excel.Application")
xl.Visible = 1 ; Set visibility to true (optional)

; Open a workbook (replace 'file location.csv' with the actual path)
Workbook = xl.Workbooks.Open("file location.csv")

; Set the number format for column E (replace '00000000000' with your desired format)
Worksheet = Workbook.Worksheets.Item(1)
Range = xl.Range("E:E").EntireColumn
Range.NumberFormat = "00000000000"

and if question reversed: convert Winbatch xl = CreateObject("Excel.Application") to Powershell

# Create an Excel application object
$objExcel = New-Object -ComObject "Excel.Application"

# Open a workbook (replace 'file location.xlsx' with the actual path)
$FilePath = "file location.xlsx"
$WorkBook = $objExcel.Workbooks.Open($FilePath)

# Set the number format for column E (replace '00000000000' with your desired format)
$Worksheet = $WorkBook.Worksheets.Item(1)
$Range = $objExcel.Range("E:E").EntireColumn
$Range.NumberFormat = "00000000000"

# Save the workbook as an XLS file (replace 'file location.xls' with the desired path)
$WorkBook.SaveAs("file location.xls", 1)

# Close the workbook and quit Excel
$WorkBook.Saved = $true
$objExcel.Quit()
Stan - formerly stanl [ex-Pundit]

td

According to MSFT, you can train Copilot using feedback. There are reportedly several mechanisms available for providing. You can simply use the thumbs up and thumbs down menu items or submit an edit of the result to the model. Who knows? The Copilot AI model might even become proficient at WIL scripting someday.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

MSFT is also hawking its Copilot Studio which you can use to build Copilot plugins and add your data to the LM. Don't know much about it though.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

spl

Actually this translation not that bad. I asked Copilot to translate code to WB based on a PS script I shared with Jim for converting csv=>PDF via Excel [csv file in attached zip]

So This
$pop = new-object -comobject wscript.shell

$csv = "c:\temp\foodsales.csv"
if (!(Test-Path $csv))
{
   $msg = $pop.popup("Could not find $csv",2,"Closing",4096)
   Exit
}
$xls = "c:\temp\foodsales.xlsx"
if (Test-Path $xls) {Remove-Item $xls}
$pdf = "C:\temp\foodsales.pdf"
if (Test-Path $pdf) {Remove-Item $pdf}
$TStyle = "TableStyleMedium17"

$msg = $pop.popup("Creating $pdf'nfrom $csv",3,"Working",4096)
Add-Type -AssemblyName Microsoft.Office.Interop.Excel
$xlFixedFormat = [Microsoft.Office.Interop.Excel.XlFileFormat]::xlWorkbookDefault
$xl = New-Object -ComObject Excel.Application
$xl.visible = $false
$xl.ScreenUpdating = $true
$xl.UserControl = $true
$xl.DisplayAlerts = $false
$Wk = $xl.workbooks.open($csv)
$Wk.SaveAs($xls,$xlFixedFormat)
$Wk.Saved = $True

$wk.Close()
$Wk = $xl.workbooks.open($xls)
$ws = $xl.ActiveWorkbook.Worksheets.Item(1)
$ws.UsedRange.Columns.Autofit()
$ws.UsedRange.EntireRow.Autofit()
$lists = $ws.ListObjects
$lists.Add(1,$ws.UsedRange,$true,0,$ws.Range("A1"),$TStyle)
$ws.Rows("1:2").Select()
$xl.Selection.Insert($xlFixedFormat::xlDown)
$ws.Range("A1").Select
$xl.ActiveCell.FormulaR1C1 = "Food Sales 2022"
$xl.ActiveCell.Font.Name = "Calibri"
$xl.ActiveCell.Font.Size = 14
$xl.ActiveCell.Font.Bold = $true
$ws.PageSetup.Orientation = 2
$ws.PageSetup.Zoom = 100
$ws.ExportAsFixedFormat($xlFixedFormat::xlTypePDF, $pdf)
$xl.Workbooks.close()
$xl.quit()
[System.GC]::Collect()
[System.GC]::WaitForPendingFinalizers()
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($xl)
If (Test-Path $pdf)
{
   Remove-Item $xls
   $msg = $pop.popup("$pdf has been created",3,"Closing",4096)
}
Exit


Converts to
; Create a WScript.Shell object
pop = CreateObject("WScript.Shell")

; Define file paths
csv = "c:\temp\foodsales.csv"
xls = "c:\temp\foodsales.xlsx"
pdf = "C:\temp\foodsales.pdf"

; Check if the CSV file exists
If Not FileExist(csv)
   msg = pop.Popup("Could not find " : csv, 2, "Closing", 4096)
   Exit
EndIf

; Remove existing XLSX and PDF files
If FileExist(xls) Then RemoveFile(xls)
If FileExist(pdf) Then RemoveFile(pdf)

; Set table style
TStyle = "TableStyleMedium17"

; Display working message
msg = pop.Popup("Creating " : pdf : " from " : csv, 3, "Working", 4096)

; Create Excel COM object
xl = CreateObject("Excel.Application")
xl.Visible = 0
xl.ScreenUpdating = 1
xl.UserControl = 1
xl.DisplayAlerts = 0

; Open CSV workbook
Wk = xl.Workbooks.Open(csv)
Wk.SaveAs(xls, 51) ; 51 corresponds to xlWorkbookDefault format
Wk.Saved = 1
Wk.Close()

; Reopen XLSX workbook
Wk = xl.Workbooks.Open(xls)
ws = Wk.Worksheets.Item(1)
ws.UsedRange.Columns.Autofit()
ws.UsedRange.EntireRow.Autofit()
lists = ws.ListObjects
lists.Add(1, ws.UsedRange, 1, 0, ws.Range("A1"), TStyle)
ws.Rows("1:2").Select()
xl.Selection.Insert(51) ; 51 corresponds to xlDown
ws.Range("A1").Select
xl.ActiveCell.FormulaR1C1 = "Food Sales 2022"
xl.ActiveCell.Font.Name = "Calibri"
xl.ActiveCell.Font.Size = 14
xl.ActiveCell.Font.Bold = 1
ws.PageSetup.Orientation = 2 ; Landscape
ws.PageSetup.Zoom = 100
ws.ExportAsFixedFormat(0, pdf) ; 0 corresponds to xlTypePDF
Wk.Close()
xl.Quit()

; Clean up COM objects
ReleaseComObject(xl)
ReleaseComObject(Wk)

; Display completion message
If FileExist(pdf)
   RemoveFile(xls)
   msg = pop.Popup(pdf : " has been created", 3, "Closing", 4096)
EndIf

Exit


The message and RemoveFile need editing. and ReleaseComObject(xl) changed to xl=0, and the wscript stuff could be ignored.
Stan - formerly stanl [ex-Pundit]