Getting Finder results into LiveCode

Kay C Lan lan.kc.macmail at gmail.com
Mon Jan 11 09:11:43 EST 2016


On Mon, Jan 11, 2016 at 7:51 PM, Francis Nugent Dixon <effendi at wanadoo.fr>
wrote:

>
> I use “cmd F” to find documents on my computer
> (never got round to using Spotlight).
>

Absolutely love Spotlight, use it hundreds of time a day and it saves me an
incalculable amount of time and effort. Have successfully weened my wife
onto it. Once you've learned to cmd + spacebar + type a few letters of the
App/Folder/File/Contact/Preference/email content.... then hit Return when
the one you are looking for is hilited, you'll never go back to mousing
around the Finder. Spotlight is to Finder like LiveCode is to C

Is there a way to get the results of such a “Find”
> inside a Rev stack ? Anybody done this ???
>

You can 'do <commands> as AppleScript' but it's long and convoluted and
AppleScript is so ugly once you've worked with LC. ;-)


> I am a buggar for backups, and for one original, I
> have copies on several of my external disks.
> I want to update all the copies of a file that I just
> modified, and by hand, it’s a pain !
>
> Sounds like you simply need a good piece of back-up software. Love Carbon
Copy Cloner myself; have different types of backups (Archive, Clone, entire
disc, specific folders, different schedules...) all set up for different
and typically multiple discs and if any of them are missed because the
laptop either isn't connected to the network disks or physically connected
to the direct connect disks then as soon as they are connected the
backups/archive will run. Painless.

http://bombich.com/

But for this particular situation you could go with the less capable but
highly suited to your case and less expensive, SuperDuper

http://www.shirt-pocket.com/SuperDuper/SuperDuperDescription.html


> And just in case I haven’t got enough, is there a way
> to display in a liveCode stack the results of a “Get Info”
> from the finder ?
>

have a look at the 'files' entry in the Dictionary, particularly the
'detailed files' entry which gives you all you should need.

>
> I seem to spend half my life in "housekeeping"
>

But this all begs the question. Unless you are constantly moving your
Master file around surely you know where your Master file is and where the
back-ups are and so could easily hard code the file patht into LC and have
it check the 'detailed file' info and see if you need a fresh copy on your
back-up. It's then up to you, are you after an Archive or a straight back
up? Either way you will always use the rename (look it up in the
Dictionary) command to Rename the Old file to include a Date time stamp
before you do the copy. This ensures nothing is lost should the copy fail -
power failure half way thru. Once renamed you can then copy the file
across. From memory (and I'm probably wrong here) LC can't copy files from
one HD to another. I've used the shell command 'ditto' for file transfer
across HDs. Look up 'ditto' in your favourite Man Page viewer. To use shell
commands in LC look up 'shell' in the Dictionary. If you are after an
archive you are done, if you need a simple back-up then you'll need to
Trash the old time stamped file.

Hint: the easiest way to get a file or folder's full path name as required
by these LC commands is to:

type cmd + space bar   then   'ter'   Terminal should now be hilited in
Spotlight. Press Return and Terminal will start up. All you then have to do
is drag any file or folder into the Terminal window and it's full file path
is revealed.

WARNING: the Dictionary entry for revDeleteFolder says that on OS X it uses
AppleScript to place the folder into the Trash. This is incorrect, the
folder is nuked, gone, lost, never to return. This is a CONFIRMED bug #
15176. 'delete file' does the same, but thankfully the Dictionary warns you
it's permanent.

If you are paranoid, then instead of using revDeleteFolder or delete file,
use the rename command to move the file/folder to the Trash. That way it
can still be recovered until you manually empty the Trash

rename file "/Volumes/Backup Disk 7/MyLifesWork 2016112211.livecode" to
"/Volumes/Backup Disk 7/.Trash/MyLifesWork 2016112211.livecode"

Note the intentional period before Trash

You can do this for Files or Folders. I use to do this ages ago until I
eventually bought Carbon Copy Cloner, my files are too way precious it just
didn't make cents (yes with a c) to risk them with my own code ;-)

I'm sorry if this sounds like I'm telling you to suck eggs but I know there
are many lurkers on this List so I write for the lowest common denominator
who may be reading - which I appreciate isn't you.  :-)



More information about the Use-livecode mailing list