forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Need Help with Window Send Command

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
jrmarquart
Valued Newbie


Joined: 12 Jun 2004
Posts: 28
Location: Boise, ID

PostPosted: Tue Oct 19, 2004 2:54 am    Post subject: Need Help with Window Send Command Reply with quote

I am having the following issue with the window send command:

As an example the following code works fine in a VDS script:

Code:
%I = @winactive(I)
%%sendme = @ctrl(j)@key(Esc)
window send,%I,%%sendme


This works great and simulates the pressing of the Ctrl-J and Esc key to the active window.

What I would really like to do from my script though is read the contents of the variable %%sendme from a text or .ini file as follows:

Code:
%I = @winactive(I)
%%sendme = @iniread(Keys,Keys1)
window send,%I,%%sendme


where Keys1=@ctrl(j)@key(Esc)

The problem here is that instead of simulating the pressing of the Ctrl-J and Esc key - now instead the following characters are sent to the active window: @ctrl(j)@key(Esc).

I don't want this, but would rather like it to work like the first script above. Is there an easy way of doing this without having to parse all of this info. out of the text or .ini file and then having to explicitly specify the @ functions manually in the script?

I apologize if this has been covered before, but it does not seem obvious to me as to how you would do this.


Last edited by jrmarquart on Tue Oct 19, 2004 3:55 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Tue Oct 19, 2004 3:12 am    Post subject: Reply with quote

You can't use a variable in place of a VDS function or command. Both @CTRL and @ESC are VDS functions.
You would have to see if %%sendme equaled @ctrl(j)@esc and then send them. That of course only works if you actually know the possible keys the user will want you to send.
So something along the lines of:
Code:

%I = @winactive(I)
%%sendme = @iniread(Keys,Keys1)
if @EQUAL(%%sendme,"@ctrl(j)@esc")
  window send,%I,@ctrl(j)@esc
end
if @EQUAL(%%sendme,"@alt@esc")
  window send,%I,@alt@esc
end

Hope that helps.

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
jrmarquart
Valued Newbie


Joined: 12 Jun 2004
Posts: 28
Location: Boise, ID

PostPosted: Tue Oct 19, 2004 4:11 am    Post subject: Reply with quote

SnarlingSheep: Actually I meant to have @key(Esc) instead of @esc, sorry about that - I have updated my original post.

Unfortunately the problem is I don't know what the actual keys a user will want to send - the user would be adding these to a .ini file and the script will simply read this and import these characters into a variable within the compiled VDS script. Thanks for your help though - I will look into possibly another way (if possible) to accomplish this.
Back to top
View user's profile Send private message Visit poster's website
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Tue Oct 19, 2004 9:58 am    Post subject: Reply with quote

Try this. I hope you will understand what it does a bit, so you can adjust it to your own needs... Smile

Code:
%%sendme = "test@shift(abc)test"
%%output =

%%counter = 1
repeat
  if @unequal(@substr(%%sendme,%%counter,%%counter),"@")
    %%output = %%output@substr(%%sendme,%%counter,%%counter)
  else
    # Get the function
    %%function = @substr(%%sendme,%%counter,@len(%%sendme))
    # Get the parameter
    %%parameters = @substr(%%function,@succ(@pos("(",%%function)),@pred(@pos(")",%%function)))
    # And trim down the function name
    %%function = @substr(%%function,2,@pred(@pos("(",%%function)))
    # Now check the function's name, and add it to %%output
    if @equal(%%function,"CTRL")
      %%output = %%output@ctrl(%%parameters)
    end
    if @equal(%%function,"ALT")
      %%output = %%output@alt(%%parameters)
    end
    if @equal(%%function,"SHIFT")
      %%output = %%output@shift(%%parameters)
    end
    if @equal(%%function,"CR")
      %%output = %%output@cr()
    end
    if @equal(%%function,"KEY")
      %%output = %%output@key(%%parameters)
    end
    %%counter = @sum(%%counter,@len(%%function),@len(%%parameters),2)
  end
  %%counter = @succ(%%counter)
until @greater(%%counter,@len(%%sendme))

info %%output

_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
jrmarquart
Valued Newbie


Joined: 12 Jun 2004
Posts: 28
Location: Boise, ID

PostPosted: Thu Oct 21, 2004 3:41 am    Post subject: Reply with quote

Excellent! This was exactly what I was looking for Skit. It works perfectly. Thank you - you saved me a lot of time. Razz
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group