Any solution on windows to erase old plots progressively?

I did install the latest version, but its quite possible your script, and the other one that was posted up were from earlier versions - I think they were posted some time ago. For now I will press on with what I writing, but thanks for the offer.

1 Like

No problem. But I always run the latest. If I ever open the software and it says there is an update, I run it. This script and the one from way back run with no errors for me (even today). So if you ever want to get them to work, let me know what the error is. Maybe it is something simple. Good luck.

I think your missing the point I was making, for example say you are running version 1, you post you’re script to the forum in May 2021 (see link below). Now two years later, I copy and paste that script into PA, but we’re now both on version 9, but the script I just pasted was from the version you were running in May 2021.

Unfortunately I no longer have PA installed, I think it was on my Plotter when I had W10 on it, but that’s now running W11

Out of interest perhaps copy the script from Using Windows Power Automate Desktop to move plots paste it into PA as a new script and see what happens.

I tried both yours and Endertown’s, and there was lots of lines with something like unknown command, unknown error, unknown something, can’t remember now. But when I Googled it I found something which suggested it was due to updates since the script was written, of course I may be completely wrong as I didn’t spend much time on it.

I understand what you are saying. That is why I said that I am currently running the latest version and also still running that old script and the latest one I posted. So I know they both work with the latest version. They are running right now. The problem you are/were having is probably just locations that the script is looking for that don’t exist on your system. There are no custom commands that aren’t natively provided by PowerAutomate. So it can’t be some “unknown command” because all the commands are straight out of the default options. Those scripts are not out of the box ready to run with no changes. For example, this latest script, I went through and made notes throughout the script identifying anything that may need changed to meet the user’s needs. I even annotated the changes needed in my post to this thread. But since you don’t even run the software anymore, not even sure what to say. You are basically saying “Two years ago, I tried one of your scripts. I had issues with it but didn’t say anything. So this script must have issues too.”. We are just going to run around in circles unless you provide actual issues to troubleshoot. I would be glad to help.

Nope your still missing the point, I realise they are not ready to use out of the box, and it was a matter of weeks ago, but I copy and pasted the script from two years.

Give me 15 minutes and I’ll install it in a VM and see what happens.

@WolfGT

Here you go, this is the script you posted two years ago.

Even stranger is the flow you posted in this thread will not paste in to PA, its on the clipboard as I can paste it into Notepad.

Thank you for the test of that early script. I do see the issue. At some point, PA changed the naming of some of the commands. They are still there, just as before. And since the real script is in my library of flows, it updated them as the updates happened. For example, the first error that it shows is “Module 'System” or action ‘GetEnvironmentVariable’ wasn’t found". But if you look to the left in the Actions menu, System is right there and under it, you will see “Get Windows environment variable”. Looking at the exported text of the script. At some point, they changed it from System.GetEnvironmentVariable to the new System.GetEnvironmentVariable.GetEnvironmentVariable. Which is strange. But an easy fix. I guess if you have the flow already in PA, it updates this stuff automatically. That is why it has continued to work for me. I can provide an updated version if you like. As for the new script, let me try to paste what I posted. Just a sec.

There is an extra “type or paste code here” at the end of the code. That should not be there. Must have been left over from selecting the “Preformatted Text” option. I’ll remove it.

That’s exactly why I suggested you tried the code you posted 2 years ago, NOT the code which has evolved each time PA was updated, it makes perfect sense that PA will handle incremental updates, and self update the code, typical MS fashion though that it eventually breaks with old code.

Its also possible that when you paste a flow in its not parsed in the same way as a flow when its opened, so perhaps any corrective parsing isn’t run against pasted flows, but is when you open an old flow.

Arggghhh…
Can’t get the script to work.

I had some issues with :

  • “TheBeginning” flag not existing,
  • CurrentDateTime that doesn’t work and returns 01/01/000 00:00:00 if not in the first commands,
  • text “bytes free” unrecognized (pardon my French!)…
  • my plots are in a directory, and dunno if script can handle that…

I’m kind of giving up at the moment…
If anyone has a working script, with PA version 2.33.00204.23144, I can definitely use it!

For some reason, the first line of code for “the beginning” was not showing in the preformatted script screen for you to copy. Even though it was there. I moved it to the second line and it is now showing. Recopy and paste and the problem will be fixed. My bad.

Issues 2 and 3 are commands that pull properties from the existing plots and plot locations (the date of the plot and the free space on the drive). So if you are not providing the location of the plots to the script correctly (issue 4) then that would explain it. What does your text file look like that tells it where the plots are (the text file referenced in line 20)? Here is an example of what mine looks like.

C:\JBOD_Drives\Drawer_5_Disk_8
C:\JBOD_Drives\Drawer_5_Disk_9
C:\JBOD_Drives\Drawer_5_Disk_10
C:\JBOD_Drives\Drawer_5_Disk_11
\\10.0.11.3\Farm_1_D1\Portable_Plots
\\10.0.11.3\Farm_1_D2\Portable_Plots
\\192.168.55.104\Farm_3_D1\Portable_Plots
\\192.168.55.104\Farm_3_D2\Portable_Plots
\\192.168.55.104\Farm_3_D3\Portable_Plots
\\192.168.55.104\Farm_3_D4\Portable_Plots
1 Like

I changed:

  • my OS langage to U.S. English instead of French;
  • my import of the text file with directories to “native OS encoding” instead of “UTF8”. The file seemed OK;
  • Added theBeginning.

It seems to work now… Will tell you in one day or two!
Anyway, thank you VM for your after-sale service.

1 Like

I just want it to be helpful to the community and if it doesn’t work, it’s not very helpful. Let me know if you run into any other issues.

1 Like

I had another issue with the manipulation of “currentdate” you do to change the log filename.
It erase the first plot, then is stop on an error.
So I deactivated the two commands “split text” before the “set variable” (lines 86-88 the error was here, it told me there is no index [1]), removed the date from the file name (basically, there is only one log file, It’s ok for me), and keep adding new lines in it.

It’s been working like a charm since.

EDIT : Just added a bash script to restart flexfarmer every two hours to add new plots :

#!/bin/bash
for (( ; ; ))
do
   echo "infinite loop restarting flexfarmer every 2 hours"
   ./flexfarmer -c config.yml & VAR=$! ; sleep 7200 ; kill $VAR
done

Glad you worked around it. If you want to troubleshoot it.

Line 84 pulls the current datetime. This is used in the text file at the beginning of each line. It sounds like that is working fine for you.

Line 85 also pulls the current date and time. This is to be used in the log file name but there is a problem. This date has the time (which we don’t need) and has slashes in it and windows will not let you put slashes in the filename. So, the next 3 lines chop it down and reformat it. 86 splits the variable on the space (between the date with slashes and the time. The time is no longer used after this point). 87 splits the date portion on the slashes creating a list of the date (Month, Day, Year). 88 reassembles the date but with dashes instead of the slashes. Then in 89 that new date with dashes is used in the file name. This makes it so it creates a new file every day so the file doesn’t get too big.

If you want to check what is going on, you can look in the “Flow variables” window to the right when the script errors. This is what it should look like. Look at the CurrentDate and CurrentDateList variables.

Screenshot 2023-06-14 091720

My assumption is that your system is providing the date in a different format and that the data in CurrentDate will look different (and in turn, CurrentDateList will probably be empty, causing the error). So the following lines that are splitting it and then reformatting it are failing and not providing what the next step needs.

1 Like

My assumption is that your system is providing the date in a different format and that the data in CurrentDate will look different (and in turn, CurrentDateList will probably be empty, causing the error). So the following lines that are splitting it and then reformatting it are failing and not providing what the next step needs.

I guess your assumption is right. But TBH, I may not investigate anymore :
Since I don’t require a day to day log, the workaround seems fine, and I’m not in the mood to go back and break what’s working…

My opinion, is that I think other environments are more tolerant to change that MS tools like Power Automate are…
With python, I can handle date-time with relative ease…
It honestly sounds like a mess in other environments.

(Anyway, thank you, at least you provided an effective solution to my problem.)

1 Like

I’ve got my solution working.

I move my plots across my 10G network to my server.

When I’m moving 3 or more plots to the server, I’ve noticed one logical processor peaks almost constantly at 100% (6 cores with hyper threading), even with just two its quite high on that one logical processor. The others are sitting there not doing much.

Its like something on the receiving end cannot make use of more than one logical processor, no idea what and doubt there is anything I can do about it, but with 5 minute plot times its not causing an issue as I can move them off the plotter where my App runs quick enough.

1 Like