Script installers [MM2]

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Script installers [MM2]

by jiri » Fri Jan 11, 2008 5:55 am

Good idea, I canceled the sticky status.

Jiri

by RedX » Fri Jan 11, 2008 3:34 am

Information in this thread is out of date for MM3. Maybe we should remove the sticky?
Maybe replace with a link to the wiki?

Regards,
Red

by Peke » Wed Aug 02, 2006 1:52 pm

Nice solution.

by DiddeLeeDoo » Wed Aug 02, 2006 3:06 am

Simple Script Installer

This script is like a container for scripts, and install scripts as defined by the InstallScriptTo command.

InstallScriptTo "Auto\ScriptName.vbs", LineBegin, LineEnd, "Message after Installation finished"

Code: Select all

'-------------------------OPEN---------------------------------
Dim FSO : Set FSO=CreateObject("Scripting.FileSystemObject")
Dim SDB : Set SDB=CreateObject("SongsDB.SDBApplication")
While Not SDB.isRunning : WScript.Sleep 500 : Wend
'--------------------------------------------------------------

InstallScriptTo "Auto\XXXXXXXXX.vbs", LineBegin, LineEnd ,    _
                                                              _
        "Script Successfully Installed!"                &vbLf&_
        "Please restart MediaMonkey"                    &vbLf&_
        "Other notes to user after install....."

'--------------------------CLOSE-------------------------------
SDB.ShutdownAfterDisconnect=True
Set FSO=Nothing : Set SDB=Nothing : Wscript.Quit
'--------------------------------------------------------------



'This is line 20, and you can paste your script in here and see
'what the end line is to do the InstallScriptTo command options
'
'Like a 100 Line Script would need a command above like
'
'InstallScriptTo "Auto\MyScriptName.vbs", 20, 120, "MessageText"




'%%%%%%%%%%%%%%%%% START OF SCRIPT INSTALLER %%%%%%%%%%%%%%%%%%

Sub InstallScriptTo(ScriptName, LineBegin, LineEnd, Message)

    ScriptName=SDB.ApplicationPath & "Scripts\" & ScriptName

    RenameOldScript(ScriptName)
   
    Set TXT=FSO.OpenTextFile(WScript.ScriptFullName,1)
        STR=TXT.ReadAll
        TXT.Close
        
        LNS=Split(STR,vbNewLine)
   
    Set TXT=FSO.CreateTextFile(ScriptName, True)
            For i=LineBegin-1 To LineEnd-1
        TXT.WriteLine LNS(i)
            Next
        TXT.Close
   
     If FSO.FileExists(ScriptName) And Message<>"none" Then _
            SDB.MessageBox Message , 2, Array(4)
End Sub

Sub RenameOldScript(ScriptName)
    If FSO.FileExists(ScriptName) Then _
       FSO.MoveFile ScriptName, BakFile(ScriptName)
End Sub

Function BakFile(ScriptName)
    Do
        TMP=Left(ScriptName, Len(ScriptName)-3) & "old" & v
        v=v+1
    Loop While FSO.FileExists(TMP)
    BakFile=TMP
End Function

'%%%%%%%%%%%%%%%%%% END OF SCRIPT INSTALLER %%%%%%%%%%%%%%%%%%%

If having many scripts to install at once, write something like
InstallScriptTo "Auto\MyScriptName.vbs", 20, 120, "none"
InstallScriptTo "MyOtherFileName.vbs", 122, 250, "MessageText"


More stuff can be done too, and many things are happening in the AutoRateSongs Installer, like Scripts.ini modification, Reg read, ini write.
http://www.mediamonkey.com/forum/viewtopic.php?t=9241

by MoDementia » Thu Jun 29, 2006 6:44 pm

Steegy wrote:BTW: If you create Inno Setups, I strongly recommend the ISTool setup creation GUI (avaliable as package from Inno's website, together with the setup compiler).
I just had a quick look at the IStool package and also strongly recommend it. It will make dotting Is and crossing Ts so much easier.

by Steegy » Thu Jun 29, 2006 4:28 pm

My installers don't seem to have any problems :-?
(ok, except the size reported incorrectly, but who cares about that?)

by trixmoto » Thu Jun 29, 2006 1:57 pm

Don't worry, a lot of people had similar problems with my earlier scripts. I'm still in the process of fixing all of my installers now! :)

by MoDementia » Thu Jun 29, 2006 12:09 pm

