Accessing a variable from another script

Is it possible to create a global variable in VB in the Job VBA code and to access it from VB in the scripts contained in that job? I want to dynamically create a value (a random email address) for use in one script where it is used for registration and then use it again in a second script for login.

I had a similar requirement and used a slightly different approach to solve it.
I had to produce some random char strings that would be client IDs to create test client records in my web app. I needed to reference these random client IDs in both a create script and a modify script.
I found that (and I guess this can come down to personal preference) it was easy to create a "utility function" that writes a file with however many random strings you want in csv format. If your target scripts don't have databanks, just play this sub in the VBA editor, and then throw the output file into the databank folder and databank the field of interest. For subsequent runs, just play the sub in the VBA editor for fresh data. Worst case, you have an existing databank, and you just need to paste this file into it in excel as a new column. Not a big deal. Here's an example of a function I have that I changed such that it would create a list of random email addresses to a csv file everytime you run the sub in VBA. Just drop this in your VBA workspace sharedmodule:
Private Sub CreateMemberEmailFile()
Dim intA As Integer
Dim sngA As Single
Dim strA As String
'Dim x As Integer
Dim str As String
Dim answer As Boolean
Dim fs As Scripting.FileSystemObject
Dim myfile As Scripting.TextStream
Set fs = New Scripting.FileSystemObject 'Create a new file system object
' put the file anywhere you want, doesnt matter
Set myfile = fs.OpenTextFile("c:\memberemailid.csv", ForWriting)
myfile.WriteLine "MemberEmailID"
' ok, this creates 50 random emails...feel free to change 50 to whatever you desire
For y = 1 To 50
str = ""
For x = 0 To 9
'sngA = Rnd
'Select Case (CInt(sngA * 200) Mod 3)
' Case 0
' intA = CInt(sngA * 48) + CInt(sngA * 10)
' intA = 48 + (intA Mod 10)
'Case 1
' intA = CInt(sngA * 65) + CInt(sngA * 26)
' intA = 65 + (intA Mod 26)
'Case 2
' intA = CInt(sngA * 97) + CInt(sngA * 26)
' intA = 97 + (intA Mod 26)
'End Select
'make intA a random number from 0-9
intA = RandNum(0, 9)
strA = CStr(intA)
str = str & strA
Next x
str = str & "@test.com"
myfile.WriteLine str 'write the message to identify a different line
Next y
myfile.Close 'Close the file
Set myfile = Nothing ' Release the variables
Set fsoData = Nothing ' Release the variables
End Sub

