Current Position:Home > How can I get the Voice memo's source computer file to keep the original file name?

How can I get the Voice memo's source computer file to keep the original file name?

Update:10-11Source: network consolidation
Advertisement
     I ran out of space in my iPhone some weeks ago and I've been cleaning up. I am pretty much done deleting the photos and apps. The only thing I need to finish is erasing my voice memos. I already synced my music/voice memos with my computer, the only problem is that when I get the files from the iTunes media it changes the name and makes it extremely hard to organize. I want to upload this files to another website so I can access them freely.
I would REALLY appreciated if anyone could tell me how to fix this or if you have another method please tell me.

The Best Answer

Advertisement
This is pretty straightforward.
If the file isn't too big you can just read the entire file contents:
set fileContents to read file "HD:path:to:the:file.txt"
Once you've read it in, you can iterate through it with a repeat loop like:
repeat with eachParagraph in (paragraphs of fileContents)
  -- code here to process each line
end repeat
Within the loop, eachParagraph represents each successive line in the file, so all you need to do is pull out the data you want. Now your subject says that your file is tab-delimited, but your example uses commas, so you may need to adjust this script depending on what's actually the case:
set my text item delimiters to tab -- or "," as appropriate
set firstName to text item 1 of eachParagraph
set lastName to text item 2 of eachParagraph
set emailAddr to last text item of eachParagraph
-- rest of code here to send an email
The last thing to do is to reset the 'text item delimiters' to their previous value so you don't end up getting confused.
So, putting that all together you end up with something like:
set fileContents to read file "HD:path:to:the:file.txt"
set oldTIDs to my text item delimiters -- additional code to remember the current TIDs
set my text item delimiters to tab -- or ","
repeat with eachParagraph in (paragraphs of fileContents)
  set firstName to text item 1 of eachParagraph
  set lastName to text item 2 of eachParagraph
  set emailAddr to last text item of eachParagraph
  -- rest of code here to send an email
end repeat
set my text item delimiters to oldTIDs -- restore the TIDs for cleanliness
Note that this should work for reasonably-sized files (up to a few thousand records). If it's much more than that you may need something a little more sophisticated to read the file progressively rather than all at once.