Sign in to follow this  
Followers 0
GEOSoft

What is wrong with this scenario?

5 posts in this topic

; Script Function:
;   Convert KB article number to URL
;
$a=clipget ()
StringStripWS ($a,7)
If StringLeft ($a,1)="Q" Then $a=StringTrimLeft ($a,1)
If StringIsDigit ($a)="0" OR StringLen ($a) <"5" OR StringLen ($a) >"6" Then 
    MsgBox (4096,'Error!!','The clipboard does not appear to contain a valid MS Knowledge Base article number'&@LF&'Please check your selection again and retry.')
    Exit
EndIf
ClipPut ('http://support.microsoft.com/?kbid='&$a)
MsgBox (4096,'', 'DONE!!',1)
Exit

I will use Q178238 as the example. If the line contains

Q178238

and I double click the number to select it then copy it to the clipboard,

the Q should be stripped (it is) and then it is checked to make sure it is a numeric value of either 5 or 6 digits (so far so good). If I add a space to the end of the line and repeat the process, the StringStripWS ($a,7) should be removing the trailing space. This is where it fails. I get the MsgBox (Error) showing instead.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites



:iamstupid: Duh!!!

That probably applied to the other workarounds I tried too. Thanks Jon.

By the way can you use multiple conditions in Do....Until or While loops?

eg;

Do

<whatever>

Until <condition 1> OR <condition 2>

While <condition1> OR <condition2>

<whatever routine>

Wend


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

i dont see why not, try it. <condition 1> OR <condition 2> is the same as <condition3> to the computer, and so it would be interpreted as Until <condition 3>. i think. did that make sense?

Share this post


Link to post
Share on other sites

:iamstupid: Duh!!!

That probably applied to the other workarounds I tried too.  Thanks Jon.

By the way can you use multiple conditions in Do....Until or While loops?

eg;

Do

<whatever>

Until <condition 1> OR <condition 2>

Yep. JP has done one that's about 5 lines long...for testing purposes :whistle:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0