|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
additionla info
..Maybe good to mention i'm running Windows 7 at the moment
|
|
#3
|
|||
|
|||
|
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 ![]() |
|
#4
|
||||
|
||||
|
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.
__________________
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! |
|
#5
|
|||
|
|||
|
Nilpo,
very kind, thank you All much appreciated Luupski |
|
#6
|
|||
|
|||
|
Update ?
Hey Nilpo,
Hessitant to ask, but were you able to get some working ? Thnx again, and no rush Thnx Luupski |
|
#7
|
||||
|
||||
|
What's your error message when this is run as a .vbs file?
|
|
#8
|
|||
|
|||
|
Quote:
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 |
|
#9
|
|||||
|
|||||
|
It sounds as though you just need to loop over this ten times.
vb Code:
|
|
#10
|
|||
|
|||
|
Thnx
Quote: 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 ![]() |
|
#11
|
|||
|
|||
|
It works
Quote:
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 |
|
#12
|
||||
|
||||
|
Quote:
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 |
![]() |
| Viewing: ASP Free Forums > System Administration > Windows Scripting > General Scripting - Help on script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|