allcapone1912 7 Posted March 30, 2015 Report Share Posted March 30, 2015 hi,need to save a lot of images direct from url and save them with there defauld name add list to list(%image url,$list from file("C:\\Users\\admin\\Desktop\\image url list.txt"),"Delete","Global") loop($list total(%image url)) { set(#image name,$next list item(%image url),"Global") plugin command("SocketCommands.dll", "socket container") { plugin command("SocketCommands.dll", "socket download file", $next list item(%image url), "D:\\image\\1.jpg") } } but i want the image to be saved not with 1.jpg but with default namefor example:http://www.abc.net.au/news/image/4243128-3x2-940x627.jpgscript download image from above link and save image with name "4243128-3x2-940x627.jpg" its seem to me that this type of operation have to be done with regex Quote Link to post Share on other sites
deliter 203 Posted March 31, 2015 Report Share Posted March 31, 2015 so your code,the image URLS are saved in the list from file on your desktop,and you want each of those list items,to be the name of each of the saved files,which is the value of {#image name} ,if that assumption is correct then,ive also added a counter,I know you are new but try getting away from the next list item,their is a lot of uses for knowing where you are in your loop from a debugging perspective,but really their is a lot more to why you need to use them,I honestly can't remember how the next list item works,if the next list item increases after every loop or since you have two their so it goes up each time it is called,anyways,add list to list(%image url,$list from file("C:\\Users\\admin\\Desktop\\image url list.txt"),"Delete","Global")set(#list counter,0,"Global")loop($list total(%image url)) { plugin command("SocketCommands.dll", "socket container") { plugin command("SocketCommands.dll", "socket download file", $list item(%image url,#list counter), "D:\\image\\{$replace regular expression($find regular expression($list item(%image url,#list counter),"image.+"),"image/","")}") } increment(#list counter)} My regex sucks bad,but it should work Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted March 31, 2015 Report Share Posted March 31, 2015 you can do like this too set(#DL URL, "http://www.abc.net.au/news/image/4243128-3x2-940x627.jpg", "Global")set(#file name, $replace regular expression(#DL URL, ".*/", $nothing), "Global")alert(#file name)download file(#DL URL, "{$special folder("Desktop")}\\{#file name}")stop scriptcomment("you can do like this too")download file(#DL URL, "{$special folder("Desktop")}\\{$replace regular expression(#DL URL, ".*/", $nothing)}") if you use sockets you can not use proxies yet. so may as well do like this if you must it is same idea CD 1 Quote Link to post Share on other sites
allcapone1912 7 Posted March 31, 2015 Author Report Share Posted March 31, 2015 so your code,the image URLS are saved in the list from file on your desktop,and you want each of those list items,to be the name of each of the saved files,which is the value of {#image name} ,if that assumption is correct then,ive also added a counter,I know you are new but try getting away from the next list item,their is a lot of uses for knowing where you are in your loop from a debugging perspective,but really their is a lot more to why you need to use them,I honestly can't remember how the next list item works,if the next list item increases after every loop or since you have two their so it goes up each time it is called,anyways,add list to list(%image url,$list from file("C:\\Users\\admin\\Desktop\\image url list.txt"),"Delete","Global")set(#list counter,0,"Global")loop($list total(%image url)) { plugin command("SocketCommands.dll", "socket container") { plugin command("SocketCommands.dll", "socket download file", $list item(%image url,#list counter), "D:\\image\\{$replace regular expression($find regular expression($list item(%image url,#list counter),"image.+"),"image/","")}") } increment(#list counter)} My regex sucks bad,but it should worki understand your idea and thanks for helpingyour code will work only if image are in "image" folder but not all images have before them "image/" Quote Link to post Share on other sites
allcapone1912 7 Posted March 31, 2015 Author Report Share Posted March 31, 2015 you can do like this too set(#DL URL, "http://www.abc.net.au/news/image/4243128-3x2-940x627.jpg", "Global")set(#file name, $replace regular expression(#DL URL, ".*/", $nothing), "Global")alert(#file name)download file(#DL URL, "{$special folder("Desktop")}\\{#file name}")stop scriptcomment("you can do like this too")download file(#DL URL, "{$special folder("Desktop")}\\{$replace regular expression(#DL URL, ".*/", $nothing)}") if you use sockets you can not use proxies yet. so may as well do like this if you must it is same idea CDGreat,your code work excellent Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.