Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Sep 6, 2013, 03:59 PM   #1
wild4life2013
macrumors newbie
 
Join Date: Mar 2013
sorting a list of dates and times (applescript)

I am looking for a way to sort a list of dates and if there is a date the same then sort by time.

Code:
set a_RandomExampleList to {"Some Event 1/2/2014", "Another Event 2/6/2014", "Some Other Event 1/6/2014", "The Magic show 2/2/2014 14:00", "Band 2/2/2014 13:00"}
thanks for any help
wild4life2013 is offline   0 Reply With Quote
Old Sep 6, 2013, 05:26 PM   #2
larswik
macrumors 65816
 
Join Date: Sep 2006
I think your are going to need to post some real code for people to help you out with. If you have no examples of what you done then there is no way to help you resolve the problem.
__________________
I know more than yesterday.
Lars
larswik is offline   0 Reply With Quote
Old Sep 6, 2013, 08:02 PM   #3
dmi
macrumors member
 
Join Date: Dec 2010
Code:
set a_RandomExampleList to {"Some Event 1/2/2014", "Another Event 2/6/2014", "Some Other Event 1/6/2014", "The Magic show 2/2/2014 14:00", "Band 2/2/2014 13:00"}
set old_delims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {ASCII character 10}
set list_string to (a_RandomExampleList as string)
set new_string to do shell script "echo " & quoted form of list_string & " | perl -e 'print map/\\0(.*)/s,sort map sprintf(qq(%4d%2d%2d%s\\0%s),(m{(.*?(\\d+)/(\\d+)/(\\d+)(.*))}s)[3,1,2,4,0]),<>'"
set new_list to (paragraphs of new_string)
set AppleScript's text item delimiters to old_delims
return new_list
dmi is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 10:16 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC