 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Newbie123 Guest
|
Posted: Thu Aug 21, 2008 7:52 pm Post subject: Cannot paste a variable, why? |
|
|
I have this script to paste a variable to the notepad, but nothing is happening, no error message, only the notepade windows is activate but nothing is writen:
| Code: |
SetDefaultMouseSpeed, 0
SetTitleMatchMode, 2
Loop, Read, Order.csv
{
StringSplit, CSVColumn, A_LoopReadLine, `,
%CSVColumn1%:=CSVColumn2
}
WinActivate New Text Document.txt
Send, %Initials% ;only sending this one to test
Why nothing happens?
Thanks,
|
|
|
| Back to top |
|
 |
Sivvy
Joined: 21 Jul 2008 Posts: 711 Location: Calgary, AB, Canada
|
Posted: Thu Aug 21, 2008 7:53 pm Post subject: |
|
|
| Code: | SetDefaultMouseSpeed, 0
SetTitleMatchMode, 2
Loop, Read, Order.csv
{
StringSplit, CSVColumn, A_LoopReadLine, `,
%CSVColumn1%:=CSVColumn2
WinActivate New Text Document.txt
Send, %Initials%
} |
Does that work? |
|
| Back to top |
|
 |
Newbie123 Guest
|
Posted: Thu Aug 21, 2008 8:07 pm Post subject: |
|
|
| No, now itīs not even open the notepad. I come back to the old version and deleted the %% to Initials. And it goes to the notepad and writes the word "Initials", so itīs something related to the variable. I tested this at home and worked, but now Iīm at the office and itīs not working. The excel file is the same, the variables are the same, donīt know why this is happens. |
|
| Back to top |
|
 |
Sivvy
Joined: 21 Jul 2008 Posts: 711 Location: Calgary, AB, Canada
|
Posted: Thu Aug 21, 2008 8:23 pm Post subject: |
|
|
I don't think the variables it's creating are permanent, meaning you might have to use them right away. Heres a test. What is the very last line in your file?
If the last line is "Address" (I have no idea), use that variable... If it prints, then it means that the last variable created is the only one working...
Or try this. If every msgbox seems correct, then you know it's working so far... At the end, if you only see one of the names in the "ListVars", then it means they aren't permanent.
| Code: | SetDefaultMouseSpeed, 0
SetTitleMatchMode, 2
Loop, Read, Order.csv
{
StringSplit, CSVColumn, A_LoopReadLine, `,
%CSVColumn1%:=CSVColumn2
MsgBox, %CSVColumn1%
}
ListVars
Pause, On |
|
|
| Back to top |
|
 |
BoBoē Guest
|
Posted: Thu Aug 21, 2008 8:32 pm Post subject: |
|
|
| Quote: | | so itīs something related to the variable | Indeed. You send an empty variable ("Initials"), which never has defined nor filled (assuming that the code is complete, which btw is mandatory to do some analysis). Looks like you have to check out coding basics before going on with kinda rocket science.
| Code: | Loop, Read, Order.csv, NewOrder.csv
{
StringSplit, CSVColumn, A_LoopReadLine, `,
FileAppend, % CSVColumn2 ";"
}
Run, Notepad NewOrder.csv |
|
|
| Back to top |
|
 |
BoBoē Guest
|
|
| Back to top |
|
 |
Newbie123 Guest
|
Posted: Thu Aug 21, 2008 8:56 pm Post subject: |
|
|
The script gives me this message:
Global Variables (alphabetical)
--------------------------------------------------
0[1 of 3]: 0
CSVColumn0[0 of 0]:
CSVColumn1[0 of 0]:
CSVColumn2[0 of 0]:
ErrorLevel[1 of 3]: 0
But the variable is defined by the loop of stringsplit, right? I mean, itīs creating a variable with a name = content: Initials = JS, address = 1 main st.
PD: Sorry Bobo, but itīs not the same topic, now I have the script, Iīm asking a specific question at the time as it says in the in the sticky How to get answers effectively. |
|
| Back to top |
|
 |
Sivvy
Joined: 21 Jul 2008 Posts: 711 Location: Calgary, AB, Canada
|
Posted: Thu Aug 21, 2008 9:17 pm Post subject: |
|
|
| What did the Message boxes say? Did they show up properly? |
|
| Back to top |
|
 |
Newbie123 Guest
|
Posted: Thu Aug 21, 2008 9:39 pm Post subject: |
|
|
| No, they didnīt, itīs a gray screen with the text I copied. |
|
| Back to top |
|
 |
BoBoē Guest
|
Posted: Thu Aug 21, 2008 9:45 pm Post subject: |
|
|
| Please provide a sample input file (excerpt), and the format you expect as the output. |
|
| Back to top |
|
 |
Sivvy
Joined: 21 Jul 2008 Posts: 711 Location: Calgary, AB, Canada
|
Posted: Fri Aug 22, 2008 12:41 pm Post subject: |
|
|
| Wow... The Message Boxes didn't even show up? Or do you mean they were just blank? |
|
| Back to top |
|
 |
Hasso
Joined: 23 Mar 2005 Posts: 158 Location: Germany
|
Posted: Mon Aug 25, 2008 9:09 am Post subject: |
|
|
| Quote: | WinActivate New Text Document.txt
Send, %Initials% |
Shouldn't you insert | Code: | WinActivate New Text Document.txt
WinWaitActive, New Text Document.txt
Send, %Initials% |
_________________ Hasso
Programmers don't die, they GOSUB without RETURN |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|