Image name without extencion in an field?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
zutrix
Posts: 5
Joined: Fri Oct 23, 2015 11:31 pm

Image name without extencion in an field?

Post by zutrix » Tue Jun 14, 2016 10:27 pm

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.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Image name without extencion in an field?

Post by Klaus » Tue Jun 14, 2016 11:00 pm

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

zutrix
Posts: 5
Joined: Fri Oct 23, 2015 11:31 pm

Re: Image name without extencion in an field?

Post by zutrix » Wed Jun 15, 2016 1:29 am

Thank you very much works perfect!!

Post Reply