Jump to content

Recommended Posts

Posted

G'day everyone

I'm writing a script that segments a piece of text, then displays the contents of it using an array. I don't know in advance how big the array will be, so I'd like the script to return "0" if it asks for an array item that is nonexistant. Can this be done?

Basically, the text is something like this:

'asdfa' 'asdf1x'

'asdfb' 'asdf2x'

'asdfc' 'asdf3x'

'asdfd' 'asdf4x'

The above text is added to the clippboard, and then my code is this:

$split = StringSplit ($clip, "'", 0)

ToolTip ("Numbers:" & @CRLF & @CRLF & "1. " & $split[4] & @CRLF & "2. " & $split[8] & @CRLF & "3. " & $split[12] & @CRLF & "4. " & $split[16] & @CRLF & "5. " & $split[20] & @CRLF & "6. " & $split[24] & @CRLF & "7. " & $split[28] & @CRLF & "8. " & $split[32] & @CRLF & "9. " & $split[36] & @CRLF &  @CRLF & "End of numbers.", 20, 20, "")

I want the tooltip to display this:

1. asdf1x

2. asdf2x

3. asdf3x

4. asdf4x

or this:

1. asdf1x

2. asdf2x

3. asdf3x

4. asdf4x

5.

6.

7.

8.

9.

of even this:

1. asdf1x

2. asdf2x

3. asdf3x

4. asdf4x

5. 0

6. 0

7. 0

8. 0

9. 0

Can this be done? Or else, is there a simple way to integrate a For-Next loop with a MsgBox so that I can include only the number of items that exist?

Alternatively, is it possible to add to an array (add to the end of it) so that I may add a sufficient number of dummy entries to the end of it?

Thanks

Samuel

Posted

Dim $Test[4] = ["000","001", "010", "011"]
Thanks for that! I'll give a try sometime.

As a matter of fact, I solved it by just adding to the array. A very dirty solution, though.

Posted (edited)

:S

It was about this part:

Func _ArrayDisplayLeuce($sArray)
    Local $sSize = UBound($sArray)-1
    Local $sReturn = "Numbers:" & @LF
   
    For $x = 0 to $sSize
        $sReturn &= $x & ". " & $sArray[$x] & @LF
    Next
   
    ToolTip($sReturn)
EndFunc

Not the dimming of the array..

I hate when you put time and effort into solving someone else's problem, and they just say "Never mind, I've figured it out!! I'll try your solution another time.". That is just so ungrateful!

Edited by Manadar
  • 4 weeks later...
Posted

If you hate it that much then don't help :)...

Think of it this way you may help others in the future...

~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...