Thanks for that, I feel aweful :( :oops:

by trixmoto » Thu Jun 29, 2006 12:02 pm

I've put a note on the original thread, but hopefully the sample will be corrected by the MM team as well. Thanks for pointing this out.

by MoDementia » Thu Jun 29, 2006 11:47 am

Please remove this announcement or fix the supplied sample

2. Download a sample script installer from http://www.mediamonkey.com/scripts/Scri ... tTitle.iss

One or the other asap

Thanks

by Steegy » Mon Jun 12, 2006 6:34 am

I'd like to share the "Inno Setup" script I've used for e.g. my FavouritesNodes script, as it has a MM version checking before anything gets installed.
This seems like a very useful thing to me. It prevents version problems in an early phase.

To change the "minimum required version" of MediaMonkey that is able to run your script, you have to set "MinimumVersion" to the right version number.
[Setup]
AppId=MediaMonkey Script: FavouriteNodes v1.1
AppName=MediaMonkey Script: FavouriteNodes
AppVerName=MediaMonkey Script: FavouriteNodes v1.1
AppVersion=1.1
AppPublisher=SteegyCorp
AppPublisherURL=http://home.tiscali.be/ruben.castelein
AppSupportURL=http://www.mediamonkey.com/forum/viewtopic.php?t=7656
AppUpdatesURL=http://www.mediamonkey.com/forum/viewtopic.php?t=7656
DefaultDirName={code:MMPath}
DefaultGroupName=MediaMonkey
AppCopyright=Copyright © SteegyCorp
OutputBaseFilename=FavouriteNodes
UpdateUninstallLogAppName=false

DirExistsWarning=no
;DisableDirPage=yes
DisableProgramGroupPage=true

SolidCompression=true
Compression=lzma
ShowLanguageDialog=yes
VersionInfoVersion=1.1
VersionInfoCompany=SteegyCorp
VersionInfoDescription=MediaMonkey Script: FavouriteNodes v1.1
VersionInfoTextVersion=FavouriteNodes v1.1
VersionInfoCopyright=Copyright © SteegyCorp
OutputDir=C:\MMScripts\Output
SourceDir=C:\MMScripts

[Files]
Source: C:\MMScripts\FavouriteNodes.vbs; DestDir: {app}\Scripts\Auto; Flags: ignoreversion promptifolder

Code: Select all

function MMPath(Default: String): String;
var
  PrevPath : String;
begin
  PrevPath := '';
  RegQueryStringValue( HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MediaMonkey_is1', 'Inno Setup: App Path', PrevPath);
  if FileExists( AddBackslash( PrevPath)+'\MediaMonkey.exe') then
    Result := AddBackslash( PrevPath)
  else
    Result := AddBackslash( ExpandConstant('{pf}'))+'MediaMonkey\';
end;


function InitializeSetup(): Boolean;
var
  MinimumVersion : String;
var
  AppVersion : String;
begin
  Result := false;

  MinimumVersion := '2.5.2.951';

  if GetVersionNumbersString(MMPath('') + 'MediaMonkey.exe', AppVersion) then
    if AppVersion >= MinimumVersion then
      Result := true
    else
      MsgBox('This script requires MediaMonkey version '+MinimumVersion+' or newer.'+#10+'Your version is '+AppVersion+#10+#10+'Please visit www.mediamonkey.com to get the latest version of MediaMonkey.'+#10+'The latest releases (including Betas and RCs) can be downloaded from the forum.', mbError, MB_OK)
  else
    if MsgBox('The current version of MediaMonkey could not be found, so the installed version number could not be determined.'+#10+'It''s possible that the installed version is older than the required version ('+MinimumVersion+') for this script.'+#10+#10+'Do you want to install the script?', mbError, MB_YESNO or MB_DEFBUTTON2) = IDYES then
      Result := true;
end;
[_ISTool]
UseAbsolutePaths=true[/color]

Of course, if you use this script, be sure to change all relevant things for your own script (e.g. the AppX settings, the VersionInfoX settings, Source, Output, ...)

BTW: If you create Inno Setups, I strongly recommend the ISTool setup creation GUI (avaliable as package from Inno's website, together with the setup compiler).


Cheers
Steegy

by psyXonova » Wed May 03, 2006 7:10 am

Yes, that is the sollution...
I came up to this problem after i created my first install.
I reported it to Jiri and and i used the fix that Trix described for all the installlers i created since then
I think i should had reported it here from the beginning, that would have saved some trouble for you guys....

by trixmoto » Mon May 01, 2006 11:44 am

After a little testing it occured to me what the problem with overwritting the uninstall information was. AppId. Change this value and everything is fine, you get a seperate uninstall which removes the files correctly. Excellent! :)

by Lowlander » Tue Apr 25, 2006 9:09 am

I would expect the installer to be overwritten to work with the new version of the script. Maybe it can be an option during installations.

Anyway you always publish source and installer so those who don't want ease of installation can go the manual route with the source code.

by trixmoto » Tue Apr 25, 2006 4:07 am

Note to people using this installer system: In the examples there is a check so the ini entry is only made if it doesn't already exist. This means that if you change an entry the modifications won't actually be made. This sounds obvious (and really is) but it took me a while to work out why it wasn't working - I didn't think to check the installer!

What do people think about this problem with the MM setup being overwritten? It is causing people using my installers some concern. Is it ok just to remove these sections from the installer script before you compile it?

Top