[proFit-list] pro Fit and Applescript…doesn't like '/' in file names
Dave
glasspusher at outofoptions.net
Fri Nov 18 23:39:42 CST 2011
Hi Kurt,
Yeah, you're right. I think I got suckered in there by concentrating on my science and not my programming.
OS X will let you save something with a '/' in the file name, but internally converts it to a ':' character, and displays the ':' as a '/' in the Finder as well.
I wrote an app in Cocoa for doing cyclic voltammetry, and I'm doing a bunch of scans at different scan rates, and the app lets me save stuff as "foo at 20 mV/s" and I got lulled into complacency.
I think the problem resides not with applescript nor pro Fit, but with me. Fixed. ;)
Thanks,
Dave
On Nov 18, 2011, at 9:21 PM, proFit Support wrote:
> Dear Dave
>
> In the present case, I do not really know if the problem resides in Apple Script or in pro Fit. However, using a "/" in a file name is generally not recommended, see any of the following:
> http://www.jmu.edu/computing/mac/filenamesOSX.shtml
> http://reviews.cnet.com/8301-13727_7-10342944-263.html
> http://documentation.apple.com/en/finalcutpro/usermanual/index.html#chapter=3%26section=4%26tasks=true
> http://www.google.ch/search?q=macos+slash+in+filename
>
> Best regards
>
> Kurt Sutter
> QuantumSoft
>
> On 19. Nov 2011, at 0:41, Dave Sopchak wrote:
>
>> Hi all,
>>
>> I found out the hard way that pro Fit will give an error if you're trying to save a file while running from an Applescript and the file name or path has a '/' character in it. Bug or feature?
>>
>> The app itself can save files with a '/' character in the name, but I noticed on text file imports, while the data window's name has a '/' character in it, when you go to save, the '/' is converted to a '-'.
>>
>> Here's some example code and a workaround…
>>
>>
>> Cheers,
>> Dave
>>
>>
>> set bar to (theFile as text) & ", pro fit data"
>>
>> set foo to replace_chars(bar, "/", "-")
>>
>> tell application "pro Fit 6.2.4"
>> activate
>> data import options mode custom headerLines 2 delimiter "*\\w" terminator "\\R" title delimiter "\\w" with copyInfo and titles
>> open theFile as data window
>>
>> save window 1 in foo
>> end tell
>>
>>
>> on replace_chars(this_text, search_string, replacement_string)
>> set AppleScript's text item delimiters to the search_string
>> set the item_list to every text item of this_text
>> set AppleScript's text item delimiters to the replacement_string
>> set this_text to the item_list as string
>> set AppleScript's text item delimiters to ""
>> return this_text
>> end replace_chars
>>
>>
>> _______________________________________________
>> proFit-list mailing list
>> proFit-list at quantum-soft.com
>> http://quantum-soft.com/mailman/listinfo/profit-list_quantum-soft.com
>
>
> _______________________________________________
> proFit-list mailing list
> proFit-list at quantum-soft.com
> http://quantum-soft.com/mailman/listinfo/profit-list_quantum-soft.com
More information about the proFit-list
mailing list