| View previous topic :: View next topic |
| Author |
Message |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Wed Feb 19, 2003 12:54 pm Post subject: Get content from Clipboard to a variable... |
|
|
How can I retrieve the contents of the windows clipboard and put the content into a variable?
I want to use this in the EVLOOP part to check if the user copies a URL to the clipboard.
Also, not sure, but I guess I have to use the parse thing to check if the content of the clipboard is a valid URL.
Could anyone help me with this?
I'm making a simple download program, (My first in VDS) and want the download button only to be enabled when a valid URL is in the clipboard. _________________
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Feb 19, 2003 1:36 pm Post subject: |
|
|
Create a list and use LIST COPY, then retrieve it from the list.
| Code: |
LIST CREATE, 1
LIST PASTE, 1
%%var = @text(1)
|
EDIT - OOPS - shoulda been LIST PASTE...
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

Last edited by Mac on Wed Feb 19, 2003 1:59 pm; edited 1 time in total |
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Wed Feb 19, 2003 1:49 pm Post subject: |
|
|
I tried this, but It don't seem to work
| Code: | DIALOG CREATE,New Dialog,-1,0,240,160
LIST CREATE, 1
LIST COPY, 1
DIALOG SHOW
%%var = @text(1)
info Result: %%var
:Close
Exit |
_________________
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Feb 19, 2003 1:57 pm Post subject: |
|
|
OOPS...
DUH - Should be LIST PASTE not LIST COPY...
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 |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Wed Feb 19, 2003 2:02 pm Post subject: |
|
|
Works great. Thanks Mac  _________________
 |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Wed Feb 19, 2003 2:19 pm Post subject: |
|
|
Maybe you should put it into a loop, to keep on checking untill there is something on the clipboard...
| Code: |
list create,1
repeat
list paste,1
%%var = @text(1)
wait 0.1
until %%var
info Result: %%var |
|
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Wed Feb 19, 2003 2:32 pm Post subject: |
|
|
Yeah, I thought about that.
But wont that cause a recursion of the script?
With the unlimited loop I mean. _________________
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Feb 19, 2003 2:37 pm Post subject: |
|
|
Ya could use a TIMER event, OR add @event() to the
REPEAT/UNTIL loop exit criteria...
| Code: |
REPEAT
LIST PASTE, 1
WAIT "0.1"
%%var = @text(1)
UNTIL %%var @event()
|
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 |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Wed Feb 19, 2003 2:47 pm Post subject: |
|
|
Is it posible to cause a recursion to the script when using loops with VDS?
I would like to have a past button that is disabled if there is no valid URL to a downloadable file in the clipboard. And if there is a valid download URL the past button becomes enabled.
Is this possible? _________________
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Feb 19, 2003 3:00 pm Post subject: |
|
|
Yep - you can lock VDS up tighter than a drum if ya have any
kind of a loop with no way out of it.
But - as long as ya have a close button (and a CLOSE label),
and use @event() as one outlet for the loop, there shouldn't
be a problem.
A TIMER event would prolly work fine for what you're doin'
though.
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 |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Wed Feb 19, 2003 3:09 pm Post subject: |
|
|
That's a good idea.
When using your loop example with the wait command my CPU usage actually dropped a few precents  _________________
 |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Wed Feb 19, 2003 10:08 pm Post subject: |
|
|
Here's a question on why the loops cause 100% CPU usage: is it a bug in
the way VDS is programmed? Why does it not cause 100% CPU even
when you use WAIT "0.0000000000000000000001"? Perhaps it
should be a feature pre-built into VDS that it waits even less than a
nano-second (I'm not scientific here, just used as a figure of speech )
to avoid the 100% CPU load.  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Feb 20, 2003 12:42 am Post subject: |
|
|
I dunno - maybe loops are high priority? Although, if there was
a built in delay, @datetime() would be off more...
Another note - about the fastest I've been able to get a
WAIT to do is aprox 1/100 of a second (".01") - anything
faster (".001", etc.) appears to wait about the same length
of time (used @datetime() to check this).
Wondering if this varies with CPU speed, or is there just a
point where VDS won't execute a WAIT any faster?
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 |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Thu Feb 20, 2003 4:58 pm Post subject: |
|
|
| I think the wait command can't be faster the 1/100 of a second, because VDS is a interpretted language. Or it's because it uses the Windows API or something, which probably won't be much accurater then 1/100 of a sec... |
|
| Back to top |
|
 |
|