LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
adeam
- Posts: 17
- Joined: Tue Dec 14, 2010 8:40 am
Post
by adeam » Wed Jan 02, 2013 12:42 pm
Hello,
I'm new with Mac OSX and Live Code and would like to know how to change a file’s last modified on Mac OSX. I tried the command below but it seems it doesn't work:
- launch touch -mt 201201010000 "/Users/
me/Documents/test.html" with "/Applications/Utilities/Terminal.app"
Could you kindly help me.
Thanks.

-
Klaus
- Posts: 14177
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Wed Jan 02, 2013 2:18 pm
Hi adeam,
you need to use the SHELL function to fire the actual terminal command like this:
...
put "/Users/me/Documents/test.html" into tFile2Touch
get shell("touch -mt 201201010000" && tFile2Touch)
...
You may need to escape the filename if it contains spaces etc.
Best
Klaus
-
adeam
- Posts: 17
- Joined: Tue Dec 14, 2010 8:40 am
Post
by adeam » Thu Jan 03, 2013 4:14 pm
Thanks Klaus

and happy new year
Concerning escape the filename if it contains spaces, is that applicable to folder names with spaces as well?
...
put "/Users/me/Documents/test v1/test with spaces.html" into tFile2Touch
get shell("touch -mt 201201010000" && tFile2Touch)
...
Thanks again.
-
Klaus
- Posts: 14177
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Thu Jan 03, 2013 4:43 pm
I think QUOTING your filenames for using with SHELL will do.
Code: Select all
...
put QUOTE & "/Users/me/Documents/test v1/test with spaces.html" & QUOTE into tFile2Touch
get shell("touch -mt 201201010000" && tFile2Touch)
...
I always have a little function for this in my stackscript:
Code: Select all
function q tString
return QUOTE & tString & QUOTE
end q
Use it like this (very handy and timesaving

):
Code: Select all
...
put q("/Users/me/Documents/test v1/test with spaces.html") into tFile2Touch
get shell("touch -mt 201201010000" && tFile2Touch)
...
Best
Klaus
-
adeam
- Posts: 17
- Joined: Tue Dec 14, 2010 8:40 am
Post
by adeam » Thu Jan 03, 2013 4:51 pm
Thanks a lot Klaus.
Adding QUOTE works perfectly. As well as using the function you've wrote.
...
put QUOTE & "/Users/me/Documents/test v1/test with spaces.html" & QUOTE into tFile2Touch
get shell("touch -mt 201201010000" && tFile2Touch)
...
Cheers.
