AcidCorps Posted July 21, 2007 Share Posted July 21, 2007 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 More sharing options...
AzKay Posted July 21, 2007 Share Posted July 21, 2007 I believe _StringBetween returns an array. I may be wrong there. # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
Gif Posted July 21, 2007 Share Posted July 21, 2007 (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 July 21, 2007 by c4nm7 Link to comment Share on other sites More sharing options...
Gif Posted July 21, 2007 Share Posted July 21, 2007 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 More sharing options...
AcidCorps Posted July 21, 2007 Author Share Posted July 21, 2007 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? Link to comment Share on other sites More sharing options...
AcidCorps Posted July 21, 2007 Author Share Posted July 21, 2007 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 More sharing options...
xcal Posted July 21, 2007 Share Posted July 21, 2007 $str = 'http://delphi.icm.edu.pl/ftp/tools/ResHack.zip' $ret = StringTrimLeft($str, StringInStr($str, '/', 0, -1)) MsgBox(0, '', $ret) How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
xcal Posted July 21, 2007 Share Posted July 21, 2007 Congratulations. How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
AzKay Posted July 21, 2007 Share Posted July 21, 2007 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- # Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now