AdBlock.ini auto updater

Iron Forum for english speaking people

jazluvr
Posts: 129
Joined: Sun Sep 05, 2010 5:03 pm

Re: AdBlock.ini auto updater

Post by jazluvr »

I forgot to mention i updated it manually, by copying all the text and overwriting the existing file. Hence the extra folders in the search. I'm cool with updating it manually one a week, as i don't see much changes in fanboys list in 2-4 days. I'm not even sure if that configuration file is working, Arflech, i pasted one of those lists by Peter Lowe in the lan settings and checked use as automatic configuration script. Does that thing get updated by itself?
ironuser
Posts: 388
Joined: Mon Feb 01, 2010 12:29 am

Re: AdBlock.ini auto updater

Post by ironuser »

>jazluvr another thought, Are you trying to update the adblcok.ini file while Iron is running?
That link you referenced in you post ( http://www.srware.net/forum/viewtopic.p ... 2&start=10 ) has a statement that points out the adbock.ini file CANNOT be updated while Iron is running.
arflech wrote: As I already said, there is a file in the Iron program directory called "adblock.ini" and Iron uses this file to block content from being downloaded; this has been there for nearly 2 years, from the very beginning of SRWare Iron (even back when there were no extensions), it uses no extension and cannot be updated while Iron is running
Also, from our last posts, Iron will not start without the adblock file present. The program apparently looks for it. It will run if the adblock file is blanked out. I have verified both just a few minutes ago.
jazluvr
Posts: 129
Joined: Sun Sep 05, 2010 5:03 pm

Re: AdBlock.ini auto updater

Post by jazluvr »

ironuser wrote:>jazluvr another thought, Are you trying to update the adblcok.ini file while Iron is running?
That link you referenced in you post ( http://www.srware.net/forum/viewtopic.p ... 2&start=10 ) has a statement that points out the adbock.ini file CANNOT be updated while Iron is running.
arflech wrote: As I already said, there is a file in the Iron program directory called "adblock.ini" and Iron uses this file to block content from being downloaded; this has been there for nearly 2 years, from the very beginning of SRWare Iron (even back when there were no extensions), it uses no extension and cannot be updated while Iron is running
Also, from our last posts, Iron will not start without the adblock file present. The program apparently looks for it. It will run if the adblock file is blanked out. I have verified both just a few minutes ago.

No, i close the browser out when i try to update it. Actually, that's supposed to be the updaters job at startup, (which we know now isn't working). I've even tried to leave it open and double click the updater. And but when i manually update by dragging the copied text from the fanboy list from desktop to the iron folder and place it over the adblock.ini file, it overwrites it.

I'm thinking of saving some of my stuff (links>scroogle...etc) and re-downloading and re-installing Iron and see if that makes a difference. But I got to much to do today. But when i have time i will re-install all of this stuff and see if i can get it working, but for now, I'm done. Thanks again Ironuser, you're a patient, good guy. This forum is great and i love this browser. i mean, I'm a diehard fan of it, now that i see what running a browser that's not connected to a server and using fanboys adblock list does.

I belong to a very popular boxing website and it depends on a very intrusive virus laden website and lots of people have trouble if they're not using FF, Chrome or Iron..IE people have constant problems. That's what made me give it up...hahaha. I have no problems at all with this browser, no page redirects, pop-ups, crashes, its just fast and trouble free.
So, We'll save that for a rainy, (or in my case, a snowy day). Thanks again.
And like i said i have an .ini file for ccleaner to get it to work with Iron and it works like a charm.
r0lZ
Posts: 2
Joined: Tue Oct 19, 2010 2:58 pm

Re: AdBlock.ini auto updater

Post by r0lZ »

You forget that under Vista and Win 7, you CANNOT write directly in the Program Files and Program Files (x86) folders. Only an installer can do that, if you accept the UAC prompt. So, if you edit the VBS script in that folder with a text editor, you may have the feeling that your edits are saved correctly, but instead of modifying the file in Program Files, you have created an image of the file in C:\Users\<your_name>\AppData\Local\VirtualStore\Program Files (or Program Files (x86)). Similarly, the script CANNOT overwrite the ini file in Program Files, but will just create a mirror image of the INI file in VirtualStore.

The program that loads the modified file MAY find it in VirtualStore, but ONLY if is is poorly designed, and not UAC compliant. I suppose that Iron is UAC compliant, so it will almost certainly load the file in Program Files, and it will not use the updated INI from the VirtualStore folder. So, unfortunately, as long as Iron stores its configuration file in Program Files, it will be impossible to update it automatically.

To verify if a file has really been updated in Program Files, copy it first on your desktop, and then examine it. You will almost certainly see the original, unmodified version of the file.

Of course, if you want to automatically update the INI file, you can install Iron in a folder where you have full access rights (such as in a "Programs" folder created in your "My Documents" folder). Also, of course, there is no problem to update the INI file with the portable version of Iron, as portable apps are usually installed in non-protected folders. I use the portable version anyway, and the script works well for me.

I hope this helps.
jazluvr
Posts: 129
Joined: Sun Sep 05, 2010 5:03 pm

Re: AdBlock.ini auto updater

Post by jazluvr »

@rOIZ...anybody that is using the auto updater with the modified .ini script that works got anything to say about this post? Do you all have Iron installed in the default "Program Files" folder?
r0lZ
Posts: 2
Joined: Tue Oct 19, 2010 2:58 pm

Re: AdBlock.ini auto updater

Post by r0lZ »

Well, honestly, I haven't analyzed the problem completely, as I haven't any problem with my setup (installation in a special folder where I put all programs that do not need to be installed with an installer, and all portable programs). But the symptoms described here are most probably due to the fact that there is a mess with the regular Program Files folder and its image in VirtualStore.

Anyway, it's always a bad practice to store a configuration file in Program Files. That practice is denounced by M$ since years, and now, since Vista and Win7, it is extremely difficult to still do it. The config files should be stored in AppData, or in a sub folder in the application's install directory if and only if the program is portable and installed in a non-protected directory. (The config files must certainly not be installed in the TEMP dir as suggested elsewhere, as this folder is emptied automatically regularly by Windows and other tools such as CCleaner.)

So, IMO, the problem is due to the bad way Iron stores its INI files. Until they fix that problem, you have to live with it. The easiest way to overcome the problem is to install Iron somewhere else. (If you install the portable version, you will also have the benefit that you will not lose your config and extensions if you need to re-install Windows.)

Have you verified if you have a VirtualStore\Program Files\Iron folder? If it's the case, then that means that a program (probably the INI updater or your text editor) has tried to overwrite the INI file in Program Files\Iron, but without success, and you can be almost sure that the problems described here are due to that fact.
Cattleya
Posts: 3
Joined: Wed Oct 20, 2010 5:26 am

Re: AdBlock.ini auto updater

Post by Cattleya »

I can't download this attachment: http://www.srware.net/forum/download/file.php?id=98
icyboy
Posts: 4
Joined: Wed Mar 09, 2011 10:27 am

Re: AdBlock.ini auto updater

Post by icyboy »

Cattleya wrote:I can't download this attachment: http://www.srware.net/forum/download/file.php?id=98
me too :x
ironuser
Posts: 388
Joined: Mon Feb 01, 2010 12:29 am

Re: AdBlock.ini auto updater

Post by ironuser »

That attachment has been removed by the forum moderators. I don't know why!
COPY and PASTE the following into a Notepad document, SAVE it to your desktop, and DOUBLE click it(with IRON NOT RUNNING) to update the adblcok.ini file. NOTE>> IF YOU HAVE WIN7 YOU MAY HAVE TO TWEAK THE 'const destination = "C:/Program Files//SRWare Iron/adblock.ini" LINE OF CODE.
I did not write this, I believe it is fanboy's script.
PS: Forgot, the https in the 'const source' line can be changed to plain old http if you don't want to use the secure server.

Code: Select all

option explicit

' -----------------------------------------------------------------------------
' PARAMETERS
' -----------------------------------------------------------------------------
const source = "https://secure.fanboy.co.nz/iron/complete/adblock.ini"
const destination = "C:/Program Files//SRWare Iron/adblock.ini"  
' -----------------------------------------------------------------------------

UpdateAdBlock source, destination

sub UpdateAdBlock(source, destination)
	
	' download adblock.ini
	GetHtmlPage source, destination
	
	' show message
	dim s : s = ReadFirstLines(destination, 3)
	Dim WshShell 
	Set WshShell = CreateObject("WScript.Shell") 
	WshShell.popup s, 3, "Adblock updated",	64
	'MsgBox s, vbInformation, "Adblock updated"

end sub


sub GetHtmlPage (up_http, down_http)

	dim xmlhttp : set xmlhttp = createobject("msxml2.xmlhttp.3.0")
	xmlhttp.open "get", up_http, false
	xmlhttp.send

	dim fso : set fso = createobject ("scripting.filesystemobject")

	dim newfile : set newfile = fso.createtextfile(down_http, true)
	
	'and the text from the XMLHTTP response can then be written to the file:
	newfile.write (xmlhttp.responseText)

	'the file must then be closed:
	newfile.close

	set newfile = nothing
	set xmlhttp = nothing
	set fso = nothing

end sub


function ReadFirstLines(fileName, numberOfLines)
	
	const wChar = "§"
	dim res
	
	' open text file
	dim fso : set fso = createobject ("scripting.filesystemobject")
	dim ts : set ts = fso.OpenTextFile(fileName)
	
	' read the first x lines
	dim x
	for x = 1 to numberOfLines
		res = res & ts.ReadLine & wChar
	next
	
	ts.close
	set ts = Nothing
	set fso = Nothing
	
	' format output string
	if len(res) > 1 then
		res = left(res, len(res) - 1)
		res = replace(res, wChar, vbCrlf)
	end if
	
	ReadFirstLines = res
	
end function
Last edited by ironuser on Thu Mar 10, 2011 12:09 am, edited 1 time in total.
icyboy
Posts: 4
Joined: Wed Mar 09, 2011 10:27 am

Re: AdBlock.ini auto updater

Post by icyboy »

ironuser wrote:That attachment has been removed by the forum moderators. I don't know why!
COPY and PASTE the following into a Notepad document, SAVE it to your desktop, and DOUBLE click it(with IRON NOT RUNNING) to update the adblcok.ini file. NOTE>> IF YOU HAVE WIN7 YOU MAY HAVE TO TWEAK THE 'const destination = "C:/Program Files//SRWare Iron/adblock.ini" LINE OF CODE.
I did not write this, I believe it is fanboy's script.
PS: Forgot, the https in the 'const source' line can be changed to plain old http if you don't want to use the secure server.

Code: Select all

option explicit

' -----------------------------------------------------------------------------
' PARAMETERS
' -----------------------------------------------------------------------------
const source = "https://secure.fanboy.co.nz/iron/complete/adblock.ini"
const destination = "C:/Program Files//SRWare Iron/adblock.ini"  
' -----------------------------------------------------------------------------

UpdateAdBlock source, destination

sub UpdateAdBlock(source, destination)
	
	' download adblock.ini
	GetHtmlPage source, destination
	
	' show message
	dim s : s = ReadFirstLines(destination, 3)
	Dim WshShell 
	Set WshShell = CreateObject("WScript.Shell") 
	WshShell.popup s, 3, "Adblock updated",	64
	'MsgBox s, vbInformation, "Adblock updated"

end sub


sub GetHtmlPage (up_http, down_http)

	dim xmlhttp : set xmlhttp = createobject("msxml2.xmlhttp.3.0")
	xmlhttp.open "get", up_http, false
	xmlhttp.send

	dim fso : set fso = createobject ("scripting.filesystemobject")

	dim newfile : set newfile = fso.createtextfile(down_http, true)
	
	'and the text from the XMLHTTP response can then be written to the file:
	newfile.write (xmlhttp.responseText)

	'the file must then be closed:
	newfile.close

	set newfile = nothing
	set xmlhttp = nothing
	set fso = nothing

end sub


function ReadFirstLines(fileName, numberOfLines)
	
	const wChar = "§"
	dim res
	
	' open text file
	dim fso : set fso = createobject ("scripting.filesystemobject")
	dim ts : set ts = fso.OpenTextFile(fileName)
	
	' read the first x lines
	dim x
	for x = 1 to numberOfLines
		res = res & ts.ReadLine & wChar
	next
	
	ts.close
	set ts = Nothing
	set fso = Nothing
	
	' format output string
	if len(res) > 1 then
		res = left(res, len(res) - 1)
		res = replace(res, wChar, vbCrlf)
	end if
	
	ReadFirstLines = res
	
end function
thanks for the code m8 :D
Post Reply