Windows Scripting
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsSystem AdministrationWindows Scripting

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old July 12th, 2009, 07:55 AM
luupski luupski is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 11 luupski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 49 m 49 sec
Reputation Power: 0
General Scripting - Help on script

Hi all.

Beginning of the year i raised a question on the forum
This was about if it would be possible to have a script to place a program window on a pre-difined place on the desktop in windows.
Particulary putty windows as i have to have 16 open at the same time


Nilpo replied back then stating that Toas COM Component for WSH would be able to make it work as the Windows Script environment does not provide any native method of positioning windows on the desktop

Back then i was unable to load the Toas COM app on my work computer and my idea stopped there
However i work from my own machine now and was able to load Toas COM on my machine.

Nilpo also provided me with a script example back then and i tried this pasting it in a notepad and saving it as .js file
When starting the script it comes back with the error message :
Line: 1
Char: 5
Error: Expected ';'
Code: 800A03EC
Source: Microsoft JScript compilation error

Ok i'm a total blank on scripting, but prepared to do some trying and googling.
But i was not able to find anything that could help me
So thats why i come back to the place where it all started

Any help is much appreciated to get this working
(I have to open outlook, Iexplore and as said 16 putty windows)

Nilpo back then supplied me with the foloowing example :

1.Set WshShell = CreateObject("WScript.Shell")
2.Set objTos = CreateObject("TamaSoft.OA.Server")
3.
4. ' Command line to open PuTTy session
5.strCommandline = "putty.exe -load ""My Saved Session"""
6.
7. ' Launch PuTTy session as active window and
8. ' wait for it to load
9.WshShell.Run strCommandline, 1
10.WScript.Sleep 1000
11.
12. ' Get active window handle
13.intHwnd = objTos.getForegroundWindow()
14.
15. ' Set new window position
16.intXpos = 0
17.intYpos = 0
18.objTos.setWindowPos intHwnd, intXpos, intYpos

Reply With Quote
  #2  
Old July 12th, 2009, 08:09 AM
luupski luupski is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 11 luupski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 49 m 49 sec
Reputation Power: 0
additionla info

..Maybe good to mention i'm running Windows 7 at the moment

Reply With Quote
  #3  
Old July 12th, 2009, 08:29 AM
luupski luupski is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 11 luupski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 49 m 49 sec
Reputation Power: 0
going somewhere

.

Ok, i have been going through some results from google and found i have to save it as a .VBS file

Ok done so, but unfortunately still error message

What i did next is save it this way and a putty screen is opened

Set WshShell = CreateObject( "WScript.Shell" )
Set objTos = CreateObject( "TamaSoft.OA.Server" )
strCommandline = "putty.exe -load ""cmds.vzbi.com"""
WshShell.Run strCommandline, 1
WScript.Sleep 1000
intHwnd = objTos.getForegroundWindow()
intXpos = 0
intYpos = 0
objTos.setWindowPos intHwnd, intXpos, intYpos


Now i've been trying to open a second putty window, but i only got so far that the first putty screen is opened, but when calling for a second one to a different server it only opens the putty config screen.

So if any help available on how to modify the script so i can open multiple putty screens to different servers that would make me a happy guy

Thnx so far

Grtzz

Luupski

Reply With Quote
  #4  
Old July 13th, 2009, 12:56 AM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,880 Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)  Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Week 2 Days 8 h 47 m 8 sec
Reputation Power: 967
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Hi Luupski,

I actually remember your first question!

I'll download the component and play with it on Windows 7. I don't want to start guessing. Let me see if I can reproduce your errors.
__________________
Don't like me? Click it.

Scripting problems? Windows questions? Ask the Windows Guru!

Stay up to date with all of my latest content. Follow me on Twitter!

Help us help you! Post your exact error message with these easy tips!

Reply With Quote
  #5  
Old July 13th, 2009, 01:42 AM
luupski luupski is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 11 luupski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 49 m 49 sec
Reputation Power: 0
Nilpo,

very kind, thank you
All much appreciated

Luupski

Reply With Quote
  #6  
Old September 6th, 2009, 03:56 AM
luupski luupski is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 11 luupski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 49 m 49 sec
Reputation Power: 0
Update ?

Hey Nilpo,

Hessitant to ask, but were you able to get some working ?

Thnx again, and no rush

Thnx

Luupski

Reply With Quote
  #7  
Old September 7th, 2009, 09:40 AM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,880 Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)  Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Week 2 Days 8 h 47 m 8 sec
Reputation Power: 967
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
What's your error message when this is run as a .vbs file?

