Page 1 of 1

Image name without extencion in an field?

Posted: Tue Jun 14, 2016 10:27 pm
by zutrix
Hi
need some help

im trying to load an image.and wanted to put the image filename in an field but without extencion name i wanted just the name only
i have this till now an it gifs me back on the field name.jpg i wanted it show just the name only.

Code: Select all

on mouseUp
   answer file "Please Choose Your Graphic"
   put it into tgraphicchoice
   revCopyFile tgraphicchoice,"C:\media\"
   set filename of image "homebiglogo" to tgraphicchoice
   set filename of image "TSHimage" to tgraphicchoice
   set the itemdelimiter to slash
   put item -1 of tgraphicchoice into teditedgraphicname
   put teditedgraphicname into field homebiglogo
end mouseUp
any one can help me out with it pls.

Re: Image name without extencion in an field?

Posted: Tue Jun 14, 2016 11:00 pm
by Klaus
Hi zutrix,

do this:

Code: Select all

on mouseUp
   answer file "Please Choose Your Graphic"
   put it into tgraphicchoice
   revCopyFile tgraphicchoice,"C:\media\"
   set THE filename of image "homebiglogo" to tgraphicchoice
   set THE filename of image "TSHimage" to tgraphicchoice
   set the itemdelimiter to slash
   put item -1 of tgraphicchoice into teditedgraphicname

   ## Now we set the itemdelimiter again, but to a DOT, and extract the first item of the remaining filename:
   set itemdel to "."
   put item 1 of teditedgraphicname into field "homebiglogo"
   ## ALWAYS put quotes around object names!
end mouseUp
Best

Klaus

Re: Image name without extencion in an field?

Posted: Wed Jun 15, 2016 1:29 am
by zutrix
Thank you very much works perfect!!