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 

Having an issue clearing StringSplit OutputArray

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Lusein



Joined: 08 Jul 2009
Posts: 5
Location: St. Louis, Mo.

PostPosted: Wed Jul 08, 2009 5:41 pm    Post subject: Having an issue clearing StringSplit OutputArray Reply with quote

I have searched the forums looking for a way to clear the OutputArray for StringSplit. My issue with my hotkey is sometimes I need to only grab 1 output and sometimes I need to grab multiple outputs. the issue I have is that when I switch from grabbing 4 to grabbing 1 it outputs the new output and the previous outputs from positions 2-4.

Code:

!F2::
clipboard = 
Send ^c
ClipWait
StringSplit, Split, Clipboard, %A_Tab%
sleep, 500
Msgbox, %Split23%`n%Split37%`n%Split51%`n%Split65%
return


[ Moderator!: Moved from General Chat ]
Back to top
View user's profile Send private message
keyboardfreak



Joined: 09 Oct 2004
Posts: 216
Location: Budapest, Hungary

PostPosted: Wed Jul 08, 2009 6:02 pm    Post subject: Reply with quote

Split0 contains the number of outputs, so you know how much to show.
Back to top
View user's profile Send private message
Lusein



Joined: 08 Jul 2009
Posts: 5
Location: St. Louis, Mo.

PostPosted: Wed Jul 08, 2009 6:18 pm    Post subject: Reply with quote

Some times I need to grab all 4 outputs, and I would rather not have two separate hotkey's or reload the hotkey every time I need to grab less variables then the previous time. Basically I would like to clear the variables at the end of the script.


Ok so I figured this out but if anyone has a better way please let me know.

Code:

!F2::
Split23 =
Split37 =
Split51 =
Split65 =

clipboard =
Send ^c
ClipWait
StringSplit, Split, Clipboard, %A_Tab%
sleep, 500
Msgbox, %Split23%`n%Split37%`n%Split51%`n%Split65%
return
Back to top
View user's profile Send private message
jethrow



Joined: 24 May 2009
Posts: 1907
Location: Iowa, USA

PostPosted: Wed Jul 08, 2009 10:19 pm    Post subject: Reply with quote

Quote:
I have searched the forums looking for a way to clear the OutputArray for StringSplit.
Code:
StringSplit, Split, Clipboard, %A_Tab%

Loop, % Split0
   Split%A_Index% =
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
sinkfaze



Joined: 18 Mar 2008
Posts: 5043
Location: the tunnel(?=light)

PostPosted: Wed Jul 08, 2009 11:08 pm    Post subject: Reply with quote

Alternately I think this will work also:

Code:
StringSplit, Split, Clipboard, %A_Tab%
Loop, % Split0
   VarSetCapacity(Split%A_Index%,0)

_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message Send e-mail
Lusein



Joined: 08 Jul 2009
Posts: 5
Location: St. Louis, Mo.

PostPosted: Thu Jul 09, 2009 12:05 pm    Post subject: Reply with quote

Thank you all with your help is was able to get it to work.

Code:

!F2::
Loop, % Split0
   VarSetCapacity(Split%A_Index%,0)
clipboard = 
Send ^c
ClipWait
StringSplit, Split, Clipboard, %A_Tab%
sleep, 500
clipboard = %Split23%
Msgbox, %Split23%`n%Split37%`n%Split51%`n%Split65%
return
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help 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