Hi @dharman & @DavidRutten;
Yes, I was able to use the examples as a good start. Thank you very much!
I have now made a CommandLine tool which scans a folder structure starting from a folder given as a CommandLine option (a filename or a folder) and optionally a command as well (as illustrated below).
So far I have three (3) commands for different listings of files and temp-folders, and one command for conversion (gh ->copy-> ghz, and yet another command for deleting these .ghx copies.
The .ghx copies are placed in subfolders below any existing gh-file (thus I can simply delete the subfolder if the .ghx copy isn’t needed anymore)
Fig 1. Here an example of Convert (“C”) gh files into .ghx versions placed into subfolders named …\ghx_tmp
In this first version the tool grabs all gh files in the folder (which doesn’t have a ghx equivalent in the same folder) an makes a .ghx-copy in the sub-folder …_ghx_tmp.
The next version will handle individual files as well (it picks them up already , but uses only of the path to iterate over all files in the same folder, disregarding the single filename).
I commented out the example code but that code can be uncommented in upcoming version. I was about to publish the sources on BitBucket, but that silly thing refuses to accept me pushing up the project. Will fix that asap.
Fig 2. Here pressing D for “Dir” to list all the temp folders created with the previsus Convert command (5 temp folders had been created, containing .ghx versions of gh files):
Fig 3. … and pressing X for a listing of the ghx files, of which some already existed (and so they were not copied or converted) however a few (7 of them) gh-files were converted and placed in their respective
\_ghx_tmp subfolders so they easily can be deleted later:
Fig 4. Here pressing the command “G” lists all gh files under current path, in this case the 7 gh-files which were converted above:
Fig 5. And finally, pressing R for remove, removes the temp folders and files altogether (Ops, I just now noticed that the reporting of the number of deleted files is missing.):
Grasshopper no searchable
So, all in all, with these few commands I can make my entire history with Grasshopper searcheable in a few seconds (I often use PowerGrep, RegexBuddy and EditpadPro for regex searching and text manipulation).
I will uncomment some of Davids example code next.
Anyway, if anyone is interested, here’s the exe-file (remove the “.gh” extension, which is there only to mask the file so it could be uploaded). Place your own copy of GH_IO.dll in the same folder as this exe-file (wherever you put it) and off you go.
To start the program, Win10 wants you to type a period and a slash before the app name, like so:
.\ghtoghx.exe […your filepath…] :
ghtoghx.exe.gh (17.5 KB)
It is adviceable to terminate folder paths with a backslash as to prevent the path from being truncated one step.
If you add a second option after the filepath, like G, H, D, C or R (R = Remove), then the app will execute and terminate directly after.
Sources will be available asap. But now it’s time to hit the sack.