Jump to content
Macro Express Forums

Anyone Tried Writing Macros with ChatGPT?


Recommended Posts

It's pretty interesting. Here is what I tried:

 

Please write code for Macro Express Pro 6 that watches a file folder for new files and then copies those files to another folder.

 

That yielded:

<--- Macro Express Pro 6 Script --->
<--- Start Macro --->
Variable Set Integer %WaitTime% to 5
Variable Set Integer %FileCount% to 0
Folder Watch Start "C:\FolderToWatch" Recurse
Repeat Until %CancelMacro%
    Delay %WaitTime%
    Variable Set Integer %FileCount% to Folder Watch Count
    If %FileCount% > 0
        Folder Watch Get Next "C:\FolderToWatch" "C:\FolderToCopy"
    End If
End Repeat
Folder Watch Stop
<--- End Macro --->

 

Close, but no cigar, and I wanted the commands written for the Direct Editor. Using the first two lines, I provided an example in Direct Editor format, and got this back:

Quote

<VARIABLE SET INTEGER Option="\x00" Destination="%WaitTime%" Value="5"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%FileCount%" Value="0"/>
<FOLDER WATCH START Folder="C:\FolderToWatch" Recurse="Yes"/>
<REPEAT UNTIL Variable="%CancelMacro%" IgnoreCase="No">
    <DELAY Flags="\x01" Time="%WaitTime%"/>
    <VARIABLE SET INTEGER Option="\x00" Destination="%FileCount%" Value="%FOLDER WATCH COUNT%"/>
    <IF VARIABLE="%FileCount%" Condition="Is Greater Than" Value="0" IgnoreCase="No">
        <FOLDER WATCH GET NEXT SourceFolder="C:\FolderToWatch" DestinationFolder="C:\FolderToCopy"/>
    </IF>
</REPEAT>
<FOLDER WATCH STOP/>
 

 

Still unworkable, but I was impressed. I continued providing feedback, pointing out to ChatGPT the commands that are not valid in Macro Express Pro 6, resulting in this:

 

Quote

<GROUP "Watch and Copy Files">
<COMMENT>
Watches a folder for new files and copies them to another folder.
</COMMENT>
<VARIABLE SET STRING Option="\x00" Destination="%FolderToWatch%" Value="C:\FolderToWatch"/>
<VARIABLE SET STRING Option="\x00" Destination="%FolderToCopy%" Value="C:\FolderToCopy"/>
<CHANGE DIRECTORY/FOLDER Path="%FolderToWatch%"/>
<LOOP>
    <DELAY Flags="\x01" Time="5"/>
    <IF FILE EXISTS="%FolderToWatch%\*.*">
        <COPY FILE="%FolderToWatch%\*.*" TO="%FolderToCopy%\" Flags="\x00"/>
        <DELETE FILE="%FolderToWatch%\*.*"/>
    </IF>
</LOOP>
</GROUP>
 

 

 

Most of the time ChatGPT would come back offering corrected code or defend its position. For example, when I questioned the <IF FILE EXIST...> line, here is how ChatGPT responded:

 

image.thumb.png.15c0c7a5873877fd09ab57f4687c9a4e.png

 

The bottom line is that while ChatGPT did not yield ready-to-run Macro Express Pro code, it came pretty darn close. Actually, I never thought it would come that close at all. Turns out, it was far better than I expected. The give and take, and the rough translating into Macro Express Pro's direct editor format, surprised me. Upon each challenge, ChatGPT appeared to go back and verify the command and syntax. In some ways, it was like a little like discussing a snippet of code with programmer.

 

If you have not yet checked out ChatGPT, I encourage you to do so. Here is the link:

https://openai.com/blog/chatgpt

 

I would be interested to learn what others think about how ChatGPT can be used with Macro Express Pro.

  --Dennis

 

Link to comment
Share on other sites

Surprising.  I bet it would do well writing Visual Basic code or SQL queries -- especially SQL which is so structured. 

 

Thank goodness I am retired so I won't be losing my job to this phenomenon.  Or maybe there will be entire new jobs opening up for those most skillful at framing questions / commands and prompting / refining ChatGPT as you have done.  Wasn't that considered a vital skill in the long-ago days when people visited oracles? 

Link to comment
Share on other sites

Agreed, it is much better with VB. I kinda' see ChatGPT technology as taking rapid prototyping in a new direction. And OMG about the oracle reference--history does repeat itself. Didn't we go through that already back when computers were massive and controlled by a handful of lords, and everyone had to submit a request for a program to run? 😀 

 

