Alphabetical Order

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
PepsiHog
Automation Wizard
Posts: 511
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Alphabetical Order

Post by PepsiHog » Tue Jun 06, 2017 8:07 pm

Hi there everyone. Been so long since I last logged in that I had to take a second try at my password.

Ok. Soooo.... any way. I need help. But let's talk MS. LOL!!

Does anyone have a formula for putting names in alphabetical order? I need to put actor names in alphabetical order to sort my movies by the actor.

I would think there would be a formula for this. But maybe I'm selling crazy.

Thanks,
PepsiHog
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
Djek
Pro Scripter
Posts: 147
Joined: Sat Feb 05, 2005 11:35 pm
Location: Holland
Contact:

Re: Alphabetical Order

Post by Djek » Tue Jun 06, 2017 10:19 pm

hey PepsiHog,

well, about this problem of yours i am very curious, because i once needed a list sorted so i build it myself.
But i am sure there must be a more normal way to do this.
Anyways, its quick, (because the sorting isnt programmed) and it works.
Just be sure not to have illegal characters in your actor names..

here is my solution:

Code: Select all

//pepsiHog
//
let>tempdir=%SCRIPT_DIR%\tempph
let>sortedfile=%SCRIPT_DIR%\sorted.txt
let>actorlist=James Dean,Schwazzenegger,Sophia Loren,Bing Crosby,Andrew de Groot,Zeger van Oord

Separate>actorlist,%COMMA%,listin
DeleteFolder>tempdir
CreateDir>tempdir

Let>k=0
Repeat>k
  Let>k=k+1
  let>fileout=listin_%k%
  WriteLn>%tempdir%\%fileout%,ert,
Until>k,listin_count
Label>end
let>GFL_SORTTYPE=3
GetFileList>%tempdir%\*.*,listout,#

Separate>listout,#,file_names
DeleteFile>sortedfile
Let>k=0
Repeat>k
  Let>k=k+1
  let>fileout=file_names_%k%
  ExtractFileName>fileout,writeout
  WriteLn>sortedfile,ert,writeout
Until>k,file_names_count

ExecuteFile>sortedfile

kind regards
Djek

User avatar
PepsiHog
Automation Wizard
Posts: 511
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Re: Alphabetical Order

Post by PepsiHog » Tue Jun 06, 2017 10:43 pm

Thanks Djek.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Alphabetical Order

Post by Marcus Tettmar » Wed Jun 07, 2017 9:53 am

Just use the ArraySort function.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Djek
Pro Scripter
Posts: 147
Joined: Sat Feb 05, 2005 11:35 pm
Location: Holland
Contact:

Re: Alphabetical Order

Post by Djek » Wed Jun 07, 2017 10:59 am

much better, Marcus,

i did nt know about that command,

kind regards
Djek

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts