| View previous topic :: View next topic |
| Author |
Message |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Mon Feb 17, 2003 12:17 am Post subject: windows send question |
|
|
hello all
i'am try to make vds type some txt into notepad, problem is when i run it all works fine intill it trys to wite some txt. meaning the title bar changes to the txt i'am writing it don't put it on the page what i'am doing worng?
| Code: |
%W = @winexists(Notepad)
window send,perform.ini - Notepad,@CR()
wait 2
WINDOW SETTEXT,perform.ini - Notepad, [perform]
end |
thanks |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Mon Feb 17, 2003 12:42 am Post subject: |
|
|
You are using WINDOW SETTEXT. This sets the title bar command.
You should use WINDOW SEND, as the below example illustrates.
| Code: | REM -- Put your title bar below --
%W = Untitled - Notepad
shell open,@windir(S)\notepad.exe
wait 1
WINDOW SEND, %W, @CR()
WINDOW SEND, %W, [perform]
end |
_________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Mon Feb 17, 2003 12:50 am Post subject: ahhhh |
|
|
ahhhh yup and i even read the help file AND still didn't see that
WINDOW SETTEXT sends the contents of <string> to the specified window using a Windows message. Text sent to a main window using this command will replace whatever is in the title bar.
thanks for helping me |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Mon Feb 17, 2003 4:58 am Post subject: |
|
|
Just a note:
If you use the window "handle" (also known as the identifier)
of a notepad instance for WINDOW SEND (or whatever), the
"handle" for that instance of notepad doesn't change, even if
ya open another file with it (which changes the title bar text)...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Mon Feb 17, 2003 12:05 pm Post subject: |
|
|
But... If there's already an instance of the file open, then a new instance
is started, how do you differentiate between the two windows?  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Mon Feb 17, 2003 12:14 pm Post subject: |
|
|
Use @winactive(I) as soon as notepad (or whatever) is opened
to retrieve it's handle (you may have to use a WAIT to make
sure it's fully open):
%%hwnd = @winactive(I)
OR ya can use LIST WINLIST and search for the window name
(or a partial name), then use @winexists(@item(1)) etc. to get
the handle. In the case of notepad, you could search for the
filename in the window titles if ya wanted...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Mon Feb 17, 2003 12:26 pm Post subject: |
|
|
The second approach is definately to be recommended because you never know how long it takes
to open a new window (all depends on system load, size of file etc.). Inbetween the user just may
click another window for instance, and then you'll find your prog sending commands to the false
window.
But using window titles is also a bit tricky. Because titles, associated programs etc. may
change from user to user, from OS to OS, and language to language.
I've been struggling a bit with this. I so far I haven't found a method to be 100% reliable..
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Mon Feb 17, 2003 12:33 pm Post subject: |
|
|
I agree Dread,
But if your program opens a file with notepad or wordpad, the
filename will always be in the title - or will it... (XP, etc.)?
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Mon Feb 17, 2003 12:41 pm Post subject: |
|
|
Yeah, normally the filename will be in the title. But if you use something like SHELL to open
a txt file then you'll never know which program is associated with .txt files.
And users may customize their system. I, for instance, have replaced NOTEPAD with
another program by renaming a couple of EXE files. And Notepad will not necessarily be
called Notepad in non-English language versions of Windows.
And so everything may change all the time, making life difficult for us
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Mon Feb 17, 2003 12:52 pm Post subject: |
|
|
Actually... if notepad is sufficient for the task, ya could use your
own multi-line edit control in a child window (or ship your own
text editor) - it'd have approx the same capacity as notepad...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Mon Feb 17, 2003 5:00 pm Post subject: kk |
|
|
ok thanks guy for the help..i like mac's last idea this would avoid any problems..
thanks
again |
|
| Back to top |
|
 |
|