Syntax question [solved]

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
magice
Posts: 457
Joined: Wed Mar 18, 2009 12:57 am

Syntax question [solved]

Post by magice » Wed May 07, 2014 1:10 pm

This doesn't work.

Code: Select all

if there is not a folder "W:/Archives/"&tYear&"/"&tMonth then create folder "W:/Archives/"&tYear&"/"&tMonth
I believe it is an issue with quotation marks, but since the folder name tMonth and tYear are variables, I am having trouble finding the right combination to make it work.
Last edited by magice on Wed May 07, 2014 3:29 pm, edited 1 time in total.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Syntax question

Post by Dixie » Wed May 07, 2014 1:38 pm

Try this, putting a space between the ampersands and your variable names...

Code: Select all

if there is not a folder "W:/Archives/" & tYear & "/" & tMonth then create folder "W:/Archives/" & tYear & "/" & tMonth
or maybe..

Code: Select all

put "W:/Archives/"& tYear & "/" & tMonth into thePath
if there is not a folder thePath then create folder thePath
Last edited by Dixie on Wed May 07, 2014 1:40 pm, edited 1 time in total.

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

Re: Syntax question

Post by Klaus » Wed May 07, 2014 1:40 pm

Hi Magice,

ALWAYS use quotes around concatenated file- and object-names!

Code: Select all

...
if there is not a folder ("W:/Archives/"&tYear&"/"&tMonth) then 
   create folder ("W:/Archives/"&tYear&"/"&tMonth)
end if
...
Or use this way:

Code: Select all

...
put "W:/Archives/"&tYear&"/"&tMonth into tFolder
if there is not a folder tFolder then 
  create folder tFolder
end if
...
Best

Klaus

magice
Posts: 457
Joined: Wed Mar 18, 2009 12:57 am

Re: Syntax question

Post by magice » Wed May 07, 2014 1:52 pm

Thank you both. the parenthesis are exactly what I needed.

Post Reply