Archive: Recuperer une valeur de vbscript à nsis


Recuperer une valeur de vbscript à nsis
Bonjour,

J'ai crée un code en VBscript,et je veux qu'il retourne une valeur true ou false.apres je veux que cette valeur soi recuperé par un fichier nsis (extension .nsi)

VOila mon code sur le script:


Function trouve()
Dim Result
Result=False
if fso.FolderExists(Chemin) Then

Result=true

Else Result=false

End if
Trouve=Result
End Function




à l'excution de mon script, il m'affiche soi vrais soi faut,selon l'existence de mon dossier. Mais est ce que cette valeur peut etre utilisé dans le nsi?

Genre que le nsi verifie si par exemple retourne true (vrais) il affiche un message ,le dossier existe Sinn,le dossier n'existe pas.

Par exemple:
File "Verifier_exist_dossier.vbs"
File "Lancement1.Bat" # c'est lui qui lance le script

Execwait '$Temp\Lancement1.Bat'

!if Trouve=False
MessageBox MB "Exist"
Else MessageBox MB "n'existe pas"


Mais ca ne marche pas le code
Meerci de m'aider


You can probably get an exitcode / return value from the vbscript launcher. Or you can write to a temporary file, and read that in NSIS. Have you tried googling for something like 'get return value from vbscript'?


No! how can i do that please? I'm not professional Developer.Can You write me the code wich i need?


Je veux que le nsi vérifie si la valeur retourné par le script est vrais ou faux.si la valeur est vrais,il continue l'instalation,sinn il va afficher un message :
MessageBox MB_ICONEXCLAMATION "Erreur"


moi je fais
SetOutPath $Temp
SetOverWrite on
File "Verifier_exist_dossier.vbs"
File "Lancement1.Bat" # c'est lui qui lance le script

Execwait '$Temp\Lancement1.Bat'

!if Trouve=False
MessageBox MB "Exist"
Else MessageBox MB "n'existe pas"

Mais ca en marche pas


Please write in english, as most users (if not all :) can read english, but maybe not all can read french.

To get a return value from a vbs script:
http://www.tek-tips.com/faqs.cfm?fid=5755
But the solutions are not pretty.
So you better use something else to get what you want.
The scipt you posted can simply be done by NSIS with the IfFileExists (Or ${If} ${FileExists} with LogicLib) command.

The code from your last post will not work indeed, please read the LogicLib documentation


the directory is in an xml file,that's why i use a script to get an attribute ...i'm not sure that i can do it with nsis.
Sorry for french


There are enough possibilities to read xml data:
http://www.google.com/search?aq=f&so...F-8&q=nsis+xml


when i execute
nsisXML::Create
nsisXML :: LOAD <i give the directory here> ...i receive this message: Invalid command : nsisXML::Create


Have you installed the plugin correctly?
http://nsis.sourceforge.net/How_can_I_install_a_plugin
http://nsis.sourceforge.net/Docs/Chapter2.html#2.6


Yes! I just installer the plugin.
Now how can i get the attribute??
this is part of my xml file:
< v1>
<v2>
<v3 chemin= "c:\Dossier" taille=100>
<\v3>
<\v2>
<\v1>

i want to get the value of the attribute chemin and Test if is present.

This is my new nsi file wich do the test:
outfile test.exe
section Test
nsisXML::Create
nsisXml::Load<$c:\.....>
....... I don't know what should i write in the rest
Help plz ^^


There is an example in the plugin's readme.txt, and in sample.nsi. You can use those to learn how to use the plugin.


I used the examples! But i don't succed.You don't have another easier way to pars the value of an attribute from an XML File?
May Be with Script is easier??


Well XML files are just plain text files, so you can probably use the macros in textfunc.nsh and wordfunc.nsh to get your value. See the manual: http://nsis.sourceforge.net/Docs/AppendixE.html


@Angel89: actually we cannot write whole script for you.
Forum is the way to get some clue how to solve a problem.
You need to understand a more of XML and NSIS to write working script.
If anybody writes script for you and later you change something in xml then you will need to ask on this forum again... that is bad approach
Try to understand the problem and learn NSIS or hire someone to write script for you.

This is only general comment, no offense :)


Thank You For Your help!
I resolved the problem.
Good luck