Discussion:
Rinominare un file.txt con una parola contenuta al suo interno
(too old to reply)
g***@gmail.com
2015-01-09 15:43:06 UTC
Permalink
Debbo creare uno script che all'esecuzione sostituisca il nome del file.txt con quanto contenuto tra parentesi nella seconda stringa contenuta al suo interno.

Es. Filename.txt
--------------------------
%
O0028(CANNULA 100 MM)
#908=50(GREZZO)
G28V0
M500Z203
T101(FERMO CON UTENSILE)
G4X0.5
G0X0Y-30Z-1.5
M00
G0Z100
X150Y0
G28V0
--------------------------
...etc
--------------------------

Rinominare "Filename.txt" con la parola letta tra parentesi nella seconda riga del file (CANNULA 100 MM) in "CANNULA 100 MM.txt"

Sapete darmi una mano?
Grazie a tutti.
Gra
GS
2015-01-09 19:15:03 UTC
Permalink
Speak English if possible!!!

I don't know what you want but the code you show is G-code such as
would be used to automate machinery (CNC).

This is normally stored in plain text files that may or may not have a
file extension, depending on the machine controller it's running on.
For example, the Fanuc file might be named...

O0028

..whereby there is no file extension used.

Please ask your question again using English...
--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
R.Wieser
2015-01-10 10:16:48 UTC
Permalink
Graziano,
Post by g***@gmail.com
Sapete darmi una mano?
We can certainly help you. Though what do you need help with ?

All I now read is that you want the file to renamed with the text found in
the second line of the file beween the brackets, and with a .TXT extension.
The question is, what did you already try yourself ? Anything ?

Or is this a "you guys write the script for me." kind of request ? In that
case, how much are you/your boss paying me ? :-)

VBScript in't all that hard, and there is lots info about it on the web,
ranging from examples, snippets to clear explanations of VBScripts commands
(www.w3schools.com).

Bottom line: We want to *help* you. That means that *you* do all the work,
with us just advicing you how to do it.

So, please post what you tried yourself and how it fails to do what you
expect it to do.

And as GS already mentioned, these newsgroups use English/American as the
conversation language. This time Google Translate gave me enough to
understand what you where after (I know little, if any of the Italian
langage), but if-and-when the questions become more complex not even Google
Translate will be of much use ...

Regards,
Rudy Wieser
Post by g***@gmail.com
Debbo creare uno script che all'esecuzione sostituisca il nome del
file.txt con quanto contenuto tra parentesi nella seconda stringa contenuta
al suo interno.
Post by g***@gmail.com
Es. Filename.txt
--------------------------
%
O0028(CANNULA 100 MM)
#908=50(GREZZO)
G28V0
M500Z203
T101(FERMO CON UTENSILE)
G4X0.5
G0X0Y-30Z-1.5
M00
G0Z100
X150Y0
G28V0
--------------------------
...etc
--------------------------
Rinominare "Filename.txt" con la parola letta tra parentesi nella seconda
riga del file (CANNULA 100 MM) in "CANNULA 100 MM.txt"
Post by g***@gmail.com
Sapete darmi una mano?
Grazie a tutti.
Gra
GS
2015-01-11 04:15:03 UTC
Permalink
Rudy,
I got the gist of the OP's need by attrition due to my familiarity wirh
cnc program files. The problem is that the original filename is "O0028"
which is understandably non-descript. People working with these files
need some way to relate to their intended purpose in a manner similar
to how the machine controller displays the file's info; - it shows the
text between the 1st set of parenthesis. This info is entered by the
programmer when the prog is written, and can be revised offline (other
than using the machine control's prog editor) using any text editor.

I'm going to recommend to the OP to not change the filename and instead
implement using the app described in the user guide from here...

http://www.solutionsxpress.com/products/help/CncFiles
Pro-UserGuide.exe

..which fully explains what the app does and how to use it as a
complete cnc program file management tool!
--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
Todd Vargo
2015-01-11 06:14:26 UTC
Permalink
Post by GS
Rudy,
I got the gist of the OP's need by attrition due to my familiarity wirh
cnc program files. The problem is that the original filename is "O0028"
which is understandably non-descript. People working with these files
need some way to relate to their intended purpose in a manner similar to
how the machine controller displays the file's info; - it shows the text
between the 1st set of parenthesis. This info is entered by the
programmer when the prog is written, and can be revised offline (other
than using the machine control's prog editor) using any text editor.
I'm going to recommend to the OP to not change the filename and instead
implement using the app described in the user guide from here...
http://www.solutionsxpress.com/products/help/CncFiles Pro-UserGuide.exe
...which fully explains what the app does and how to use it as a
complete cnc program file management tool!
Keep in mind, not everyone requesting help/information are admins, and
are unable to install software on their employers computers/machines.

I know many CNC operators keep "Un-Controlled" edited copies of their nc
code for their personal archive purposes. The OPs example, "CANNULA 100
MM", looks to be a generic macro program. Other programs may have actual
job numbers which would be a better descriptive filename to the operator
than the 5 digit incremental numbers. Besides, the CNC machine assigns
the number from the beginning of the same line when the program is read
into the machine regardless of the filename.

If OP would like to attempt to write a script on their own, Google is
your friend. Here is a website with code that should be helpful.

http://www.codeproject.com/Articles/16173/How-to-Rename-Multiple-Files-with-VBS

With modifications, you should be able to get what you need from it.
Give it a try on your own. I suggest that you create a test folder with
a short list of files to work with so your original files will be
untouched until you have the script working correctly.
--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)
GS
2015-01-11 06:37:51 UTC
Permalink
Post by Todd Vargo
If OP would like to attempt to write a script on their own, Google is
your friend. Here is a website with code that should be helpful.
http://www.codeproject.com/Articles/16173/How-to-Rename-Multiple-Files-with-VBS
With modifications, you should be able to get what you need from it.
Give it a try on your own. I suggest that you create a test folder
with a short list of files to work with so your original files will
be untouched until you have the script working correctly
I assume your recommendation is for the OP since I already use CFP,
being its author! However, renaming the cnc files is not a good idea in
general since the machine controller won't know what they are. (Fanuc
style controllers don't/won't recognize the renamed files) This is
especially important where cnc machines are connected to a network and
filenames are replicated in various paths. The idea is to use unique
(job-specific, for example) paths so the limited number of files
available isn't used up.

Some controllers (like Anilam, for example) use normal text file naming
conventions as exampled in the user guide I linked to. (The CncFiles
Pro-UserGuide.exe file is a stand-alone e-book format user guide, not
an installer)

One user of CFP has 5 different machines that perform the same
operations based on machine features. In this case the filenames are
organized by operation, meaning there are 5 different files with the
name "O0001" that perform the same operation of 5 different machines.
The variables for the machines are anywhere from a pick-n-place
toolchanger to a carousel toolchanger, with and without a 4th/5th axis.
Each machine runs the same operation (O0001) from its designated prog
files path on the network. The prog files are managed with CFP and the
TextPad companion editor.
--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
R.Wieser
2015-01-11 13:41:47 UTC
Permalink
GS,

Thanks for the info, I was not aware of that.

Although I agree with you that the files should be presented in a way the
(CNC)machine can understand (otherwise the name change would be
counter-productive, something they would find out in a hurry :-) ), I can
also imagine that whomever needs to manage the (backup) files on a PC would
be better off with a descriptive filename.

Hey, maybe the OP just asked for a CNC-to-PC translation method, assuming he
could figure out the reverse from it himself .

It just means that between what you suggested and I/others could help them
with they would have the choice to pick the one they think best fits their
requirements, together with the awareness (from you) that renaming those
files is non-standard and could(?) cause troubles.

Regards,
Rudy Wieser


-- Origional message
Post by GS
Rudy,
I got the gist of the OP's need by attrition due to my familiarity wirh
cnc program files. The problem is that the original filename is "O0028"
which is understandably non-descript. People working with these files
need some way to relate to their intended purpose in a manner similar
to how the machine controller displays the file's info; - it shows the
text between the 1st set of parenthesis. This info is entered by the
programmer when the prog is written, and can be revised offline (other
than using the machine control's prog editor) using any text editor.
I'm going to recommend to the OP to not change the filename and instead
implement using the app described in the user guide from here...
http://www.solutionsxpress.com/products/help/CncFiles
Pro-UserGuide.exe
..which fully explains what the app does and how to use it as a
complete cnc program file management tool!
--
Garry
Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
GS
2015-01-11 17:35:42 UTC
Permalink
Post by R.Wieser
GS,
Thanks for the info, I was not aware of that.
Although I agree with you that the files should be presented in a way the
(CNC)machine can understand (otherwise the name change would be
counter-productive, something they would find out in a hurry :-) ), I can
also imagine that whomever needs to manage the (backup) files on a PC would
be better off with a descriptive filename.
Hey, maybe the OP just asked for a CNC-to-PC translation method, assuming he
could figure out the reverse from it himself .
It just means that between what you suggested and I/others could help them
with they would have the choice to pick the one they think best fits their
requirements, together with the awareness (from you) that renaming those
files is non-standard and could(?) cause troubles.
Regards,
Rudy Wieser
I'm sure you'd get a better understanding of what I'm suggesting if you
download/read the user guide. The app reads/displays the info the OP is
looking for without modifying the files in any way unless the user
wants to add more info. The structure I use is same as the old NTFS
SummaryProperties as the original version was developed on WinNT as an
Excel addin. The stand-alone cfp.exe addresses the later OSs no longer
supporting those SummaryProperties since the info is stored in the file
as a comment!
--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
R.Wieser
2015-01-12 09:51:34 UTC
Permalink
GS,
Post by GS
I'm sure you'd get a better understanding of what I'm
suggesting if you download/read the user guide.
The link you posted was to an executable, not a(n easy accessible) user
guide (I'm not in the habit to just download executables and run them).
Post by GS
The app reads/displays the info the OP is looking for
without modifying the files in any way unless the user
wants to add more info.
I already assumed as much. I think that the app would have been very handy
in the time of 8.3 filenames, but currently most OSes can handle descriptive
filesnames names quite well. So, why not use them ?

And yes, I do not really understand why renaming those files (on the PC)
would be bad to begin with (other than that I assume that the CNC machine
cannot handle them).

Regards,
Rudy Wieser
Post by GS
Post by R.Wieser
GS,
Thanks for the info, I was not aware of that.
Although I agree with you that the files should be presented in a way the
(CNC)machine can understand (otherwise the name change would be
counter-productive, something they would find out in a hurry :-) ), I can
also imagine that whomever needs to manage the (backup) files on a PC would
be better off with a descriptive filename.
Hey, maybe the OP just asked for a CNC-to-PC translation method, assuming he
could figure out the reverse from it himself .
It just means that between what you suggested and I/others could help them
with they would have the choice to pick the one they think best fits their
requirements, together with the awareness (from you) that renaming those
files is non-standard and could(?) cause troubles.
Regards,
Rudy Wieser
I'm sure you'd get a better understanding of what I'm suggesting if you
download/read the user guide. The app reads/displays the info the OP is
looking for without modifying the files in any way unless the user
wants to add more info. The structure I use is same as the old NTFS
SummaryProperties as the original version was developed on WinNT as an
Excel addin. The stand-alone cfp.exe addresses the later OSs no longer
supporting those SummaryProperties since the info is stored in the file
as a comment!
--
Garry
Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
GS
2015-01-12 10:33:07 UTC
Permalink
Yes, the user guide is a HTML.EXE in ebook format. It was made with a
program called "HTML Executable" available from here...

http://www.htmlexe.com/Home

..but there's no reason I can't convert it to a CHM in RoboHelp, or set
it up as WebHelp so it can be viewed online. I just made it as an
exercise to code for using an out-of-process help that behaves like it
was running in-process. Viewing the user guide is easier than
installing a trial of the entire app and so why I make its current
version available for download. There's a complete app overview here...

http://www.solutionsxpress.com/products/cfp.htm


CNC controllers typically only recognize their own file formats, and
run on DOS6.2 for OS stability. Thus, my app makes it possible to read
the file 'title' without need to change the filename, leaving files in
a usable state for their intended purpose. Some newer controllers claim
to run Windows, but the cnc part still uses/runs in a DOS window as do
desktop versions of the controller software.

My exerience is limited to Fanuc, Anilam, Fagor, Accurite Millpower,
Bridgeport, and Centurion controllers and so I can't speak to others. I
bought my 1st cnc machine in 1994 from Bridgeport!

I've also used Mazak but their files use proprietary encryption in
binary format because they sell their own cnc program files manager at
an understandably rediculous price!
--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
GraVer68
2015-01-12 13:12:58 UTC
Permalink
Post by GS
Yes, the user guide is a HTML.EXE in ebook format. It was made with a
program called "HTML Executable" available from here...
http://www.htmlexe.com/Home
..but there's no reason I can't convert it to a CHM in RoboHelp, or set
it up as WebHelp so it can be viewed online. I just made it as an
exercise to code for using an out-of-process help that behaves like it
was running in-process. Viewing the user guide is easier than
installing a trial of the entire app and so why I make its current
version available for download. There's a complete app overview here...
http://www.solutionsxpress.com/products/cfp.htm
CNC controllers typically only recognize their own file formats, and
run on DOS6.2 for OS stability. Thus, my app makes it possible to read
the file 'title' without need to change the filename, leaving files in
a usable state for their intended purpose. Some newer controllers claim
to run Windows, but the cnc part still uses/runs in a DOS window as do
desktop versions of the controller software.
My exerience is limited to Fanuc, Anilam, Fagor, Accurite Millpower,
Bridgeport, and Centurion controllers and so I can't speak to others. I
bought my 1st cnc machine in 1994 from Bridgeport!
I've also used Mazak but their files use proprietary encryption in
binary format because they sell their own cnc program files manager at
an understandably rediculous price!
--
Garry
Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
Thank you all, sorry I did not realize that the site was not Italian, really sorry.

However in your "small" you gave me considerable input and you understood my request on the fly without further explanation, congratulations, well done indeed!

Now I draw inspiration from the ideas gathered to see how to activate the project.
So many good things to everyone!
Gra

Loading...