Passing & retrieving values between 2 vbs files? is it possible?

I would like to get a main VBS file to detect the local language and
accordingly sends
a request to another VBS file that would contain various messages in
different languages.

Would it be possible to have the main VBS file retrieve the answer given by
users
to the messages - Yes/No - from the (other) message.vbs file at all?

If user clicks yes the main file continues if they click No it aborts?

TIA

Joseph

Re: Passing & retrieving values between 2 vbs files? is it possible? by mr_unreliable

mr_unreliable
Fri Aug 19 11:24:37 CDT 2005

hi Joseph,

From what you want to do, I suggest you take a look at the "wsf"
file format, and in particular at the <resource> capabilities of
wsf files.

The <resource> elements allow for inclusion of (text) data in the
wsf file.

In your case, you could include your different language messages
in your script as resource elements:

<resource id="english">hello</resource>
<resource id="german">servus</resource>
<resource id="french">bonjour</resource>
<resource id="arabic">allah akbar</resource>

In other words, you don't need another script. You can just
wrap up the language-specific messages into one.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)




Joseph wrote:
> Passing & retrieving values between 2 vbs files? is it possible?
>
> I would like to get a main VBS file to detect the local language and
> accordingly sends
> a request to another VBS file that would contain various messages in
> different languages.
>
> Would it be possible to have the main VBS file retrieve the answer given by
> users
> to the messages - Yes/No - from the (other) message.vbs file at all?
>
> If user clicks yes the main file continues if they click No it aborts?
>
> TIA
>
> Joseph
>
>

Re: Passing & retrieving values between 2 vbs files? is it possible? by Joseph

Joseph
Tue Aug 23 05:40:57 CDT 2005

Thank you very much for your help and suggestion.

Unfortunately I have no idea how to link to theis WSF file from within the
VBS file though.

Couldn't find anything useful on the net, so far.

Thanks anyway.
"mr_unreliable" <kindlyReplyToNewsgroup@notmail.com> wrote in message
news:ebZCKqNpFHA.1948@TK2MSFTNGP12.phx.gbl...
> hi Joseph,
>
> From what you want to do, I suggest you take a look at the "wsf"
> file format, and in particular at the <resource> capabilities of
> wsf files.
>
> The <resource> elements allow for inclusion of (text) data in the
> wsf file.
>
> In your case, you could include your different language messages
> in your script as resource elements:
>
> <resource id="english">hello</resource>
> <resource id="german">servus</resource>
> <resource id="french">bonjour</resource>
> <resource id="arabic">allah akbar</resource>
>
> In other words, you don't need another script. You can just
> wrap up the language-specific messages into one.
>
> cheers, jw
> ____________________________________________________________
>
> You got questions? WE GOT ANSWERS!!! ..(but,
> no guarantee the answers will be applicable to the questions)
>
>
>
>
> Joseph wrote:
>> Passing & retrieving values between 2 vbs files? is it possible?
>>
>> I would like to get a main VBS file to detect the local language and
>> accordingly sends
>> a request to another VBS file that would contain various messages in
>> different languages.
>>
>> Would it be possible to have the main VBS file retrieve the answer given
>> by users
>> to the messages - Yes/No - from the (other) message.vbs file at all?
>>
>> If user clicks yes the main file continues if they click No it aborts?
>>
>> TIA
>>
>> Joseph



Re: Passing & retrieving values between 2 vbs files? is it possible? by mr_unreliable

mr_unreliable
Tue Aug 23 11:17:33 CDT 2005

Joseph, I was not suggesting that you "link" to a wsf file.

I was suggesting that you CONVERT your vbs file to a wsf
file, and then embed the text messages (in the different
languages) as resourece in that SAME wsf file.

Here is an intro to wsf files:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsAdvantagesOfWs.asp

Here is a discussion of the <resource> element of a wsf file:

http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/wsh/htm/wsEleResource.asp