Personally, I would love to see the power of programming placed in the hands of everyday folks who know what they need, but don't know how to program even in the very accessible Macro Express Pro.

  --Dennis

Link to comment
Share on other sites

I had quite a conversation yesterday with ChatGPT about sorting algorithms.  It wrote me some VB code for a bubble sort, which would almost have worked.  And described several techniques for sorting large datasets, though it was kind of vague on the details.  It was apologetic and corrected its answer when I pointed out an error in its description. 

 

Today I described to it several symptoms my car was displaying, which I had (finally) diagnosed myself.  The problem with ChatGPT was that it addressed each symptom individually, whereas only by considering all three together could you come up with the correct diagnosis.  In defense of Chat, I should add that three experienced mechanics all fell into the same trap of not putting 1 + 2 + 3 together. 

Link to comment
Share on other sites

  • 2 weeks later...

Great point!

Clearly, we have a long way to go. I think ChatGPT and other similar systems that are coming need a sandbox in which to execute and verify proposed results or code works before delivering it. I can only imagine the resources needed for that. And like you suggested, diagnostics need to evaluate the specific, the sum, and various combinations of known symptoms to synthesize a diagnosis. It also needs to be based on real data. IBM's Watson failed in healthcare because much of the data upon which it relied was hypothetical. (Well, there other reasons, too.)

 

Puttin that all together, It seems to me there are three areas that need to be addressed for an AI system to be reliant: real data, Gestalt evaluations, and real-time testing. The latter two are programming and resource problems to be solved. The former--real data--is much more difficult, as Watson proved. Sure, there are a lot of specific "data" available for training. However, much of that data was created and captured by humans who, as it turns out, are neither consistent, accurate nor complete in recording data. That was the problem with healthcare, where data is abundant, but the quality--despite ICD10 and CPT coding standards--is lacking.

 

Nonetheless. I remain optimistic.

Link to comment
Share on other sites

My main concern with ChatGPT is that its responses may be inaccurate or wrong. Some responses may even be total fabrications.

 

I recently asked ChatGPT a question about a certain 18th century composer. Much of the answer makes sense and conforms to what is known about the composer.

 

But ChatGPT seems to have invented a musical collaboration between the composer and a religious scholar, perhaps because their surnames are similar. The likelihood of a collaboration between the two is slim -- the composer was 46 years older.

Link to comment
Share on other sites

10 hours ago, acantor said:

ChatGPT seems to have invented a musical collaboration between the composer and a religious scholar

 

ChatGPT was largely trained from online text data, so probably somebody somewhere posted that collaboration theory.  I asked it to find heating thermostats with a particular feature, and it gave me three suggestions that were totally wrong -- no better than a Google search, but presented in the confident conversational tone of a used-car salesman.  Given the huge quantity of mis-information online, we should not be surprised if it leads us astray. 

chat.JPG

Link to comment
Share on other sites

  • 3 weeks later...

Tonight I typed this into ChatGPT:

 

Write a rhyming poem about macro writing
 
 
Quote

 

In the world of coding and tech,

There's one skill that's in high demand,

It's the art of macro writing,

And it's not hard to understand.

 

Macros automate tasks galore,

Making our lives so much easier,

They're like an assistant we adore,

A code-based, digital warrior.

 

With a few clicks, they do the work,

That would take hours upon hours,

From data analysis to paperwork,

They have immense time-saving powers.

 

From Excel spreadsheets to Word docs,

Macros can handle them all,

No more manual, mundane tasks,

Our productivity can stand tall.

 

So if you want to be a coding star,

And make life better for yourself and others,

Learn the art of macro writing,

And automate tasks like no other.

 

 

 

Then I asked ChatGPT to regenerate the response. The new poem might be a smidge better! Or is it just the same doggerel in a slightly different form?? :)

 

 

Quote

 

When writing macros, do take heed

And plan out what it is you need

With code that's clean and well-defined

Your macros will be easy to find

 

Take the time to test and debug

To ensure your macros don't get bogged

Down by errors and messy code

For that can make your head explode

 

But when your macros run just right

You'll see the benefits take flight

Tasks that once took hours or more

Will be done with just a few clicks, for sure

 

So don't be afraid to dive right in

And let your macro writing begin

With practice, patience, and a steady hand

You'll soon be a macro writing grand!

 


 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...