?
Solved

Installer to distribute greasemonkey scripts

Posted on 2009-07-14
12
Medium Priority
?
731 Views
Last Modified: 2013-12-12
I have a few greasemoneky scripts that need to be distributed to other computers that may or may not have firefox installed.  The installer has to be understandable by users with low technical experience.  It will also have to be able to edit the files to include install/location specific data.  I have basic knowledge of NSIS and think that it can be used for this project, but I don't know how to write it.

If someone could at least provide instructions on how to determine if firefox is installed, if greasemoneky is installed, where to put the scripts, and a way to download the latest versions of firefox and greasemoneky.

Ideally the installer could make the same scripts also work with IE and Opera if installed and/or preferred (the scripts don't have any greasemonkey-specific calls).
0
Comment
Question by:ti84p
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
12 Comments
 
LVL 46

Expert Comment

by:tbsgadi
ID: 24857830
Have a look at the following:

http://wiki.greasespot.net/FAQ

Gary
0
 
LVL 5

Author Comment

by:ti84p
ID: 24859937
I know where the scripts are and have already manually copied them to another computer, but it is a rather technical process that must be automated for non-technical users.
0
 
LVL 12

Expert Comment

by:jmcmunn
ID: 24862116
Are you in a position where you can buy an install package such as Installshield?  All of this would be very easy with installshield, though that's going to cost some money up front obviously.  I can give detailed info on this, if it is an option.

Otherwise, Nullsoft is indeed what I would recommend.  Here's some information about installing prerequisites with NSIS...which is essentially what you want to do (make sure Firefox/GM are installed).

http://nsis.sourceforge.net/Embedding_other_installers
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
LVL 5

Author Comment

by:ti84p
ID: 24864241
Installshield is a bit expensive for this project.

I think I know how to check if firefox is installed, but I'm not sure about checking for greasemonkey (not that it matters, I think, because firefox would just reinstall it).  I would like for the installer to download the latest versions of firefox and greasemonkey rather than having a single version packaged with it that would have to be updated with each new version of firefox.  I will need, though, to determine the location of the current firefox profile in order to copy the scripts.

I will make a simple diagram to describe what I want the installer to do.
0
 
LVL 12

Expert Comment

by:jmcmunn
ID: 24865467

Well...this is just theory here but this is how I would check for GM (once I know Firefox is there).

Navigate to this directory:
C:\Documents and Settings\<windows username>\Application Data\Mozilla\Firefox


Inside this directory there is a profiles.ini file that will tell you the current profile name.  Here's what mine looks like...

[General]
StartWithLastProfile=1

[Profile0]
Name=default
IsRelative=1
Path=Profiles/fpgho8op.default

So, now you have a profile name (and therefore the profile subfolder) where you would want to copy the GM files to.  A quick Google search should lead you to more info about the profile directory structure of Firefox.  I don't know enough about GM to know if it needs registry settings or not.  There appears to be a subfolder inside the profile folder where the extension files all reside.  But you can easily create registry entries if you have the windows rights when the install is run.

Once you know all of this info, you should be able to get Firefox and GM installed.  It will take some work, and I don't see any examples of exactly this anywhere, but it certainly seems possible.

Good luck, and hopefully this answer at least helps!
0
 
LVL 5

Author Comment

by:ti84p
ID: 24866215
That makes sense.  What I need to know is how to read the ini file with nsis to find the path, then how to save that to navigate to it.


The other part I need is the downloader.  I am fairly sure that nsis can do it, but I don't know how to.  The static greasemonkey xpi url (doesn't change between versions) is simple to find; I don't know of a static one for firefox though.

I hope to start working on some code tomorrow so will post more specifics and some code then.
0
 
LVL 5

Author Comment

by:ti84p
ID: 24870098
Diagram of what installer needs to do is attached.

InstallerDiagram.doc
0
 
LVL 5

Author Comment

by:ti84p
ID: 24874083
I have begun coding and have completed installing firefox.

I think I can code most of it, but what I will really need help with is reading the ini file to get the profile directory.

I have also decided to just embed the firefox installer in my own and then let firefox update itself once installed (but haven't implemented that yet).


My code so far is attached.

!include "MUI2.nsh"
!include "LogicLib.nsh"
!include TextFunc.nsh
!include StrFunc.nsh
Name "InstallGreasemonkeyScripts"
OutFile "install.exe"
ShowInstDetails show
RequestExecutionLevel admin
InstallDir "$EXEDIR\test"
 
 
 
 
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
    !insertmacro MUI_LANGUAGE "English"
 
 
Section main
	SetOutPath "$INSTDIR"
	ReadRegStr $R8 HKLM "SOFTWARE\Mozilla\Mozilla Firefox" "CurrentVersion"
	ReadRegStr $R9 HKLM "SOFTWARE\Mozilla\Mozilla Firefox\$R8\Main" "PathToExe"
	${If} $R9 == ""
		DetailPrint "FF not installed"
		DetailPrint "Downloading Firefox"
		${Unless} ${FileExists} "firefoxSetup.exe"
			inetc::get /RESUME "" /POPUP "" "ftp://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/win32/en-US/Firefox Setup 3.5.exe" "$INSTDIR\firefoxSetup.exe" /END
;		  Pop $0
		${EndUnless}
		${If} ${Cmd} `MessageBox MB_YESNO "Install Firefox with default settings?" IDYES`
			ExecWait "firefoxSetup.exe -ms"
		${else}
			ExecWait firefoxSetup.exe
		${endif}
		
		
	${else}
		DetailPrint "FF is installed"
		
	${EndIf}
SectionEnd

Open in new window

0
 
LVL 12

Accepted Solution

by:
jmcmunn earned 1500 total points
ID: 24875216

You'll want to use the ReadINIStr and/or WriteINIStr methods I think to interact with the .ini file.  The .ini file will always reside in the %APPDATA%\Mozilla\Firefox directory on the machine.  here are a couple of links I found that should be useful examples.

http://nsis.sourceforge.net/NSIS_Beyond_a_Traditional_Installation
http://forums.winamp.com/showthread.php?postid=1974145
http://nsis.sourceforge.net/InstallOptions_The_Usage_of_NOTIFY_Flag

Seems like once you have that you should pretty easily track down where to place the GM scripts etc.
0
 
LVL 5

Author Comment

by:ti84p
ID: 24879299
I will also need to edit the scripts from within nsis with data imputed by the user.
0
 
LVL 12

Assisted Solution

by:jmcmunn
jmcmunn earned 1500 total points
ID: 24884626

I assume GM scripts are text files then?  There are a ton of text manipulation functions in NSIS.

http://nsis.sourceforge.net/Category:Text_Files_Manipulation_Functions

And here is the recommended plugin for user input:

http://nsis.sourceforge.net/Docs/nsDialogs/Readme.html
0
 
LVL 5

Author Closing Comment

by:ti84p
ID: 31603443
Sorry for the delay, I changed the design some, but your information helped.  I have completed the installer.
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
In this article I discuss my selections of the Top Four free Outlook OST File Viewers available. Open, view and read even damaged OST files by using these tools. They all provide a clear preview of all data such as emails, notes, tasks, calendars, e…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question