And, you can find numerous examples of wsf files (and with
<resource> elements) by searching the archives of this ng.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)


Joseph wrote:
> Thank you very much for your help and suggestion.
>
> Unfortunately I have no idea how to link to theis WSF file from within the
> VBS file though.
>
> Couldn't find anything useful on the net, so far.
>
> Thanks anyway.
> "mr_unreliable" <kindlyReplyToNewsgroup@notmail.com> wrote in message
> news:ebZCKqNpFHA.1948@TK2MSFTNGP12.phx.gbl...
>
>>hi Joseph,
>>
>>From what you want to do, I suggest you take a look at the "wsf"
>>file format, and in particular at the <resource> capabilities of
>>wsf files.
>>
>>The <resource> elements allow for inclusion of (text) data in the
>>wsf file.
>>
>>In your case, you could include your different language messages
>>in your script as resource elements:
>>
>> <resource id="english">hello</resource>
>> <resource id="german">servus</resource>
>> <resource id="french">bonjour</resource>
>> <resource id="arabic">allah akbar</resource>
>>
>>In other words, you don't need another script. You can just
>>wrap up the language-specific messages into one.
>>
>>cheers, jw
>>____________________________________________________________
>>
>>You got questions? WE GOT ANSWERS!!! ..(but,
>> no guarantee the answers will be applicable to the questions)
>>
>>
>>
>>
>>Joseph wrote:
>>
>>>Passing & retrieving values between 2 vbs files? is it possible?
>>>
>>>I would like to get a main VBS file to detect the local language and
>>>accordingly sends
>>>a request to another VBS file that would contain various messages in
>>>different languages.
>>>
>>>Would it be possible to have the main VBS file retrieve the answer given
>>>by users
>>>to the messages - Yes/No - from the (other) message.vbs file at all?
>>>
>>>If user clicks yes the main file continues if they click No it aborts?
>>>
>>>TIA
>>>
>>>Joseph
>
>
>

Re: Passing & retrieving values between 2 vbs files? is it possible? by Joseph

Joseph
Wed Aug 24 06:38:10 CDT 2005

Got you, thanks a lot for your help.

"mr_unreliable" <kindlyReplyToNewsgroup@notmail.com> wrote in message
news:%23sGqSz$pFHA.2912@TK2MSFTNGP10.phx.gbl...
> Joseph, I was not suggesting that you "link" to a wsf file.
>
> I was suggesting that you CONVERT your vbs file to a wsf
> file, and then embed the text messages (in the different
> languages) as resourece in that SAME wsf file.
>
> Here is an intro to wsf files:
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsAdvantagesOfWs.asp
>
> Here is a discussion of the <resource> element of a wsf file:
>
> http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/wsh/htm/wsEleResource.asp
>
> And, you can find numerous examples of wsf files (and with
> <resource> elements) by searching the archives of this ng.
>
> cheers, jw
> ____________________________________________________________
>
> You got questions? WE GOT ANSWERS!!! ..(but,
> no guarantee the answers will be applicable to the questions)
>
>
> Joseph wrote:
>> Thank you very much for your help and suggestion.
>>
>> Unfortunately I have no idea how to link to theis WSF file from within
>> the VBS file though.
>>
>> Couldn't find anything useful on the net, so far.
>>
>> Thanks anyway.
>> "mr_unreliable" <kindlyReplyToNewsgroup@notmail.com> wrote in message
>> news:ebZCKqNpFHA.1948@TK2MSFTNGP12.phx.gbl...
>>
>>>hi Joseph,
>>>
>>>From what you want to do, I suggest you take a look at the "wsf"
>>>file format, and in particular at the <resource> capabilities of
>>>wsf files.
>>>
>>>The <resource> elements allow for inclusion of (text) data in the
>>>wsf file.
>>>
>>>In your case, you could include your different language messages
>>>in your script as resource elements:
>>>
>>> <resource id="english">hello</resource>
>>> <resource id="german">servus</resource>
>>> <resource id="french">bonjour</resource>
>>> <resource id="arabic">allah akbar</resource>
>>>
>>>In other words, you don't need another script. You can just
>>>wrap up the language-specific messages into one.
>>>
>>>cheers, jw
>>>____________________________________________________________
>>>
>>>You got questions? WE GOT ANSWERS!!! ..(but,
>>> no guarantee the answers will be applicable to the questions)
>>>
>>>
>>>
>>>
>>>Joseph wrote:
>>>
>>>>Passing & retrieving values between 2 vbs files? is it possible?
>>>>
>>>>I would like to get a main VBS file to detect the local language and
>>>>accordingly sends
>>>>a request to another VBS file that would contain various messages in
>>>>different languages.
>>>>
>>>>Would it be possible to have the main VBS file retrieve the answer given
>>>>by users
>>>>to the messages - Yes/No - from the (other) message.vbs file at all?
>>>>
>>>>If user clicks yes the main file continues if they click No it aborts?
>>>>
>>>>TIA
>>>>
>>>>Joseph
>>
>>


