Djé Posted June 11, 2006 Share Posted June 11, 2006 (edited) Your WPI is bored of checkbox?It wants to experience something different? Something new? Something wizz?Or is it introverted? Should it go ride higher in the sky with diamonds? Or maybe just see the things from a different POV? Do you want to help it? Well, you can't give it your coke nor your fanta, but you can still improve its creativity and make it feel powerful.Just treat it with a special injection of yours. And see the result:Look! Now it's displaying custom option's checkboxes, buttons, radio button choice, textfields, or whatever else it's triping on.And all this without ANY modding of WPI. It is just your beloved vanilla WPI. But it has been injected. Don't worry, this has no side effect: if you remove the syringe from its config.js, it stops immediately.WTF am I talking about?'Injection' is well known in the security community as a way used by crackers to attack server sided databases (SQL injection is the most well know type) or applications. It works for example by 'injecting' some code in an otherwise inert form answer. On a server application with low security, the code processing the answer may also execute the injected code, giving the cracker a way to control the server.Now in WPI things are different: we are the server, we already control everything and execute whatever code we want. So clearly WPI does not need to protect itself agains this thing. Rest that the mechanism still works (in a slightly different way) and we can take benefit of it to improve WPI's functionality and interface.Functionality & User Interface:- I mention interface because many issue (such as the 'set default browser' option in the pic) can be dealed with using the existing WPI features (I could just have another prog running that command, dependant on the main setup) but the injection can bring more freedom as for how to display it. So in this case, injecting the option is just another way to perform the task:Having on the same line clearly links the option to the main setup.- Same goes for radio options which could be solved by setting exclusions. But radios buttons are more user friendly for this. And they don't need any code to handle the exclusions.- Now there is the case of buttons. The great improvement here is that they can allow the user to perform an action (answering a question, selecting a file, etc.) now, while the WPI window is displayed, and not wait for all the other progs to be installed before the selected one can ask what it needs. In the example, the user can just select now the profile he wants to be restored, and don't wait for the restoring app's turn to run and ask him the question.- Another great use, with Fx extensions as an example: the user can select which extension to install by clicking the button:This will open ... another WPI with another config.js dedicated to the extensions. When the user click 'Begin Install' in this one, for each selected extension, it run a prog which simply record the extension's name to a file. The file will then be parsed by the extension installer of the main WPI in due time (after firefox and profile installation).Again, I could probably stuff all the extensions in the 1st config.js and try to manage something with the exclusion (all vs some extensions). But a new dedicated WPI window is so much cleaner.Ah, yes. I lied. For this last trick to work, you need to mod WPI: In WPI.hta (open it with notepad) you have to change 'singleInstance' from 'yes' to 'no' on line 21. That's all.But how the Duck Woes it Fork:An example being better than a long explanation, have a look at the attached config.js (to be able to use the extension button change the command for running the second WPI to suit your case).Simply put, it appends some HTML tags to the prog[pn]s. - Since these prog[pn] are used (without further processing -here would go the protection against injection in a server application-) to build WPI's HTML interface, the HTML elements appears in it.- The active ones (buttons, etc.) have their onclick() attribute set to the custom javascript code needed to perform the intended action (mainly modding the commands: cmd1[pn], etc.)Done.Issues:Although very promizing, this is also very beta. The main issue is about how to automate the tedious writting of the HTML and javascript that will be injected.I'm working on a next version of my Prog Lists writing excel application which will be able to do it. Probably with easy functions (that you could use in excel's formulas) like:injectCmdCheck(label, checked, cmdNum, CmdChecked, CmdUnchecked) to insert a checkbox altering the cmdx of the current prog. Does it make sense?There is also a small glitch with the tooltips as they also display some parts of the injections!Enough for now.Comments welcome![Disclaimers]1- If ever you took it otherwise, the drug 'apology' at the beginning of the post is fully ironic. It is only there for humor and literary purpose (although if you have no humor, I may advice some *** !). Here is my -non humorous- position about drugs: Drugs make you stupid ('soft' drugs do, 'hard' ones usually kill you before they can).2- If you're a script kid and your brain is striked by the idea of trying this injection thing on a server that you don't own, you're running -very fast- into deep s***. Not only well designed applications are protected against this kind of things, but admins have tools to detect it and to hunt you down. This is sooo outdated. Now go back finish your homeworks.config.js Edited June 11, 2006 by Djé Link to comment Share on other sites More sharing options...
Djé Posted July 8, 2006 Author Share Posted July 8, 2006 (edited) The mix is ready. Here's a glance at my full psychedelic hallucinations:This was achieved very easily using the injection functions in my Excel Progs Lists Manager, which is designed to maintain and write WPI's config.js files as well as progs lists in other formats (RunOnceEx, kTool, WIHU, XPLODE).The last version of the manager is geared toward WPI (v5.1), with easy managment of Exclusions & Dependancies, UserOptions, Default Selection ... and Injection!In the ProgsList Manager, for documentation about the injection functions, look at the textbox at the bottom of the "Djé's" Progs List.The issues mentioned in the previous post are solved. Of course. And the functions' syntax is easier than what was expected at that time. Edited July 8, 2006 by Djé Link to comment Share on other sites More sharing options...
pretender69 Posted July 10, 2006 Share Posted July 10, 2006 (edited) nicetoo bad there isn't a easy import function, or ability to click on config button in wpi.but very nice indeed Edited July 10, 2006 by pretender69 Link to comment Share on other sites More sharing options...
Djé Posted July 10, 2006 Author Share Posted July 10, 2006 nicetoo bad there isn't a easy import function, or ability to click on config button in wpi.but very nice indeed Thank you very much What do you have in mind, precisely? Maybe a solution is not that far... Link to comment Share on other sites More sharing options...
pretender69 Posted July 10, 2006 Share Posted July 10, 2006 just to be able to import my current config.js, is too big to redo it all Link to comment Share on other sites More sharing options...
kof94 Posted July 10, 2006 Share Posted July 10, 2006 Since WPI has gone into dev overload recently (thankfully) may be you should speak to Kel and mritter about adding these options in to WPI permenantly. This is good stuff. I have to say I love the radials, they work so much better than the current exclusion does. Link to comment Share on other sites More sharing options...
Djé Posted July 11, 2006 Author Share Posted July 11, 2006 just to be able to import my current config.js, is too big to redo it all Oh, I see. Import your config.js into the Progs List Manager.Well, cleverly using word's Replace function(with the 'plus' options), it shouldn't prove too difficult, however big is your config.js.For example you could open it in Word and then 'Replace All' the following couples (have the 'generic characters' checked, order is important)://*^13 by nothing -> commented lines[a-z1-6]@\[pn\]=\['(*)'\];^13 by \1^t -> quoted values[a-z1-6]@\[pn\]=\[(*)\];^13 by \1^t -> unquoted values^tpn++;^13 by nothing -> index incrementerThen untick the 'generic characters' checkbox and replace the following:\' by ' -> escaped single quotes\\ by \ -> escaped slashesRemove also the remaining 'pn=1;' line at the top.Select all and copy it.Paste it in a new datasheet in Excel. If you have the default settings for the import wizard (field separated by tabs), all the fields should go to different columns. Otherwise use the data/convert command.(Almost) done: you just have to tweak the progs with missing fields or multiple commands so that all the fields are well aligned.When your 'table' is square enough copy/paste it in a Progs List Datasheet and tune it to your needs.You will also have to break your commands into path/file/args. This can't be so much automated but here is how I'd do:Copy the column containing the commands and paste it into a new Word Document.Go down the list, inserting tabulations before and after (if there are any argument) file names.Replace all the 'tab+space' (between filename and arguments) by 'tab' only. (use the ^t special character for tab).Select all and copy the text.In your Excel's Progs List, have the 3 columns for path/file/args empty, select the top left cell of these 3 columns and paste your word text. Et Voilà!Since WPI has gone into dev overload recently (thankfully) may be you should speak to Kel and mritter about adding these options in to WPI permenantly. This is good stuff. I have to say I love the radials, they work so much better than the current exclusion does.Thank you very much.I'm already speaking a lot with mritter But I'm not sure if this is easy and/or a good thing to implement in WPI (it may get bloated). Anyway, the users should decide. If there's a demand (yours is maybe enough?), we'll see. Link to comment Share on other sites More sharing options...
wixfigura Posted July 11, 2006 Share Posted July 11, 2006 @ Djelooks great! What about uploading your config.js? It interesting how its done. Link to comment Share on other sites More sharing options...
Djé Posted July 12, 2006 Author Share Posted July 12, 2006 looks great! What about uploading your config.js? It interesting how its done.Thank you. You can generate my own config.js by yourself!Just get my Excel Progs Lists Manager.In the form appearing when you click the yellow button, just select Djé's for the Progs List and WPI for the output format, and click the Write the Script button. Et voilà!Moreover, if you tick the Use the 'Now' variables values checkbox and if the path to WPI is properly set in the SETTINGS datasheet, you will be able to run WPI with that config.js so you can actually see it working* in real situation, directly from the Progs Lists Manager (RUN button in the OUTPUT datasheet).I think that this way you will have better insight in what is actually done: The config.js may look somewhat cryptic but looking at the Djé's Progs List and comparing it to the config.js and to the result will explain things much better. Feel free also to look at the code (ALT+F11 in Excel) if you wish.And of course, you're welcome to ask for further explanations here.*As mentionned in the first post, if you want to be able to run a second WPI from a RunButton injection, you will have to mod WPI.hta (~ line 21) to make it able of multiple instances (singleInstance = 'no'). Obviously you will have to have the config.js files used by these new instances ready as well. In my example with the Firefox or Thunderbird extensions, generate the one from the Mozilla Progs List (Use filters for Fx or Tb). Link to comment Share on other sites More sharing options...
wixfigura Posted July 12, 2006 Share Posted July 12, 2006 Hellosorry I have no Micr&%$§ Excel. Only Open Office, and your file doesent work with it. Can you explain the different injection methods, or load up a config.js? This would be great! Bye Link to comment Share on other sites More sharing options...
Djé Posted July 13, 2006 Author Share Posted July 13, 2006 sorry I have no Micr&%$§ Excel. Only Open Office, and your file doesent work with it. Can you explain the different injection methods, or load up a config.js? This would be great! ByeOops, my bad. I shouldn't assume that everybody is using M$. T_D has tried to convert my file to Open Office but I think it will require some work because of the code being in VBA. BTW, what scripting language is OOo using?I may try myself to do the conversion (if ever I find the time) as I'd prefer an open solution.Anyway, attached is my 'config.js' which is actually named 'ProgsForRunOnceEx.js'. To use it, you can (beside renaming it) either put it in your WPIScripts folder and call it using WPI.hta config=ProgsForRunOnceEx.js, or put it wherever you want and feed its full path to WPI (WPI.hta config="C:\path to\ProgsForRunOnceEx.js").ProgsForRunOnceEx.jsHere are also my mozilla's config files, for if you want to click on the 'Select...' buttons:FxExtensions_config.jsTbExtensions_config.jsRemember to mod your WPI.hta.Also adapt the commands calling them (in the 'onclick' attributes of the buttons) to the location where they are.Compared to a 'normal' config.js, mine has the following modifications:- At the top are the variables normally defined in useroptions.js (only the ones having different values from the default ones). This is not related to injection. It is just like I've merged the 2 files, for ease of use.- Then comes the 'normal' config.js' progs definitions. . Only necessary fields are presents.. Some progs have injected HTML & javascript code in the prog[pn] field: prog[pn][0]+=.... Also note that I've commented out the pn=1; line. That way I can merge several config.js files into one before running WPI, but I'll talk about this somewhere else.- At the bottom are the injected functions and styles which are necessary for the injection to work properly:. A theme file patcher function to remove the .txt class from WPI.htm (in order to have all the edit buttons aligned, I needed this class to be used only for the progs labels).. A custom function to manage the injected Radio Options. This is not necessary if you do your injection by hand, but it greatly helps when doing it programmatically.. A custom <style> element with all the styles used by the injection, plus the moded .txt style.Because of all these modifications, it is not possible to edit this file inside the config wizard. But that is not the goal anyway.As for the injections themselves, here is how it works:- In WPI, the prog[pn] field is used 'as is' inside a <label> html element. So the 1st injected thing is a closing tag for this element: </label> ... and the last one will be an opening tag to match the closing one inside WPI!- In between them, we can now inject whatever we want.- Injected html elements have 'onclick' or 'onchange' events which modify the commands (cmd1, etc.) for the prog.- Although one could inject manually a lot of things, I've limited myself to inject:. checkboxes: set or unset a command,. radioOptions: give a choice for a command,. 'edit' buttons: edit the file of the command,. textboxes: give some arguments to the command,. custom 'file' input: give a file argument to the command (or unset it),. 'run' buttons: run something (usually different from a prog's command) 'now' (don't wait for the installer to run it).- These injections have their own labels. But, as we don't want the texts of these labels to be displayed inside the tooltips headers, I've put them into textboxes.- Combinations of the injections are also possible.That's it!Feel free to inquire for deeper explanations. Link to comment Share on other sites More sharing options...
ozzii Posted December 6, 2006 Share Posted December 6, 2006 Hi,I love the look of that WPI.I have an error when I launch the sheet.I have Excel97.Did I must to have an newer version ? Link to comment Share on other sites More sharing options...
Lost Soul Posted December 6, 2006 Share Posted December 6, 2006 wow thats wild, youve definatly added more options to it, but in a way it looks alittle overwhelming and yet dificult, but i think its nice work all in all, keep it up m8 Link to comment Share on other sites More sharing options...
AlienMacHine Posted April 14, 2007 Share Posted April 14, 2007 (edited) @Dje /@ll:I made some Checkbox-Injections to my config.js. Now my problem is that I would like to use one/more conditions (cond[pn]=['FileExists("...")']) to an injected Checkbox. Like: Show injected Checkbox only if condtion is met...Is that possible?Let me try to do a example:prog[pn]=['Cherry Keyman 3.0']uid[pn]=['CHERRY']desc[pn]=['Install Cherry Keyboard- & Mouse Software.']ordr[pn]=[260]cond[pn]=['FileExists("%CDROM%\\WPI\\Install\\Cherry\\SetupKeyManDesktop30_DE.exe")']cmd1[pn]=['%CDROM%\\WPI\\Install\\Cherry\\SetupKeyManDesktop30_DE.exe /quiet /norestart']prog[pn][0]+='</label><BR /> ';prog[pn][0]+='<input type="checkbox" id="dope19" checked value="1" onClick="';prog[pn][0]+=' var pn = findProgByUID(\'CHERRY\');';prog[pn][0]+=' cmd2[pn]=(!document.getElementById(\'dope19\').checked)? [\'\'] : ';prog[pn][0]+=' [\'%CDROM%\\\\WPI\\\\Install\\\\Cherry\\\\KeymanConfig.cmd\'];">';prog[pn][0]+='<label for="dope19"';prog[pn][0]+='><input type="text" readonly class="injectedLabel" value="Configuration">';prog[pn][0]+='</label><label>';prog[pn][0]+='</label><BR /> ';prog[pn][0]+='<input type="checkbox" id="dope20" checked value="1" onClick="';prog[pn][0]+=' var pn = findProgByUID(\'CHERRY\');';prog[pn][0]+=' cmd3[pn]=(!document.getElementById(\'dope20\').checked)? [\'\'] : ';prog[pn][0]+=' [\'REGEDIT /S %CDROM%\\\\WPI\\\\Install\\\\Cherry\\\\QuickDropOff.reg\'];">';prog[pn][0]+='<label for="dope20"';prog[pn][0]+='><input type="text" readonly class="injectedLabel" value="Hide Quickdrop-Icon">';prog[pn][0]+='</label><label>';dflt[pn]=['yes']configs[pn]=['admin,user,system']cat[pn]=['Hardware']pn++Ok, as u can see the Main-Program is the Software for my Keyboard/Mouse.The Second Injection is an option that I always want to be displayed for every User.But the first Injection is my Private Configuration-File, and i would like this Checkbox to be displayed only when a special Condition is met. e.g. A special Tag-File is found (FileExists("%systemdrive%\\Tagfile.tag"))Is that possible? Please help me... Edited April 14, 2007 by AlienMacHine Link to comment Share on other sites More sharing options...
sp00f Posted May 24, 2008 Share Posted May 24, 2008 Sorry to reply to an old topic, but when i saw this i thougt its awesome.Will this still work with 6.4.1 ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now