Thanks for the tip Mike. I will start reading up on ShellRunAs.

--- In [email protected], "Mike" <sfclimb...@...> wrote:
>
> If you don't want to mess around with batch files, and just want to be able 
> to right click on your VBScript file and say "run as <user>", then have a 
> look at ShellRunAs which is the Microsoft replacement for XP's Runas:
> 
> http://technet.microsoft.com/en-us/sysinternals/cc300361.aspx
> 
> If you eventually decide that you just want a single icon on your desktop to 
> double click on in order to simultaneously launch all 8 instances, then you 
> would write a batch file that called your VBScript 8 times using a different 
> user name/password for each. You would then right click on the desktop and 
> choose New -> Shortcut giving the newly created batch file as the target.
> 
> On 64 bit Windows XP (using runas), the batch file would look something like 
> this:
> 
> runas /user:localhost\Core1 /savecred "c:\<your VBScript here>"
> runas /user:localhost\Core2 /savecred "c:\<your VBScript here>"
> runas /user:localhost\Core3 /savecred "c:\<your VBScript here>"
> runas /user:localhost\Core4 /savecred "c:\<your VBScript here>"
> runas /user:localhost\Core5 /savecred "c:\<your VBScript here>"
> runas /user:localhost\Core6 /savecred "c:\<your VBScript here>"
> runas /user:localhost\Core7 /savecred "c:\<your VBScript here>"
> runas /user:localhost\Core8 /savecred "c:\<your VBScript here>"
> 
> Keep in mind that the VBScript that you ask it to run may run in the default 
> directory of the user. Thus, the script would probably need to perform a 
> change directory operation to do the work in a meaningful location. Also, any 
> resource referenced by the VBScript would need to be accessible to each user 
> (test this by logging in as each user separately and manually running the 
> script to ensure that it works).
> 
> Mike
> 
> --- In [email protected], "ozzyapeman" <zoopfree@> wrote:
> >
> > To clarify, at the current time I simply double click on a VBscript
> > file, when I am logged in as the main user, and it launches my Amibroker
> > optimizations as that user.
> > 
> > But now, logged in as main user, I want to instead use RunAsSPC to
> > launch the script, and pass it an alternate User/Pass - but I want to do
> > this by double clicking on yet another script (a launch script for this
> > RunAsSPC command).
> > 
> > That is what I am having difficulty trying to figure out. Again, I am
> > sure this is as basic as it gets, as far as scripting or BAT files are
> > concerned. I just have minimal experience in those regards.
> > 
> > 
> > --- In [email protected], "ozzyapeman" <zoopfree@> wrote:
> > >
> > > Thanks Mike. That makes sense. :-)
> > >
> > > I guess what I am also trying to figure out - is how do I launch said
> > > scripts without having to manually open a command prompt and manually
> > > type in something like the following for each of the 8 scripts:
> > >
> > > c:\runasspc\runasspc.exe /program:"c:\myVBscript.vbs /user:"AB03"
> > > /password:"passAB03" /quiet
> > >
> > > I am not familiar with WShell, or creating BAT files, or even with
> > > launching the command prompt from within a script.
> > >
> > > How would I write a simple script that would simply run the above line
> > > within the command prompt? So that when I double click on such a file,
> > > the above referenced VBscript launches under the correct user? I am
> > sure
> > > this is a simple thing to do, I just have no idea how, and wading
> > > through various manuals has not helped so far.
> > >
> > > Of course in a worse case scenario, I could just manually type the
> > above
> > > sort of thing into the command prompt for each script I want to
> > launch,
> > > but that feels unnecessarily primitive.
> > >
> > >
> > > --- In [email protected], "Mike" sfclimbers@ wrote:
> > > >
> > > > You run the VBScript as the other user! Anything done from within
> > the
> > > script will be done as the user of which the script was launched.
> > > >
> > > > Whatever means you were using to run the script as the current user,
> > > just do the same using your runas utility.
> > > >
> > > > Mike
> > > >
> > > > --- In [email protected], "ozzyapeman" zoopfree@ wrote:
> > > > >
> > > > > Okay, since I am using Windows Vista, which does not have the same
> > > RunAs
> > > > > utility as Win XP, I had to install a utility, RunAsSPC. That
> > > utility
> > > > > works fine in manual testing.
> > > > >
> > > > > For example, if I am logged in as User: AB01 but want to open
> > > broker.exe
> > > > > under User: AB03, I just type the following in the command prompt:
> > > > >
> > > > > cd c:\runasspc
> > > > >
> > > > > c:\runasspc\runasspc.exe /program:"c:\Program Files
> > > > > (x86)\Amibroker\Broker.exe" /user:"AB03" /password:"passAB03"
> > /quiet
> > > > >
> > > > > And it will open broker.exe under AB03 while I remain logged in as
> > > AB01.
> > > > >
> > > > > But the issue that is still dogging me is - how do I now integrate
> > > the
> > > > > above with my VBScript to ensure that when I create the broker
> > > object,
> > > > > that it does so under user AB03, intead of user AB01?
> > > > >
> > > > > In other words, what goes at the top of the following VBScript
> > code?
> > > Do
> > > > > I need to add some kind of windows script to call the above
> > command
> > > > > line, or some other script that allocates any actions to a
> > specific
> > > > > user? Anyone have any idea what such a line would look like? I am
> > > going
> > > > > through the Windows Script Host manual, and I find it somewhat
> > > > > confusing.
> > > > >
> > > > > Thanks for any input.
> > > > >
> > > > >
> > > > > dim AB
> > > > > set AB = CreateObject("Broker.Application")
> > > > >
> > > > > dim AA
> > > > > set AA = AB.Analysis
> > > > >
> > > > > AB.LoadDatabase( Database )
> > > > > AA.LoadSettings( Settings )
> > > > > AB.ActiveDocument.Name = "EURUSD"        ' Set EURUSD as active
> > > document
> > > > >
> > > > >
> > > > > AA.LoadFormula( Formula1 )                        ' load formula
> > > from
> > > > > external file
> > > > > AA.ApplyTo                = 1                                    '
> > > use
> > > > > current symbol
> > > > > AA.RangeMode          = 3                                   ' use
> > > 'From'
> > > > > and 'To' dates
> > > > > AA.RangeFromDate = FromDate
> > > > > AA.RangeToDate       = ToDate
> > > > > AA.Optimize( 0 )
> > > > >
> > > > >
> > > > > --- In [email protected], "ozzyapeman" <zoopfree@> wrote:
> > > > > >
> > > > > > Thanks, Mike.
> > > > > >
> > > > > >
> > > > > > --- In [email protected], "Mike" sfclimbers@ wrote:
> > > > > > >
> > > > > > > You will need to run each instance as a separate user. Each
> > user
> > > > > must have permission to run the application. It is not necessary
> > to
> > > log
> > > > > in/out of each user account to start the process.
> > > > > > >
> > > > > > > You can read the setup requirements of MCO in the Files
> > section
> > > of
> > > > > this group for setting up the users. Then just use the built in
> > > Windows
> > > > > "runas" command to fire off each process from a single account but
> > > > > running as a different user.
> > > > > > >
> > > > > > > http://support.microsoft.com/kb/294676
> > > > > > >
> > > > > > > Keep in mind that if you are using AddToComposite, you will
> > run
> > > into
> > > > > trouble whenever you have multiple instances of AmiBroker running
> > > > > against the same database (each will write over the other, last
> > > write
> > > > > wins). You can overcome that by generating dynamic composite names
> > > (e.g.
> > > > > based on the user name).
> > > > > > >
> > > > > > > Mike
> > > > > > >
> > > > > > > --- In [email protected], "ozzyapeman" <zoopfree@>
> > > wrote:
> > > > > > > >
> > > > > > > > Recently I've been automating some of my optimizations and
> > > > > backtests
> > > > > > > > using external VBScript.
> > > > > > > >
> > > > > > > > When I run Amibroker manually, I can usually run up to 6
> > > separate
> > > > > > > > instances under a single User, which allows me to run
> > > > > optimizations on 6
> > > > > > > > different AFLs simultaneously. But when I try to run 6
> > > different
> > > > > > > > VBScripts, each calling a unique AFL, they collide which
> > each
> > > > > other, and
> > > > > > > > cause errors.
> > > > > > > >
> > > > > > > > Without logging out, and logging back into windows as a
> > > separate
> > > > > User,
> > > > > > > > how can I automate multiple optimizations using scripting?
> > > > > > > >
> > > > > > > > Below is a typical snippet of code. How do I instruct
> > VBScript
> > > to
> > > > > call a
> > > > > > > > unique Broker.Application, so that all scripts do not try to
> > > call
> > > > > the
> > > > > > > > exact same instance of Amibroker? Is this even possible?
> > > Thanks
> > > > > for any
> > > > > > > > input.
> > > > > > > >
> > > > > > > >
> > > > > > > > dim AB
> > > > > > > > set AB = CreateObject("Broker.Application")
> > > > > > > >
> > > > > > > > dim AA
> > > > > > > > set AA = AB.Analysis
> > > > > > > >
> > > > > > > > AB.LoadDatabase( Database )
> > > > > > > > AA.LoadSettings( Settings )
> > > > > > > > AB.ActiveDocument.Name = "EURUSD"        ' Set EURUSD as
> > > active
> > > > > document
> > > > > > > >
> > > > > > > >
> > > > > > > > AA.LoadFormula( Formula1 )                        ' load
> > > formula
> > > > > from
> > > > > > > > external file
> > > > > > > > AA.ApplyTo                = 1
> > > '
> > > > > use
> > > > > > > > current symbol
> > > > > > > > AA.RangeMode          = 3                                  
> > '
> > > use
> > > > > 'From'
> > > > > > > > and 'To' dates
> > > > > > > > AA.RangeFromDate = FromDate
> > > > > > > > AA.RangeToDate       = ToDate
> > > > > > > > AA.Optimize( 0 )
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>


Reply via email to