Old 30th June 2011, 10:09   #1
Angel89
Junior Member
 
Join Date: Jun 2011
Posts: 10
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
Angel89 is offline   Reply With Quote
Old 30th June 2011, 10:32   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
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'?
MSG is offline   Reply With Quote
Old 30th June 2011, 11:11   #3
Angel89
Junior Member
 
Join Date: Jun 2011
Posts: 10
No! how can i do that please? I'm not professional Developer.Can You write me the code wich i need?
Angel89 is offline   Reply With Quote
Old 30th June 2011, 11:16   #4
Angel89
Junior Member
 
Join Date: Jun 2011
Posts: 10
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"
Angel89 is offline   Reply With Quote
Old 30th June 2011, 11:25   #5
Angel89
Junior Member
 
Join Date: Jun 2011
Posts: 10
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
Angel89 is offline   Reply With Quote
Old 30th June 2011, 12:27   #6
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
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
jpderuiter is offline   Reply With Quote
Old 30th June 2011, 12:32   #7
Angel89
Junior Member
 
Join Date: Jun 2011
Posts: 10
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
Angel89 is offline   Reply With Quote
Old 30th June 2011, 12:35   #8
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
There are enough possibilities to read xml data:
http://www.google.com/search?aq=f&so...F-8&q=nsis+xml
jpderuiter is offline   Reply With Quote
Old 30th June 2011, 12:57   #9
Angel89
Junior Member
 
Join Date: Jun 2011
Posts: 10
when i execute
nsisXML::Create
nsisXML :: LOAD <i give the directory here> ...i receive this message: Invalid command : nsisXML::Create
Angel89 is offline   Reply With Quote
Old 30th June 2011, 13:59   #10
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
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
jpderuiter is offline   Reply With Quote
Old 30th June 2011, 14:32   #11
Angel89
Junior Member
 
Join Date: Jun 2011
Posts: 10
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 ^^
Angel89 is offline   Reply With Quote
Old 30th June 2011, 14:56   #12
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
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.
MSG is offline   Reply With Quote
Old 30th June 2011, 15:49   #13
Angel89
Junior Member
 
Join Date: Jun 2011
Posts: 10
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??
Angel89 is offline   Reply With Quote
Old 30th June 2011, 20:07   #14
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
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
MSG is offline   Reply With Quote
Old 1st July 2011, 05:53   #15
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 506
Send a message via ICQ to T.Slappy
@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

Cool looking skinned Graphical Installers: www.graphical-installer.com
I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsignedsw.com
Develop NSIS projects in Visual Studio 2005-2017: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.2 Tokyo: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 1st July 2011, 09:43   #16
Angel89
Junior Member
 
Join Date: Jun 2011
Posts: 10
Thank You For Your help!
I resolved the problem.
Good luck
Angel89 is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump