AutoHotkey Community

It is currently May 27th, 2012, 4:09 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 14 posts ] 
Author Message
PostPosted: June 25th, 2011, 1:20 am 
Offline

Joined: June 25th, 2011, 1:02 am
Posts: 7
Hi

Here is my question and I hope that you can give me some suggestion.

Situation:

i have input information (e.g. 1, 2, 3) into the excel spreadsheet.
Now i want to transfer the number 1, 2 & 3 across to another program.
At the moment, the only way i know how to do this with AutoHotKey is to do the following in .ahk file

::go::1{enter}2{enter}3{enter}

when i am in the other program, i would type in the word "go" to transfer the number 1, 2 and 3 across.

Can anyone please advise whether there is a way to transfer the number 1, 2 and 3 across from excel file to another program without having to physically put in "1{enter}2{enter}3{enter}" after "::go::" in .ahk file?

Thank you.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 25th, 2011, 1:50 am 
Offline
User avatar

Joined: November 2nd, 2008, 4:23 pm
Posts: 2906
Location: 127.0.0.1
Save the sheet as a .CSV file. It will look something like this:
Code:
"A","B","C"


Then FileRead it into a variable. You can use Loop, Parse to get each field and use Send to type each of them.
http://www.autohotkey.com/docs/commands/LoopParse.htm

Note: for Delimiters you can put CSV to parse it as a CSV file. If you don't know how to use it, read the page and try it out. If you still can't figure it out post your code that you've tried.

_________________
aboutscriptappsscripts
Any code ⇈ above ⇈ requires AutoHotkey_L to run


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2011, 11:41 am 
Offline

Joined: June 25th, 2011, 1:02 am
Posts: 7
Frankie wrote:
Save the sheet as a .CSV file. It will look something like this:
Code:
"A","B","C"


Then FileRead it into a variable. You can use Loop, Parse to get each field and use Send to type each of them.
http://www.autohotkey.com/docs/commands/LoopParse.htm

Note: for Delimiters you can put CSV to parse it as a CSV file. If you don't know how to use it, read the page and try it out. If you still can't figure it out post your code that you've tried.


Hi Frankie

I am sorry I don't understand how to use the method you mention above. I did read the information in the attached link above but I didn't understand it. I want to keep the original information in excel format and I want to transfer the information across to another program by pressing the hotkey without having to copy the script into the .ahk file first. I hope that I am not confusing you.

thank you.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2011, 12:03 pm 
Offline
User avatar

Joined: May 18th, 2010, 3:10 pm
Posts: 1179
Location: Sweden
Naruto wrote:
Frankie wrote:
Save the sheet as a .CSV file. It will look something like this:
Code:
"A","B","C"


Then FileRead it into a variable. You can use Loop, Parse to get each field and use Send to type each of them.
http://www.autohotkey.com/docs/commands/LoopParse.htm

Note: for Delimiters you can put CSV to parse it as a CSV file. If you don't know how to use it, read the page and try it out. If you still can't figure it out post your code that you've tried.


Hi Frankie

I am sorry I don't understand how to use the method you mention above. I did read the information in the attached link above but I didn't understand it. I want to keep the original information in excel format and I want to transfer the information across to another program by pressing the hotkey without having to copy the script into the .ahk file first. I hope that I am not confusing you.

thank you.


Welcome to the forums by the way!

What other program are you transferring to? With "Excel format"; what more specifically do you mean?

_________________
~sumon Appifyer AHK Nova halted Recommended: AHK_L (Why?)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2011, 12:22 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
@sumon: use "Post Reply", not "quote" please. Thx.

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
PostPosted: June 27th, 2011, 12:34 pm 
Offline

Joined: June 25th, 2011, 1:02 am
Posts: 7
Naruto wrote:
Frankie wrote:
Save the sheet as a .CSV file. It will look something like this:
Code:
"A","B","C"


Then FileRead it into a variable. You can use Loop, Parse to get each field and use Send to type each of them.
http://www.autohotkey.com/docs/commands/LoopParse.htm

Note: for Delimiters you can put CSV to parse it as a CSV file. If you don't know how to use it, read the page and try it out. If you still can't figure it out post your code that you've tried.


Hi Frankie

