Hi,
how can I use Simba to download a file from the internet and save it as .jpg for example ?
Hope you can help
caused
Hi,
how can I use Simba to download a file from the internet and save it as .jpg for example ?
Hope you can help
caused
I used this to download sps maps for my scripts if they werent present! Credit goes to The Mayor
Simba Code:procedure checkForFile(path, url, name: String);
var
itemName: String;
itemFile: LongInt;
begin
itemName := appPath + path;
if fileExists(itemName) then
begin
writeLn(name + ' already exists');
exit();
end;
writeLn('Downloading ' + name);
showMessage('You''re missing the ' + name + chr(13) + chr(13) + 'Downloading it now!');
closeFile(createFile(itemName));
itemFile := reWriteFile(itemName, false);
writeFileString(itemFile, getPage(url));
closeFile(itemFile);
end;
then an example to put this to use would be
Simba Code:checkForFile('Includes/SPS/img/runescape_surface/CourseSurface_0.png', 'http://i.imgur.com/3vZAOVm.png', 'Course Surface Map');
not sure what other file types it would support, as i haven't tried anything else.
My Scripts:
Alch-O-Matic --- Enchant-O-Matic --- AIO Portable-O-Matic --- Wilderness Agility --- Ivy Chop-O-Matic --- Bone-O-Matic
Thanks I tried getpage(); as well but It didnt really work, but writeFileString works great ... Thanks.
I edited your function to this:
Code:procedure downloadFile(path, url: String); var itemName: String; itemFile: LongInt; begin writeLn('Downloading ' + url); closeFile(createFile(path)); itemFile := reWriteFile(path, false); writeFileString(itemFile, getPage(url)); closeFile(itemFile); end;
Glad I could help!
My Scripts:
Alch-O-Matic --- Enchant-O-Matic --- AIO Portable-O-Matic --- Wilderness Agility --- Ivy Chop-O-Matic --- Bone-O-Matic
There are currently 1 users browsing this thread. (0 members and 1 guests)