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 

Cannot paste a variable, why?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Newbie123
Guest





PostPosted: Thu Aug 21, 2008 7:52 pm    Post subject: Cannot paste a variable, why? Reply with quote

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

PostPosted: Thu Aug 21, 2008 7:53 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Newbie123
Guest





PostPosted: Thu Aug 21, 2008 8:07 pm    Post subject: Reply with quote

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

PostPosted: Thu Aug 21, 2008 8:23 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
BoBoē
Guest





PostPosted: Thu Aug 21, 2008 8:32 pm    Post subject: Reply with quote

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. Wink

Code:
Loop, Read, Order.csv, NewOrder.csv
{
   StringSplit, CSVColumn, A_LoopReadLine, `,
   FileAppend, % CSVColumn2 ";"
   }
Run, Notepad NewOrder.csv
Back to top
BoBoē
Guest





PostPosted: Thu Aug 21, 2008 8:36 pm    Post subject: Reply with quote

Well, TBH, we don't like to see several posts dealing with the same issue Confused
[Loop parse a string and variables, how can assign each value]
Back to top
Newbie123
Guest





PostPosted: Thu Aug 21, 2008 8:56 pm    Post subject: Reply with quote

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

PostPosted: Thu Aug 21, 2008 9:17 pm    Post subject: Reply with quote

What did the Message boxes say? Did they show up properly?
Back to top
View user's profile Send private message MSN Messenger
Newbie123
Guest





PostPosted: Thu Aug 21, 2008 9:39 pm    Post subject: Reply with quote

No, they didnīt, itīs a gray screen with the text I copied.
Back to top
BoBoē
Guest





PostPosted: Thu Aug 21, 2008 9:45 pm    Post subject: Reply with quote

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

PostPosted: Fri Aug 22, 2008 12:41 pm    Post subject: Reply with quote

Wow... The Message Boxes didn't even show up? Or do you mean they were just blank?
Back to top
View user's profile Send private message MSN Messenger
Hasso



Joined: 23 Mar 2005
Posts: 158
Location: Germany

PostPosted: Mon Aug 25, 2008 9:09 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   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