--- In [email protected], "nickodemos2002" <nickodemos2...@...> wrote:
>
> Clip.ClearClipboard
> Win.Keys("^c")
> 
> sURL             = BrowserURL
> 
> sSubDomain       = BrowserSubDomain
> 
> sEditedSubDomain = ReplaceChars(Clip Select 15, ":", "_")
> 
> sEditedSubDomain = ReplaceChars(sEditedSubDomain, "\"", "-")
> 
> ; paste clipboard to file
> Clip.ToFile("D:\\ILC\\RS\\" ++ sEditedSubDomain ++ ".txt")
> 
> ; paste URL to file
> Exec.ToFile("D:\\ILC\\RS\\" ++ sEditedSubDomain ++ ".txt", "[" ++ sURL ++ "]")
> 
> This is basically copied right out of the manual except for the download 
> location. 
> 
> On another script I was able to use sTitle =
> win.caption("active") very well and get what I wanted but in
> trying to use it for the 'News Archiver' I can't figure out how
> to get it to save with the page name itself.

By "save with the page name" do you mean use the window caption text as the 
file name? or do you mean append the window caption to the bottom of the file 
text? If the latter you could just add another Exec.ToFile command similar to 
what you you have for sURL above.

If you want to use it as a file name, it would first need to have any 
characters illegal in file names removed. You could use a series of 
replacechars to substitute another character or remove any of the following: ? 
\ / * " < > |

Another alternative would be to use a regex replacement. If the caption is in 
sTitle the following should remove illegal characters.

sTitle = regex.pcrereplace((?"[\?\\/*\x22<>|]", sTitle "")
 
> Also just wondering if it is possible to set how many letters to
> go in before copying the name and how many letters from the end
> going backwards as well. So as to be able to change this: 
> Amazon.com: Ghostbusters (1984) - Mozilla Firefox
> To This:
> Ghostbusters (1984)

Look at the remove function. It can remove a fixed number of characters from 
the beginning or end of a string.

Again, using a regular expression might be easier.

The following would remove "Amazon.com: " from the beginning and " - Mozilla 
Firefox" from the end if either or both is found:

sTitle = regex.pcrereplace ;;+
(?"^Amazon.com: | - Mozilla Firefox$", sTitle, "")

The two could be combined, illegal file name characters and the amazon, firefox 
stuff:

sTitle = regex.pcrereplace ;;+
(?"^Amazon.com: | - Mozilla Firefox$|[\?\\/*\x22<>|]", sTitle, "")

Then you could use sTitle++".txt" instead of sEditedSubDomain++".txt" for the 
file name.

Regards,
Sheri

Reply via email to