AutoHotkey Community

It is currently May 26th, 2012, 7:59 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: July 8th, 2009, 6:41 pm 
Offline

Joined: July 8th, 2009, 5:50 pm
Posts: 5
Location: St. Louis, Mo.
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 ]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 8th, 2009, 7:02 pm 
Offline

Joined: October 9th, 2004, 8:55 pm
Posts: 217
Location: Budapest, Hungary
Split0 contains the number of outputs, so you know how much to show.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 8th, 2009, 7:18 pm 
Offline

Joined: July 8th, 2009, 5:50 pm
Posts: 5
Location: St. Louis, Mo.
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 8th, 2009, 11:19 pm 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
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% =


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 9th, 2009, 12:08 am 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
Alternately I think this will work also:

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

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 9th, 2009, 1:05 pm 
Offline

Joined: July 8th, 2009, 5:50 pm
Posts: 5
Location: St. Louis, Mo.
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


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, joetazz, Retro Gamer, wolverineks and 69 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group