Jump to content

Trouble with _StringBetween


Recommended Posts

I'm writing a script that I want to have find the filename of a download automatically

The part I'm having trouble on is below

It finds $sExt which is the file extension but I can't get it to search between "/" and $sExt to find the rest of the file name

Any ideas?

#include <String.au3>
$sDownload = "http://delphi.icm.edu.pl/ftp/tools/ResHack.zip"
    If $sFileName = 0 Then
        $sExt = StringRight($sDownload, 4)
        $sFileName = _StringBetween($sDownload, "/", $sExt)
        $ssFileName = $sFileName & $sExt
    EndIf
Link to comment
Share on other sites

I'm writing a script that I want to have find the filename of a download automatically

The part I'm having trouble on is below

It finds $sExt which is the file extension but I can't get it to search between "/" and $sExt to find the rest of the file name

Any ideas?

#include <String.au3>
$sDownload = "http://delphi.icm.edu.pl/ftp/tools/ResHack.zip"
    If $sFileName = 0 Then
        $sExt = StringRight($sDownload, 4)
        $sFileName = _StringBetween($sDownload, "/", $sExt)
        $ssFileName = $sFileName & $sExt
    EndIfoÝ÷ Ûú®¢×¢¶§+lmëmz»hºÇ¶¸§*bµ©Ý¶­².ÖÞÖ®¶­sbb33c·4F÷væÆöBÒgV÷C¶GG¢òöFVÇæ6ÒæVGRçÂögG÷FööÇ2õ&W46²ç¦gV÷C°¢b33c·7G"Ò7G&æu7ÆBb33c·4F÷væÆöBÂgV÷C²ògV÷C²¢b33c·G'2Ò7G&æu7ÆBb33c·7G%³eÒÂgV÷C²âgV÷C²¤×6t&÷ÂgV÷Cµ&W7VÇBgV÷C²Âb33c·7G%³5ÒfײgV÷C²ògV÷C²fײb33c·7G%³EÒfײgV÷C²ògV÷C²fײb33c·7G%³UÒfײgV÷C²ògV÷C²fײb33c·G'5³Ò
Edited by c4nm7
Link to comment
Share on other sites

I'm writing a script that I want to have find the filename of a download automatically

The part I'm having trouble on is below

It finds $sExt which is the file extension but I can't get it to search between "/" and $sExt to find the rest of the file name

Any ideas?

#include <String.au3>
$sDownload = "http://delphi.icm.edu.pl/ftp/tools/ResHack.zip"
    If $sFileName = 0 Then
        $sExt = StringRight($sDownload, 4)
        $sFileName = _StringBetween($sDownload, "/", $sExt)
        $ssFileName = $sFileName & $sExt
    EndIfƒoÝŠ÷ Ûú®¢×¢¶§’+lmëmz»hºÇ’¶¸§*bµ©Ý¶­².•ÖÞŠÖ®¶ˆ­sbb33c·4F÷væÆöBÒgV÷C¶‡GG¢òöFVdž’æ–6ÒæVGRçÂögG÷FööÇ2õ&W4†6²ç¦—gV÷C°¢b33c·7G"Ò7G&–æu7Æ—B‚b33c·4F÷væÆöBÂgV÷C²ògV÷C²¢b33c·G'2Ò7G&–æu7Æ—B‚b33c·7G%³eÒÂgV÷C²âgV÷C²¤×6t&÷‚ƒÂgV÷Cµ&W7VÇBgV÷C²Âb33c·7G%³5ÒfײgV÷C²ògV÷C²fײb33c·7G%³EÒfײgV÷C²ògV÷C²fײb33c·7G%³UÒfײgV÷C²ògV÷C²fײb33c·G'5³ÒoÝ÷ Ûú®¢×*.Á©íEëiÉ"r¥v{^v+jë¡ö§zºè®Çiº/zÊÛajÛ!¢é]mè­jëh×6$sDownload = "http://delphi.icm.edu.pl/ftp/tools/ResHack.zip"
$str = StringSplit($sDownload, "/")
$trs = StringSplit($str[6], ".")
MsgBox(0, "Result", $trs[1])
Link to comment
Share on other sites

Here's what I got

$sDownload = "http://delphi.icm.edu.pl/ftp/tools/ResHack.zip"
$str = StringSplit($sDownload, "/")
$show = _ArraySearch($str, ".zip")
$amount = $str[0]
MsgBox(0,"",$str[$amount])

Returns the file name (with extension which was not my original question) but that can be easily split, thanks for your help

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...