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

Similar Threads
thread Thread Starter Forum Replies Last Post
select data to use in "Choose From List" list in applescript ShuddaRunThat Mac Programming 2 Apr 1, 2014 06:31 PM
Same dispatch times, different delivery dates? AndyK Buying Tips and Advice 1 Nov 3, 2013 05:02 AM
automatically import table dates/times into iCal? modbox14 Mac Programming 0 Oct 25, 2012 05:12 AM
all my ical dates and times changed randomly! kwren Mac Basics and Help 2 Oct 8, 2012 11:04 AM

Forum Jump

All times are GMT -5. The time now is 04:05 AM.

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

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