Talk About Network

Google




Programming > Applescript > Error 37 now an...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 1516 of 1697
Post > Topic >>

Error 37 now and then ?

by Mitrokhin <Mitrokhin@[EMAIL PROTECTED] > Oct 27, 2007 at 07:52 PM

This is perplexing, so I thought I ask the knowledable people
in here. The script below gives an error when I try combining files
in certain folders, but works fine when operating on others.

The exact error I get is this

---
"Bad name for file. Harddisk:Users:klr:Downloads:Lydb:Great Battles Of
The Ancient World:"

-37
---

A path like

"Harddisk:Users:klr:Downloads:Lydb:Great Scientific Ideas That Changed
the World:"

produces the same error, but eg. 

"Harddisk:Users:klr:Downloads:Lydb:The World of Byzantium:" 

works as intended. 

Does anybody have a clue as to why this is so ?


NB: the names of the files in the respective folders are perfectly
legal/normal.

=======


(*
Kombiner filer med *nix kommandoen cat
*)


display dialog "Kombiner filer

Vær opmærksom på om der findes danske bogstaver i fil- og biblioteks-
navne, da resultatet i så er fald uforud- sigeligt !" buttons
{"Cancel", "OK"} default button 2 with icon stop

try
   tell application "Finder" to set the source_folder to (folder of the
front window) as string
on error
   
end try

set the file_list to list folder source_folder without invisibles

-- It's when executing the next line that the script sometimes
-- stops with the -37 error

set the chosen_files to choose from list file_list with prompt
"Rækkefølgen er således (Marker alle):" with multiple selections
allowed
if chosen_files is equal to false then return

set file_paths to {}
repeat with aFile in chosen_files
   set aFile to aFile as string
   set aFile_path to quoted form of POSIX path of (source_folder &
aFile) & space
   set the end of file_paths to aFile_path
end repeat

set file_paths to (file_paths as string)

set the_name to the text returned of ¬
   (display dialog "Hvad skal den kombinerede fil hedde?" default
answer "" buttons {"Cancel", "OK"} default button 2 with icon note)

set cmdstring to "cat " & file_paths & " > " & quoted form of POSIX
path of (source_folder & the_name)

my DO_it(cmdstring)
--do shell script cmdstring

on DO_it(cmdstring)
   tell application "Terminal"
      activate
      if ((count of the window) = 0) or (the busy of window 1) then
         tell application "System Events"
            keystroke "n" using command down
            delay 1 -- sometimes "cd" is lost
         end tell
      end if
      delay 1
      do script cmdstring in window 1
   end tell
end DO_it

======

-- 
Hilsen
Mitrokhin.
 




 1 Posts in Topic:
Error 37 now and then ?
Mitrokhin <Mitrokhin@[  2007-10-27 19:52:37 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Mon Jan 5 19:18:10 PST 2009.