Sign in to follow this  
Followers 0
AcidCorps

Trouble with _StringBetween

9 posts in this topic

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

Share this post


Link to post
Share on other sites



I believe _StringBetween returns an array.

I may be wrong there.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
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])

Share this post


Link to post
Share on other sites

The URL will not always be the same, how would I put it so that it takes the right string from the $str every time?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Could also use: _PathSplit()

#include <file.au3>
#include <array.au3>
Dim $szDrive, $szDir, $szFName, $szExt
$TestPath = _PathSplit(@ScriptFullPath, $szDrive, $szDir, $szFName, $szExt)
_ArrayDisplay($TestPath,"Demo _PathSplit()")

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
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
Sign in to follow this  
Followers 0