Reply With Quote
  #8  
Old September 8th, 2009, 01:23 PM
luupski luupski is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 11 luupski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 49 m 49 sec
Reputation Power: 0
Quote:
Originally Posted by Nilpo
What's your error message when this is run as a .vbs file?


Its not an error message, it's i'm not knowledgeable enough to extend the script.

It works when saved like this :

Set WshShell = CreateObject( "WScript.Shell" )
Set objTos = CreateObject( "TamaSoft.OA.Server" )
strCommandline = "putty.exe -load ""server"""
WshShell.Run strCommandline, 1
WScript.Sleep 1000
intHwnd = objTos.getForegroundWindow()
intXpos = 0
intYpos = 0
objTos.setWindowPos intHwnd, intXpos, intYpos



So as said (i have tried) am not able to extend this script so i can open 10 putty screens


Thnx


Luupski

Reply With Quote
  #9  
Old September 8th, 2009, 01:38 PM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,880 Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)  Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Week 2 Days 8 h 47 m 8 sec
Reputation Power: 967
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
It sounds as though you just need to loop over this ten times.
vb Code:
Original - vb Code
  1. Set WshShell = CreateObject( "WScript.Shell" )
  2. Set objTos = CreateObject( "TamaSoft.OA.Server" )
  3.  
  4. For i = 1 To 10
  5.     strCommandline = "putty.exe -load ""cmds.vzbi.com"""
  6.     WshShell.Run strCommandline, 1
  7.     WScript.Sleep 1000
  8.     intHwnd = objTos.getForegroundWindow()
  9.     intXpos = 0
  10.     intYpos = 0
  11.     objTos.setWindowPos intHwnd, intXpos, intYpos
  12. Next

Reply With Quote
  #10  
Old September 9th, 2009, 03:26 PM
luupski luupski is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 11 luupski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 49 m 49 sec
Reputation Power: 0
Thnx

Quote:
Originally Posted by Nilpo
It sounds as though you just need to loop over this ten times.
vb Code:
Original - vb Code
  1. Set WshShell = CreateObject( "WScript.Shell" )
  2. Set objTos = CreateObject( "TamaSoft.OA.Server" )
  3.  
  4. For i = 1 To 10
  5.     strCommandline = "putty.exe -load ""server"""
  6.     WshShell.Run strCommandline, 1
  7.     WScript.Sleep 1000
  8.     intHwnd = objTos.getForegroundWindow()
  9.     intXpos = 0
  10.     intYpos = 0
  11.     objTos.setWindowPos intHwnd, intXpos, intYpos
  12. Next





For i = 1 To 10
I geuss that would be the ting i needed

Thnx Nilpo
Gonna try if it works when i get back from work

I'll let ya know if it worked

Thnx again

Luupski

Reply With Quote
  #11  
Old September 10th, 2009, 09:03 AM
luupski luupski is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 11 luupski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 49 m 49 sec
Reputation Power: 0
It works

Quote:
Originally Posted by luupski
For i = 1 To 10
I geuss that would be the ting i needed

Thnx Nilpo
Gonna try if it works when i get back from work

I'll let ya know if it worked

Thnx again

Luupski



Thnx Nilpo

It works, me happy man now

May i ask you if you can recommend a webpage that holds info on this scripting for dummies like me ?
I would like to play around with this, like adding statement for opening other programs as well in one go like outlook, IE etc

Thnx

Kind regards,
Luupski

Reply With Quote
  #12  
Old September 10th, 2009, 03:13 PM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,880 Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)  Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Week 2 Days 8 h 47 m 8 sec
Reputation Power: 967
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Quote:
Originally Posted by luupski
Thnx Nilpo

It works, me happy man now

May i ask you if you can recommend a webpage that holds info on this scripting for dummies like me ?
I would like to play around with this, like adding statement for opening other programs as well in one go like outlook, IE etc

Thnx

Kind regards,
Luupski
I'm glad that worked for you.

A Google search will bring up several sites that are pretty decent but none of them are necessarily geared specifically toward beginners although Microsoft's Scripting Guys do a damn good job. After all, they are the first ones to do scripting. You can take a look at scriptingguys.com.

Most of my articles are topic based and geared toward beginners as well. You can find a list of those here.

Finally, I'm developing a site dedicated to scripting based upon the types of questions I've been answering over the years. It's currently still a work in progress, but you can sign up to receive updates as it comes together. WindowsScript.com

Reply With Quote
Reply

Viewing: ASP Free ForumsSystem AdministrationWindows Scripting > General Scripting - Help on script


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek