Functionality Translating Inno Setups Text.Translating Inno Setups text into another language does not require modifying the source code.Simply make a copy of the.Inno Setup Tips Tricks Inno Setup Tips Tricks.Printable version of this article.Foreword. Firstly, please note that Im just another user of Inno Setup, not one of.To the best of my knowledge, information contained in this.Inno has rendered something mentioned.This is intended as an aide, rather than.Prerequistites. Im expecting you to be using Inno Setup 5.Some of the material covered.IS4, but for most of the cooler stuff you need.IS5. In fact, some of the material is applicable to any sort of programming.Inno Setup scripts.A lot of general principles are still relevant.Im also expecting you to be reasonably familiar with programming, if not.Pascal specifically.Printable version of this article.Foreword. Firstly, please note that Im just another user of Inno Setup, not one of its developers.To the best of my knowledge.I have a. Net Windows service.I want to create an installer to install that windows service.Basically, it has to do the following Pack installutil.Is it. This isnt a programming tutorial while I will be.Pascal, I wont cover much of the semantics.Now lets get down to it.The most important thing to bear in mind at all times is that your code.This is true for all programming.Dont forget that your code may need.There are a number of techniques that enhance code readability.Im not. going to go into too much detail here there are plenty of books on the.Ill mention some of the ones that I think are the.Choose meaningful names.This covers any sort of symbols you name functions, variables.Dont be afraid to give it a long name you.Avoid using. names like a or x or thing.You shouldnt have to go look back at where it gets.Write short routines.Keep your routines short and to the point.Each routine should.When you need to do something.Dont. take this too far, though remember always that your goal is.If all your methods contain only a single line, thats.A general rule. of thumb is that each routine should fit within a single screen without.If your routines are longer than that, look for.Avoid duplication.If youre doing exactly the same thing or almost the same thing in.That way, if. you discover a bug or simply a better way to do it, you only have a.This is usually accomplished.Dont forget that you can pass parameters to.ONUm.jpg' alt='Delete File After Install Inno Setup Expandconstant' title='Delete File After Install Inno Setup Expandconstant' />Avoid magic numbers.This is related to the previous one.Try to avoid using a number when.Especially when youre using.Think about what would happen if you suddenly needed to.Would you even. remember years later what that number was actually forThis one probably needs a more concrete example.Say youre writing code.One of the lines might be Name.Edit. Top. Scale.Y1. 5. This is ok, by itself.But what if youre wanting to.Say Name. Label. Top.Scale. Y1. This is not so ok, now youre duplicating the.Change the second one like so Name.Label. Top. Name.Edit. Top. This accomplishes two things.First, youve made it.Second, if. you ever move the first control, the second will automatically follow it.For another example, see defining constants below.Keep related code together.Sometimes its not so obvious which parts of your code are related. Css Sprite Generator Download Windows . If. you change something in one routine, you may need to alter other routines.For example, if you add extra controls to a page, youll.It makes your life.See the sections on Forward.Comment where necessary, but do it as little as possible.Comments are another code smell.If you cant understand something.Choose better variable and routine names.Extract some of. the code into a new routine.Whatever it takes.Only add the comment.Note that this does not mean that you should just skip comments.Dont be afraid to.But. dont comment just for the sake of commenting, either.Like I said, this isnt really a Pascal tutorial, but Ill cover some of the.Global variables are considered a code smell ie.Since ROPS Innos scripting language doesnt support classes, however.You should try to minimise the number of globals.To declare a global variable, just put a var block outside all.For example. Data.Folder, Server. Name String.Server. Timeout Integer.Database. Installed Boolean.Globals are typically declared at the top of your program ie.Code section. Keeping them all together makes them.However, you may find that theyre easier to keep track of.This is a. matter of personal taste.See also the include section.The Code section uses Pascal style comments, which are quite different.Innos standard leading semicolon.In fact, the leading semicolon.Code section, just as.Pascal comments dont work outside of Code.So be careful. So what are the Pascal comments There are actually two types.One is. the familiar single line comment, which starts at the comment marker and.This is written using two forward.C. The second type is a block.Two different. block comments are available.The first starts with an open brace.Its important to realise that if you start a block comment, you must end it.You cant stop a comment with.Also, block comments do not nest.This means that if you.This is one of the reasons why its a good idea.And dont worry. strings take priority over comments, so it wont ignore the Inno constants.Expand. Constant.I wont go into too much detail here everybody knows what strings are.But its worthwhile mentioning a few details.First strings are kept.Second, to put the single quote.Third, individual.ASCII value. as a decimal number.This is particularly handy for unprintable characters.Hashed characters can be concatenated with each other and with quoted strings.For example, you can include a line.This is the first line.This is the. second line.One thing you will need to be careful of, though make sure.If it is, then the line will get misinterpreted as an ISPP directive.Theres one more thing you need to watch out for.Strings, unlike arrays.This means that if you.Theres no such thing.This is all pretty standard, and should be familiar to anyone with.The one thing to watch out for is that in Pascal.If you want the integral result of a.If you want the. remainder of a division aka the modulus, then use the mod.Not to be confused with Inno Setup constants such as app.Im referring here to real.Code. These can be either numbers.Theyre handy if you want to follow rule 4 above avoiding.Database. Instance.Name Foo. Baz. Db.Horizontal. Margin 1.Vertical. Margin 1.Im sure we all know that a Boolean is a variable that can only.True or False. But what.Or four Or twelve You could use an integer.This is where enumerations come in.In fact, you may want to use an enumeration even for something thats.Database. Installation di.Not. Installed, di.Install. On. Reboot, di.Installed. The above snippet illustrates a Pascal convention giving each alterative a.The reason for. doing this is because these values all share the same namespace with each.When working with enumerations above and arrays below in particular, you.You need to. make sure that you only specify them once.There are two reasons for this.To demonstrate that, have a look at this.BAD CODEprocedure Install.ServerServer. Mode sm.None, sm. Local, sm.Remote, sm. Both.Install. Components.Server. To. Install sm.None, sm. Local, sm.Remote, sm. Both.Install. ServerServer.To. Install. The above code will not compile, even though it may seem reasonable at first.Youll get a Type Mismatch error on the line that calls.Install. Server. Actually, point of fact in the current edition.ROPS you will not in fact get any error, even though technically you should.You will however get a.Why Its. because the two variables Server.To. Install and the.Server. Mode parameter actually are of two separate types.Because it has been defined.It errs on the side of caution, making them incompatible until proven.How do we resolve this With a common definition.Server. Modes sm.None, sm. Local, sm.Remote, sm. Both.Install. ServerServer.Mode Server. Modes.Install. Components.Server. To. Install Server.Modes. Install. ServerServer.To. Install. Note standard Delphi convention shared by some flavours of Pascal.Inno Setups is to prefix a type name with T.Following. this convention, Server.Modes above should have been named.TServer. Modes, or even TServer.Mode. For. enumeration types specifically, sometimes an E is used as a prefix.EServer. Modes. Personally, I tend to not follow.My example code will usually not adhere to it, though.There are times when you need to work with lists of things.Inno already. provides direct support for lists of strings either through TString.List. or its base, TStrings, but what if you want a different sort.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2017
Categories |