I am sorry I don't understand how to use the method you mention above. I did read the information in the attached link above but I didn't understand it. I want to keep the original information in excel format and I want to transfer the information across to another program by pressing the hotkey without having to copy the script into the .ahk file first. I hope that I am not confusing you.

thank you.


Hi Frankie or anyone who can help

Perhaps I am not specific enough about what I want to do. I will try to explain it again.

for example, in the excel file, i have the following information

column A column B column C column D
7604 1 0 7604{enter}1{enter}0{enter}

I have put in the script within column D in the excel file to link all the numbers that I want to transfer to another program together. I would like to know if there is a way to transfer the information across to another program without copying the script in column D to the .ahk file first? I want to be able to transfer all the scripts in the excel file to another program at once by typing in the hotkey. At the moment, the only way I know how to transfer the information across is to copy each script in the excel file to .ahk file.

thank you.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2011, 12:50 pm 
Offline

Joined: June 25th, 2011, 1:02 am
Posts: 7
sorry, I am new to this forum. I will use post reply from now on. Thanks for the tip.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2011, 12:54 pm 
Offline

Joined: June 25th, 2011, 1:02 am
Posts: 7
Sumon

The program that I want to transfer the information to is called 'Everest' which is a cost estimating program used in the building industry. When I said excel format, I mean I want to keep my document as an excel file. I don't want to change to a CSV file.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2011, 12:59 pm 
Offline

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
Maybe using Excel.Application?

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2011, 1:43 pm 
Offline

Joined: June 25th, 2011, 1:02 am
Posts: 7
Tonne

Thanks for the reply. Does this allow me to transfer the information across to another program? thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2011, 1:47 pm 
Offline

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
The example shows how the read a value and i.e. save it onto the clipboard:
Code:
Clipboard := oExcel.Range("A3").Value

You could send some values with
Code:
Send % oExcel.Range("A3").Value . oExcel.Range("B3").Value . oExcel.Range("C3").Value
or save to temporary variables and send
Code:
name := oExcel.Range("A3").Value
id := oExcel.Range("B3").Value
send %name%{enter}%id%

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2011, 2:15 pm 
Offline

Joined: June 25th, 2011, 1:02 am
Posts: 7
thanks for the reply Tonne

It all sounds too confusing for me. I am completely new to this. All I want to do is to create a script which represents the keystrokes that i have to input to the other program.

for example, i have got all the data (e.g. 1, 2 and 3) in an excel file. if i want to transfer the information to the other program manually, i have to type in 1 and then press enter and then type in 2 and then press enter and then type in 3 and then press enter. That's why i have created the script 1{enter}2{enter}3{enter} in the excel file. This script allows me to link all the numbers that i want to transfer across together in the excel file. When i transfer this information across to the other program, I can simply copy the script 1{enter}2{enter}3{enter} to .ahk file and then press the hotkey i have created in the .ahk file to transfer this information. My question is if there is a way to transfer this information across without having to copy the script to the .ahk file first. I hope that I am clear on this one.

thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2011, 2:25 pm 
Offline

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
Code:
f11::
  winactivate,ahk_class XLMAIN ; goto excel (assuming one window)
  clipboard = ; clear clipboard
  send ^c ; copy to clipboard
  clipwait, 1 ; wait for clipboard (max 1 sec)
  winactivate,ahk_class Notepad ; goto notepad (replace with your program or open notepad first)
  send %clipboard% ; send the copied value
return

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2011, 2:28 pm 
Offline
User avatar

Joined: November 2nd, 2008, 4:23 pm
Posts: 2906
Location: 127.0.0.1
I'll give one more option, but there's only so many ways to do this.

You can select the fields in excel you want and press Ctrl-C (copy) and when you press another hotkey (Ctrl-Shift-V maybe?) AutoHotkey formats and sends the text.

I don't know about your spreadsheet program, but in mine copying makes plain text broken into lines and separated by tabs.

Code:
^+v::
To_Send := "", Text := Clipboard
Loop, Parse, Text, `n
{
   Row := A_Index ; Incase you need it
   Loop, Parse, A_LoopField, %A_Tab%
   {
      To_Send .= A_LoopField . "{enter}"
   }
}
Send % To_Send
return


You're most likely going to have to modify it to suit your needs.

_________________
aboutscriptappsscripts
Any code ⇈ above ⇈ requires AutoHotkey_L to run


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Leef_me, patgenn123, rbrtryn and 68 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