Jump to content

How do I correctly insert the month into the folder path/structure?


---
 Share

Recommended Posts

Good morning, I would like to add the month to my file saving path. I managed to include the year, but I haven't figured out how to add the month. I have provided an image highlighting where I want to add the month to the folder structure/file name. Is it possible to do this?

Thank you very much!

 

image.thumb.png.e7b4cea3d889b89d030922fd7c2c6e8a.png

Link to comment
Share on other sites

d = getRecordHead("date")

commaPos = inStr(d, " ")
month = subStr(d, 1, commaPos - 1)

display(month)

Here is the quick and dirty way to isolate the month from the date.

 

If you want it in numerical format, use the following. 

month = strElement(1, "/", getRecordHead("dateshort"))

display(month)

 

Link to comment
Share on other sites

A couple options:

// Year
date().asDate.year                  // 2025

// Month (Number)
date().asDate.monthIndex            // 10

// Month (Word)
date().asDate.monthName.asString    // "October"

// Day (Number)
date().asDate.dayOfMonth            // 14

// Day (Word)
date().asDate.weekday.asString      // "Tuesday"

For your situation so far:

// All together
"C:\\" + date().asDate.year + "\" + date().asDate.monthIndex

// C:\\2025\10

 

  • Like! 2
Link to comment
Share on other sites

Well that was simpler. Hahahaha. 

Can we please for the love of god get better documentation for PCM?

Edited
Link to comment
Share on other sites

getRecordHead("date")+"_"+getRecordHead("time")

PCM that adds the current date and time to the file name.

Never overwrite a file again.

Edited
  • Like! 1
Link to comment
Share on other sites

Please sign in to view this quote.

totally agree

Please sign in to view this username.

.

Also thank you

Please sign in to view this username.

 , big help as always.

Something as trivial as date(), you would think Zeiss would disclose a little bit more info here then as to what is accessible.

Perhaps they could release an 'Advanced PCM' class for these types of things, that way they could monetize it as well, right? I mean, it should be freely documented.

I suppose someone here could also start doing some in depth videos how to come up with this stuff - but then we may see a lawsuit on our hands..

Anyways, I digress. Thanks everyone !

  • Like! 2
Link to comment
Share on other sites

https://www.zeiss.com/metrology/us/services/zeiss-academy-metrology/training-details.html?id=c3f04154-1652-4aa7-8fb7-fb2894b6c151&type=E_LEARNING_TRAINING

I can't see the price due to employee login, but I did work with proofreading and testing this "animated" (more like interactive) PCM manual, and from what I recall it had a lot of added, useful examples as well as a lot more PCM codes, with a very nice organizational layout.  

If anyone is interested, I will see if I can reach out to the training team for a more detailed summary of the course/content

Edited
  • Like! 2
Link to comment
Share on other sites

Kevin, thanks for the info. I don't remember this being mentioned during my PCM training last year, hopefully it's new and included when someone books the PCM training. There is a lot of useful information in here. 

This also needs to be a printable book.

  • Like! 1
Link to comment
Share on other sites

Please sign in to view this quote.

There's nothing magical about these "dot extensions". It's just PCM's way of sending 'unary' Smalltak messages to PCM functions. You have to understand that every PCM function is ultimately a Smalltalk object written in Smalltalk code. And as such it can receive messages causing it to execute a corresponding method, which returns some kind of information. So-called unary messages consist of a single word without a colon at the end. Such messages can be added to PCM functions by adding a dot followed by the message name. But a message has to be understood by the receiving object, otherwise it will result in an error message ("does not understand...") which you might have seen once in a while. Some error conditions are intercepted by PCM, which then displays its own error message.

The PCM environment can be imagined as some kind of "stage" on which these Smalltalk objects perform. Only "approved" actors are allowed on the stage, so you can't use every Smalltalk function here. Also, it adds its own comprehensible language constructs, like parameters being enclosed in parentheses and the above mentioned "dot extensions", but apart from that it's closely communicating with the underlying Smalltalk environment. And that's why we can send these "undocumented" messages to PCM functions and use "expert" commands like executeCode(). 

So if you want to know what extensions can be used, make yourself familiar with Smalltalk syntax and you may meet a few old acquaintances on the way.

A good resource for a quick start was already mentioned in the forum a while back: https://learnxinyminutes.com/smalltalk/

Scroll down to the date / time stuff and learn 🙂 

Edited
  • Like! 3
Link to comment
Share on other sites

 Share

×
×
  • Create New...