AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

if name is varname

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Mon Mar 07, 2005 5:39 pm    Post subject: if name is varname Reply with quote

It would be nice to be able to check with a single instruction if the content of a variable can be used to name a variable. The following code works, but it is long and if the set of allowed characters change, it has to be updated.
Code:
StringReplace var,Name, #, a, All
StringReplace var, var, _, a, All
StringReplace var, var, @, a, All
StringReplace var, var, $, a, All
StringReplace var, var, ?, a, All
StringReplace var, var, [, a, All
StringReplace var, var, ], a, All
if var is alnum             ; check if Name can be a variable
   NameError = 0
else
   NameError = 1
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Mon Mar 07, 2005 6:25 pm    Post subject: Reply with quote

Can you give an example of what you would use this for?

Also, if anyone else has ever felt the need for something like this, please post here because it helps set the priority.

Thanks.
Back to top
View user's profile Send private message Send e-mail
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Mon Mar 07, 2005 6:36 pm    Post subject: Reply with quote

This is used as an error check in my Deluxe Clipboard vers. 1.1 script. The user provides a name of his private clipboard, which will be used as part of a name of a variable holding clipboard data.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group