Jump to content
Sign in to follow this  
dajesterofdeath

Clipget and Excel issue

Recommended Posts

dajesterofdeath

i am trying to paste a string of data into excel from the clip board. when done manually this works perfectly, seperating each variable into the correct columns. however when i attempt to use

_ExcelWriteCell($oExcel, ClipGet(), "A3", 1)

it seems to paste it into the first cell only (A3) and does not seperate with the tabs in my string

this is what it pastes

"Name[?]13/07/2011[?]13/07/2011[?]Client Name[?]Client Number[?]1[?]0.2[?]0.2[?]0.2[?]0.2[?]0.2[?]0.5[?]0.5[?]0.5[?]0.5[?]2[?]1[?]1[?]1[?]3[?]1"

the [?] represents a @tab which only happens in excel when using the clipget code.

any suggestions

example of code

Note each $var equals a value elsewhere in my script.

my code is most likely shocking i know, still a newbie to autoit.

ClipPut(GUICtrlRead($combo) & @TAB & GUICtrlRead($Input4) & @TAB & GUICtrlRead($Input2) & @TAB & GUICtrlRead($Input3) & @TAB & GUICtrlRead($Input5) & @TAB & @TAB & $var14 & @TAB & $var15 & @TAB & $var16 & @TAB & $var17 & @TAB & $var18 & @TAB & $var19 & @TAB & $var23 + $var24 + $var25 + $var26 + $var27 + $var28 + $var29 + $var30 + $var31 + $var32 & @TAB & $var33 & @TAB & $var21 & @TAB & $var20 & @TAB & $var22 & @TAB & $var37 & @TAB & $var34 & @TAB & $var35 & @TAB & $var36 & @TAB & @TAB & $var38 & @TAB & GUICtrlRead($Editbox1) & @TAB & GUICtrlRead($Editbox2) & @TAB & GUICtrlRead($Editbox3) & @TAB & GUICtrlRead($Editbox4))
                $oExcel = _ExcelBookOpen("FILE LOCATION" & $var6); $var6 is the date in the Input4 field
                _ExcelWriteCell($oExcel, ClipGet(), "A3", 1)

Share this post


Link to post
Share on other sites
JoHanatCent

i am trying to paste a string of data into excel from the clip board. when done manually this works perfectly, seperating each variable into the correct columns. however when i attempt to use

_ExcelWriteCell($oExcel, ClipGet(), "A3", 1)

it seems to paste it into the first cell only (A3) and does not seperate with the tabs in my string

this is what it pastes

"Name[?]13/07/2011[?]13/07/2011[?]Client Name[?]Client Number[?]1[?]0.2[?]0.2[?]0.2[?]0.2[?]0.2[?]0.5[?]0.5[?]0.5[?]0.5[?]2[?]1[?]1[?]1[?]3[?]1"

the [?] represents a @tab which only happens in excel when using the clipget code.

any suggestions

example of code

Note each $var equals a value elsewhere in my script.

my code is most likely shocking i know, still a newbie to autoit.

ClipPut(GUICtrlRead($combo) & @TAB & GUICtrlRead($Input4) & @TAB & GUICtrlRead($Input2) & @TAB & GUICtrlRead($Input3) & @TAB & GUICtrlRead($Input5) & @TAB & @TAB & $var14 & @TAB & $var15 & @TAB & $var16 & @TAB & $var17 & @TAB & $var18 & @TAB & $var19 & @TAB & $var23 + $var24 + $var25 + $var26 + $var27 + $var28 + $var29 + $var30 + $var31 + $var32 & @TAB & $var33 & @TAB & $var21 & @TAB & $var20 & @TAB & $var22 & @TAB & $var37 & @TAB & $var34 & @TAB & $var35 & @TAB & $var36 & @TAB & @TAB & $var38 & @TAB & GUICtrlRead($Editbox1) & @TAB & GUICtrlRead($Editbox2) & @TAB & GUICtrlRead($Editbox3) & @TAB & GUICtrlRead($Editbox4))
                $oExcel = _ExcelBookOpen("FILE LOCATION" & $var6); $var6 is the date in the Input4 field
                _ExcelWriteCell($oExcel, ClipGet(), "A3", 1)

Why not write all your GuiCtrlReads and Variables straigt into Excel with a little loop

or

String split your ClipGet and write the result to Excel?


Share this post


Link to post
Share on other sites
dajesterofdeath

Stringsplit worked, thanks for that

i am having one issue.

i have my program, write the array to excel then save and close the book, however after this happens if i attempt to open any other excel files they just hang and i have to end the excel.exe process. unfortunately i cannot include in my program to just kill the process once its finished saving as i need other excel files open at all times.

any suggestions?

Share this post


Link to post
Share on other sites
twitchyliquid64

Stringsplit worked, thanks for that

i am having one issue.

i have my program, write the array to excel then save and close the book, however after this happens if i attempt to open any other excel files they just hang and i have to end the excel.exe process. unfortunately i cannot include in my program to just kill the process once its finished saving as i need other excel files open at all times.

any suggestions?

How long do you wait between closing the File, and opening another file? Sometimes file locks get screwed up and 5 seconds wait can fix the problem...

Ive never had this problem tbh, just speculating...


ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Share this post


Link to post
Share on other sites
dajesterofdeath

il attempt that. i think the main issue is that its opening the workbook on a current instance of excel.exe, i need it to open a new instance of excel.exe, write the array, then save and close that instance.

currently if i end my script it after it writes saves and closes, it will end that instance, however i need to keep my script running

Share this post


Link to post
Share on other sites
dajesterofdeath

sleep didnt work

however i have added Run ("excel.exe") to my code so it does create a 2nd instance of excel.exe

now all i need to do is work out how to get the PID of the youngest excel.exe and then terminate it.

any thoughts on this?

Share this post


Link to post
Share on other sites
dajesterofdeath

worked it out

$newexcel = Run ("excel.exe")

$newexcel.close

creates a new instance of excel

then closes it when done

noob error. thanks anyway

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  

×