Similar Messages

  • Accessing a Variable from another component

    Hey,
    I have got a main application with different states.. in the
    states I call different components.
    like this:
    quote:
    <mx:State name="products">
    <mx:AddChild>
    <modules:Products/>
    </mx:AddChild>
    </mx:State>
    <mx:State name="add_offer">
    <mx:AddChild>
    <modules:AddOffer bufferedProduct="{}" />
    </mx:AddChild>
    </mx:State>
    In the product component, I have a button which saves some
    information to a variable called "bufferedProduct". after that the
    program leaves the state "products" und switches to the state
    "add_offer", which is a different component. There I need the saved
    information from the "bufferedProduct" variable.
    Now my question, how can I "transfer" the information
    previously stored within the "Products" component in the
    "bufferedProduct" var into the "addOffer" component? Is there a way
    I can do that? Or should I use a different way to build my
    application :)
    this does not work unfurtunately!
    quote:
    parentDocument.products.bufferedProduct
    thx in advance
    pat

    Hey,
    I actually found one answer myself.
    I created a var bufferedProduct in the main app. In te
    Products state, I save the information to
    "parentDocument.bufferedProduct" and then I sent the var to the
    other component like this
    quote:
    <modules:AddOffer bufferedProduct="{bufferedProduct}"
    />
    in the addOffer component I just had to declare another var
    with the same name and thats it.
    thx anyway.
    pat

  • Accessing public variables from other classes

    Probably a simple questions, but how can I access a variable from another class. My exact situation is as follows.
    A class called WorldCalender has a variable which is defined: public int hour; (the value is given to it elsewhere).
    I want to access this variable and increase it by one in a subroutine in the class Hour. In this class I have put: WorldCalender.hour++; but it doesn't seem to work. How should I do it?

    don't expose the hour variable at all.
    have a method eg addToHourBy( int hrs )
    Probably a simple questions, but how can I access a
    variable from another class. My exact situation is as
    follows.
    A class called WorldCalender has a variable which is
    defined: public int hour; (the value is given to it
    elsewhere).
    I want to access this variable and increase it by one
    in a subroutine in the class Hour. In this class I
    have put: WorldCalender.hour++; but it doesn't seem to
    work. How should I do it?

  • Accessing variable from another JSP

    Friends,
    say, I have a Test1.jsp which has a variable "input". Is it possible to access this variable from other jsp "Test2.jsp"?
    any ideas?
    Thanks
    Hari V

    hi hari,
    there are essentially 3 ways of doing it....
    1).Usage of Hidden Values
    2).Using Cookies
    3).Storing attribute value within the scope of request/session/appln
    The choice is all urs....???
    Regards,
    RAHUL

  • How can I access JSP variables from a JavaScript function in a JSP page?

    Respected sir
    How can I access JSP variables from a JavaScript function in a JSP page?
    Thanx

    You may be get some help from the code below.
    <%
        String str="str";
    %>
    <script>
        function accessVar(){
           var varStr='<%=str%>';
           alert(varStr);// here will diplay 'str'
    </script>

  • Accessing a JTextField from another class

    I 've got 2 classes I am trying to get the value of a JTextField that located in a second class see the code
    class1 myClass = new class1();
    String text = myClass.jTextField1.getText();
    System.out.print(text);What happens is when i run the program and enter some text in the jTextFild1 and then click on my Jbutton it does not print anything
    the JButton is in the caller class
    Could anyone explains to me what is wrong

    an example would help maybe....
    if you want to access your jtextfield from another class then:
    import javax.swing.*;
    public class FieldHolderClass {
    public JTextField jtf = null;
    public FieldHolder() {
      JFrame jf = new JFrame();
      jtf = new JTextField();
      jtf.setText("this is the text that is here when other callerclass seeks for text");
      jf.getContentPane().add(jtf);
      jf.setVisible(true);
    public class CallerClass {
    public static void main(String args[]) {
      FieldHolderClass fHolder = new FieldHolderClass();
      System.out.println((fHolder.jtf.getText());
    }of course i have not written any swing app for a long time, so i might have forgotten everything... so, don't flame me when that code does not compile.
    the thing that it's supposed to show, is that you make a <b>public</b> variabel (jtf) and you simply ask for it from another class by typing holderclass instances name dot and that variable name (in this case jtf) and dot and then call the method on that variable (or object...)
    it might also be that you want your code to work the way that when you enter a text into jtextfield, then after pressing enter it would get printed on terminal...
    in that case you should also register some Listeners... i remember that back when i was just getin' to know java then i had problems with it as well... but then again, i didn't read any manuals...
    i hope i was somewhat help...

  • Access to MD03 from another transaction

    Hi Gurus,
    We did a trace to all the users, and one of them used the MD03 transaction. The point is that he has no authorization to this transaction, so probably he is accessing to it from another.
    Could you help me searching any transaction where the user could jump to MD03 from menu, buttons, double click,...?
    Thank you in advance.

    Hi,
    Click on Enviornment>>Navigation profile>>Assign. In the General settings tab page you can assign the navigation profile. Just check whether the navigation profile assigned to the user has the T-code MD03. Check the seetings and t-codes in OM0K - Define navigation profile.
    But as suggested by Mr.Brahmankar kindly check whether it's possible to access the transaction from MD04 if the user doesn't have the authorization of other transaction which he/she is accessing. In your case MD03. I'm not sure about that.
    Regards,
    Lodhi.S

  • How to access my mail from another computer. Both iPads

    HHow to access my mail from another computer. Both iPads. Both iCloud.

    add the email account to your email software like with any email service, or go to www.iCloud.com

  • Importing variables from another page in jsp

    Hey.
    I want to make two pages. I want the first page to include the variables from another page or POJO.
    I did this but i cant use the variables in index.jsp without initializing them first. But when I initialize them i get an error when trying to initialize them two times.
    if i use the variable in index without saving i get an error in eclipse.. but it works if i save and deploy.
    Is there any way to make eclipse see that i have imported the variable?
    The pages look something like this:
    index.jsp
    <%@ include file="extra.jsp" %>
    Print the number from the extra page
    <%= number %>extra.jsp
    int number = 32;I plan using this in a much greater system so I would appreciate any help.

    I'm having the same problem.
    Would be nice if somebody could help us.

  • Bex exit Variable from another one.

    Hi Expert,
    Do you Know how to define a value for a variable from another that is navigable in the bex query. In other words, when i change a value during the OLAP navigation in the query, another variable must change on the basis of the first one. The first variable isn't a "variable selected from user" on the start of the query but is a "mandatory" with a default value. When the default is changed on the OLAP,  another variable must change.
    How can I do?
    Thanks.

    OK. I see - just to be sure: You dont want to call the variable screen, when making the change, right? That is how I understand it, if I am wrong, you can use an exit variable for ZC_FASCIA and fill it depending on what was set in 0calmonth variable.
    So, assuming you dont want to call the variable screen, have you tried setting the dependent variable to changeable during query navigation? I dont think it works, but anyway, try it out...
    One way of "solving" your requirement of "set value for Y when X is changed by user" could be to use a compounded characteristic where you compound ZC_FASCIA with 0calmonth. I think you should be able to compound ZC_FASCIA = 1 with 0calmonth = <blank>...
    Next, create a variable for this new char. Using a default should be possible and it would have to be changeable during query navigation and let users change the default month without calling the variable screen.
    I dont know if this works/helps...
    Regards
    Jacob
    P.S: Your requirement only seems to come from the "need" to have 0calmonth = #. If you did not need the #, you would always have 2 for ZC_FISCIA... so I was wondering why you need the blank month? Something with an annual value stored in # month??
    Edited by: Jacob Jansen on Jan 29, 2010 9:38 PM

  • How to access Enterprise manager from another computer

    Hi There,
    I have Oracle 10g installed on a PC. I can access EM from that PC.
    I would like to know how would I access EM Dbconsole from another computer under same LAN.
    Thanks
    Raf

    Opening the web browser, you can specify the hostname and the port configured to listen the incoming call.
    For example:
    https://hostname:port_number/em
    or
    https://ip_address:port_number/em
    you can get information about the information that you need from the "emctl"
    emctl status dbconsole
    Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
    Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
    https://hostname:1158/em/console/aboutApplication
    Oracle Enterprise Manager 11g is not running.
    Best regards !
    Shin-Iti.

  • What URL do I need to use to sign-in to my Firefox Sync acct to access my bookmarks from another device?

    What URL do I need to use to sign-in to my Firefox Sync acct to access my bookmarks from another device? I am not sure what URL to type in on the other device to access my Sync Acct. Do I type www.firefox.com/sync or www.firefox.com, or what? ....Thanks

    You need to enter the email address and password that is use to set up the Firefox account
    See also:
    *https://support.mozilla.org/kb/how-to-update-to-the-new-firefox-sync
    *https://wiki.mozilla.org/Identity/Firefox-Accounts

  • A warning popped up on my ipod touch saying someone else has accessed my account from another device

    Was I hacked? While playing my ipod touch app dragonvale a warning poppoed up that said someone else has accessed my account from another device? What do I do?

    Change your password.

  • Access Time Capsule from another location

    My Time Capsule works well in my WiFi at home with both automatic backup of my Macbook Pro and to save large files on.  What are the setting i need to add to be able to access the files from another WiFi system away from home?

    There is a lot of setup involved..
    The TC must be the main router of the network.. it cannot be bridged.
    The wifi network you are attached to remotely must give you a full public access IP address. Find the public IP of the TC and see if you can then access it.
    Do not ever expect this sort of thing to be completely straight forward.
    Read the many many posts about remote access. There are different methods if BTMM doesn't work.
    See AirPort
    Remote access article as a starting point.

  • How can I access my email from another computer. Both iPads.

    HHow to access my email from another computer. Both iPads.

    depend on the mail provider really this sub forum is about installing windows on mac computer though you may get more advice if you post your question in the ipad forum
    Using iPad

Maybe you are looking for