#Script For Organizing Hyperlinks?

13 messages · Page 1 of 1 (latest)

trim narwhal
#

sorting over 100 hyperlinks in textedit? i need a python or apple script to sort all my safari bookmarks over the years and all the ones ive wrote just arn't working. i have the hyperlinks in a textedit .rtf file they open just fine im trying to get them into groups like domain github, apple, ect any advice?

vernal oracle
#

The rtf files would need to be converted first to normal plain text so it can be easily parsed
I can probably write you another Python code that could work
(I’m not home though , I’d be home in like an hour )

trim narwhal
vernal oracle
trim narwhal
vernal oracle
#

@trim narwhal Hey buddy see what i mean?
your rtf file doesnt have actual links, ive rewritten the program though, and it should work if there are actual links

vernal oracle
#

so @trim narwhal after writing the program again and now it actually works so couple of things found in your code was:

  1. Bad file Reading mode
  2. Wrong Regular expression matching
  3. subprocess module import error
  4. Bad way of handling file operations

CHangelogs

  1. Prompt for directory of the file
  2. Script automatically saves the output file and also opens it.
  3. CONVERT THE RTF FILE TO PLAIN TEXT FOR IT TO WORK - I WOULD ATTACH THE TXT FILE AS WELL< AND YOU CAN ADD MORE LINKS TO IT AS YOU WISH TO
  4. Better file error handling
  5. Updated file Reading.
#

@trim narwhal this is the revised code which ive made and as you see it works just fine

#

And this is how to convert RTF files to plain text
(your rtf file doesnt have any links make sure it has links)

#

So here is the updated and correct RTF files along with how the txt file containing the links should be and then the main rtf.py file
(i added comments to the code so you can see what each stuff does )
You can download it here

HOPE THAT HELPS!

vernal oracle
#

@trim narwhal dont forget to tag post as resolved