Re: Passing & retrieving values between 2 vbs files? is it possible? by mr_unreliable

mr_unreliable
Wed Aug 24 12:22:10 CDT 2005

This is a multi-part message in MIME format.
--------------050608010604010101080603
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I have attached a (wsf) script, which demonstrates how to use
resource elements to load messages from different languages.

cheers, jw

Joseph wrote:
> Thank you very much for your help and suggestion.
>
> Unfortunately I have no idea how to link to theis WSF file from within the
> VBS file though.
>
> Couldn't find anything useful on the net, so far.
>
> Thanks anyway.
> "mr_unreliable" <kindlyReplyToNewsgroup@notmail.com> wrote in message
> news:ebZCKqNpFHA.1948@TK2MSFTNGP12.phx.gbl...
>
>>hi Joseph,
>>
>>From what you want to do, I suggest you take a look at the "wsf"
>>file format, and in particular at the <resource> capabilities of
>>wsf files.
>>
>>The <resource> elements allow for inclusion of (text) data in the
>>wsf file.
>>
>>In your case, you could include your different language messages
>>in your script as resource elements:
>>
>> <resource id="english">hello</resource>
>> <resource id="german">servus</resource>
>> <resource id="french">bonjour</resource>
>> <resource id="arabic">allah akbar</resource>
>>
>>In other words, you don't need another script. You can just
>>wrap up the language-specific messages into one.
>>
>>cheers, jw
>>____________________________________________________________
>>
>>You got questions? WE GOT ANSWERS!!! ..(but,
>> no guarantee the answers will be applicable to the questions)
>>
>>
>>
>>
>>Joseph wrote:
>>
>>>Passing & retrieving values between 2 vbs files? is it possible?
>>>
>>>I would like to get a main VBS file to detect the local language and
>>>accordingly sends
>>>a request to another VBS file that would contain various messages in
>>>different languages.
>>>
>>>Would it be possible to have the main VBS file retrieve the answer given
>>>by users
>>>to the messages - Yes/No - from the (other) message.vbs file at all?
>>>
>>>If user clicks yes the main file continues if they click No it aborts?
>>>
>>>TIA
>>>
>>>Joseph
>
>
>

--------------050608010604010101080603
Content-Type: text/plain;
name="wsfResElemDemo_noDebugDlg.wsf.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="wsfResElemDemo_noDebugDlg.wsf.txt"

<?XML version="1.0" standalone="yes" encoding="iso-8859-1" ?>
<job id="wsfResourceElementDemo">
<comment>
' This script is an attempt to retrieve wsf file script "resources",
' used in a way similar to the text "resources" in visual basic, where
' the "resources" may be providing text messages for different languages.
</comment>

<resource id="English">
sGreet="Hey"
sSalutation="Wazup Bro"
sClose="See Ya"
</resource>

