How to manage file name containing a date with /

Dar Scott dsc at swcp.com
Mon Jul 22 10:11:47 EDT 2013


I think I might not be under standing the situation.

Questions inline.

On Jul 22, 2013, at 6:50 AM, André Bisseret wrote:

> Bonjour,
> 
> Jacque, Dar and Peter, thank you much for your attention to my problem.
> Since your posts I made a number of trials during the weekend, following your suggestions but with no success.
> 
> Reminder : the names of the files I am trying to launch from script have the following format :
> Joe PATIENT - bio checkup - 09/2013.pdf

How do you know it has a "/"?  If it has a ":" in OS X Finder and a dot of some sort in Windows Explorer, how do you know about "/"?  Was that what was typed in at the scanner or at some strange OS?  
> 
> On Mac the slash is replace automatically by colon (:) (don't know why!)

I'm not sure what "replaced by" means.  Do you mean after a copy?  Or do you mean as viewed from a Mac, that is the file server file or flash drive file looks different depending on what system is looking at it?  

> Anyway, all is working well 
> I can open a file by double-clicking on it in the folder 
> And, I can launch it by script (using its filename). No problem.
> -------
> On Windows, the : (colon) is replaced with what seems to be a character ( a kind of dot. (or small bullet point?) with a sort of white space before it and a white space after. But, these are not "space" character (one can't delete them; on can only select the all 

Replace?  As above.  Is this after a copy or as viewed from Windows?

> - Double-clicking on a document opens it (good)

I see. The symbol in the file name is shown as a dot of some sort.  That might be the actual character there or it might be some representation of a bad filename character.  If that bad character is actually a slash, you have a couple barriers in opening the file.  First of all, the slash is processed by LiveCode and converted to backslash in filenames.  Second, windows might interpret that as the end of the file name and the rest is some parameter of some sort; I'm not sure.

You might get some indication of what character is there by using dir in the command window.  Or use the LiveCode files() function.  You can try that.  Or pull out the exact code that files() returns for that character and use it.

Here are some things you can try that might launch the document without knowing what that character is:

Try LiveCode 'launch' with a question mark for the character.  I doubt that will work, but it is an easy test.  Try backslash & slash for the character.  

Try launching with shell() on Windows.  Try these:

get shell( quote & "Joe PATIENT - bio checkup - 09?2013.pdf" & quote)  -- wildcard
get shell( quote & "Joe PATIENT - bio checkup - 09/2013.pdf" & quote)  -- quote slash

get shell( "start " quote & quote & space & quote & "Joe PATIENT - bio checkup - 09?2013.pdf" & quote)
get shell( "start " quote & quote & space & quote & "Joe PATIENT - bio checkup - 09/2013.pdf" & quote)


> - But to launch a document from a script I need to replace : (colon) with this dot in the filename of the document.
> I can't!!!
> - When  I copy this "dot" and paste it in the script editor, it is immediately replaced with "?"
> and replacing colon by ? does not work
> -----
> I tried pasting it in the message box: there, it is immediately replace with "ð :(quote followed by ð
> trying to replace colon :
> - I can't use  "ð (I suppose it's because they are 2 characters)
> - trying only ð does not work
> 
> - In the message box of the PC I tried to get the number of this (kind of) dot
> put CharToNum('') and pasting a copy of the "dot" between the 2 quotes as suggested by Jacque
> the dot is immediately replaced by "ð
> and I get the error: error: Script: missing " after literal
> 
> the ASCII number of " is 34 and those of ð is 240
> so I tried put numToChar(34) & numToChar(240) into tVar
> replace ":" by tVar in tDocName > does not work
> 
> I don't know what I could do next?
> 
> Dar, there are several thousands files with such names ; I can't imagine the only solution be to change ( manually) all these names!
> I am using livecode (rev) since 2006; it is the first time I am blocked that much 
> 
> Any other idea?
> 
> Thanks a lot in advance for any help
> 
> Best regards
> 
> André
> 
> 
> 
> 
> 
> 
> Le 19 juil. 2013 à 17:24, J. Landman Gay a écrit :
> 
>> "André Bisseret" <andre.bisseret at wanadoo.fr> wrote:
>>> So I tried 
>>> put quote & numToChar(240) into tVar
>>> replace ":" with tVar in tDocName  > again no success 
>>> 
>>> When I paste the mysterious char directly in the script it is
>>> immediately replaced by "?" 
>> 
>> In the message box,  do this :
>> 
>> put charToNum('')  
>> 
>> and paste the copied character between the quotes.  That gives you the actual number of the character being used. Then in your script use numToChar(<whatever>) to do the replacements. 
>> -- 
>> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
>> HyperActive Software           |     http://www.hyperactivesw.com
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list