<resource id="German">
sGreet="Servus"
sSalutation="Vie Ghets mit Ihnen"
sClose="Auf Wiedersehen"
</resource>

<script language="VBScript" >
<![CDATA[

' script to retrieve "resources" which represent text messages,
' translated into different languages, jw 24Aug05
'
' --- revision history ---------------------------
' 24Aug05: initial attempt...
' --- end of revisions ---------------------------
'
Option Explicit
'
' --- module level variables ---------------------
Dim sGreet : sGreet = "" ' as string (dim and initialize)...
Dim sSalutation : sSalutation = ""
Dim sClose : sClose = ""
' --- end of declarations and constants ----------


' ================================================
' === INITIALIZATION CODE ========================
' ================================================
Const sMe = "[main], "


' ================================================
' ================================================
' === MAIN LINE SCRIPT LOGIC =====================
' ================================================
' ================================================

' display initial values of the language-specific variables...
' dbPrint sMe & "sGreet: " & sGreet
' dbPrint sMe & "sSalutation: " & sSalutation
' dbPrint sMe & "sClose: " & sClose
MsgBox "sGreet: " & sGreet & vbCrLf _
& "sSalutation: " & sSalutation & vbCrLf _
& "sClose: " & sClose, vbInformation, " Display Initial Values... "


' go get the resources (or text lines) for this language...
Call GetResourceFor("German") ' ("English")


' report out the results, if any...
' dbPrint sMe & "sGreet: " & sGreet
' dbPrint sMe & "sSalutation: " & sSalutation
' dbPrint sMe & "sClose: " & sClose
MsgBox "sGreet: " & sGreet & vbCrLf _
& "sSalutation: " & sSalutation & vbCrLf _
& "sClose: " & sClose, vbInformation, " Display Text From Resource Element... "





' ================================================
' === CLEAN-UP TIME ==============================
' ================================================

WScript.Quit




' ================================================
' === SUBROUTINES FOLLOW =========================
' ================================================


' --- "Resource Text" formatting (a discussion) --
' To avoid any surprises, you must read the ms documentation very carefully.
' N.B., "Everything within the elements gets used [i.e., passed back to the
' script] including "white space" ([meaning: blanks], tabs, new lines, etc.)"...
'
' If your resource file looks like this (example from the documentation):
' <resource id="testRes">
' Non-numeric value passed
' </resource>
'
' when you "getResource", you will get: vbCrLf[blank][blank]Non-numeric value passed vbCrLf
'
' if you wish to eliminate any leading blanks and vbCrLf's, use this:
' <resource id="testRes">Non-numeric value passed</resource>
'
' Otherwise, you may either:
' 1. Strip out the stuff you don't want, or
' 2. Use it. For example to separate out the lines.
'
' In THIS script, we will be doing both...
' --- end of discussion --------------------------



Sub GetResourceFor(sLanguage)
Const sMe = "[GetRes:], "
Dim sResText ' as string (in effect, a string array)
Dim saStmts ' as string array
Dim i ' as integer

sResText = getResource(sLanguage) ' get the strings...
' dbPrint sMe & "sResText: " & sResText

' separate the lines of text (taking advantage of the vbCrLf's)...
saStmts = Split(sResText, vbCrLf, -1) ' return all strings
' dbPrint sMe & "split returned n strings: " & CStr(UBound(saStmts))

' enumerate, er, go through the individual strings one-by-one...
For i = LBound(saStmts) to UBound(saStmts)
' dbPrint sMe & "stmt: " & saStmts(i)

if (saStmts(i) <> "") then ' discard any blank lines...

' treat this line as a vbs statement, and execute it...
Execute saStmts(i)

' note: if all goes well, the text will show up in the pre-declared
' "module variables", which are "global" to this script...
End If
Next ' i

End Sub

]]>
</script>
</job>

--------------050608010604010101080603--