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 

Lost with arry's
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Thu Jan 19, 2006 1:55 pm    Post subject: Lost with arry's Reply with quote

Help,

Code:
test =2
MsgBox, %InputBuffer2%


Works Fine

Code:
test =2
MsgBox, %InputBuffer%test%


Fails.....
Back to top
Greg



Joined: 22 Dec 2005
Posts: 246

PostPosted: Thu Jan 19, 2006 2:00 pm    Post subject: Reply with quote

Code:

test =2
MsgBox, %InputBuffer%%test%


Works.
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Thu Jan 19, 2006 2:03 pm    Post subject: Reply with quote

Quote:
To choose a nick, even if not registered.
Works too.
Back to top
Andre



Joined: 22 Jul 2005
Posts: 52

PostPosted: Thu Jan 19, 2006 2:04 pm    Post subject: Reply with quote

works... but displays the wrong value : 12

should return text.... (which displays when using MsgBox, %InputBuffer2%)
Back to top
View user's profile Send private message
Andre



Joined: 22 Jul 2005
Posts: 52

PostPosted: Thu Jan 19, 2006 2:05 pm    Post subject: Reply with quote

BoBo wrote:
Quote:
To choose a nick, even if not registered.
Works too.


forgot to login Smile
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Thu Jan 19, 2006 2:29 pm    Post subject: Reply with quote

Quote:
test =2
MsgBox, %InputBuffer2%
Yes & No. No error but no usefull result as the var InputBuffer2 hasn't been set in advance
Quote:
test =2
MsgBox, %InputBuffer%test%
Should/will fail as its not clear what's literal and/or var. You'd get an errormsg from AHK.
Quote:
test =2
MsgBox, %InputBuffer%%test%
Yes that works. Result: <Nothing as InputBuffer has no value>2
Quote:
test =2
MsgBox, % InputBuffer test
Yes that works. Result: <Nothing as InputBuffer has no value>2
Quote:
test =2
InputBuffer1 = Helau
InputBuffer2 = Narrhala
text := InputBuffer%test%
MsgBox, % test "`n" text
I don't know ... Smile
Back to top
Greg



Joined: 22 Dec 2005
Posts: 246

PostPosted: Thu Jan 19, 2006 2:34 pm    Post subject: Reply with quote

Andre wrote:
works... but displays the wrong value : 12

should return text.... (which displays when using MsgBox, %InputBuffer2%)


Show more of your code. And what exactly do you want the output to be?
Back to top
View user's profile Send private message
Andre



Joined: 22 Jul 2005
Posts: 52

PostPosted: Thu Jan 19, 2006 2:38 pm    Post subject: Reply with quote

Code:
ReadMasFile("c:\tmp\c\PST448046010029.dat")
test :=2
MsgBox, %InputBuffer%%test%

ExitApp

ReadMasFile(File)
{
   Global InputBuffer, InputCounter
   SsccCheck = 003
   IfNotExist, %File%
   {
      MsgBox, 16,, Error reading MasFile : %File%, 5
      ExitApp, 99
   }
   Loop, Read, %File%
   {
      Line := A_LoopReadLine
      If InStr(A_LoopReadLine, SsccCheck,0, 3) And StrLen(A_LoopReadLine) = 19
         {
             StringTrimLeft, Tmp, Line, 3
             Line = Line + SSCC(Tmp)
        }
      Else If InStr(A_LoopReadLine, SsccCheck,0, 3) And StrLen(A_LoopReadLine) = 21
         {
            StringMid, Tmp, Line, 0, 10
            StringMid, Tmp1, Line, 12, StrLen(Line)
            Line = Line + SSCC(Tmp) + Tmp1
         }
      If TransCounter <> 0
         StringReplace, Line, Line, TransBuffer0%TransCounter%, TransBuffer1%TransCounter%
      
      InputBuffer%InputCounter% := Line
      InputCounter += 1
   }
}


SSCC(Code)
{
   Total := 0
   Loop, 17
   {
      If Mod(A_Index, 2) = 0 ;Even
      {
         StringMid, Totala, Code , A_Index, 1
         Total := (Totala * 1 )+ Total   
      }   
      Else ;Odd
      {
         StringMid, Totala, Code , A_Index, 1
         Total := (Totala * 3) + Total   
      }
   }
   
  Plus10 := ((Total + 9) // 10) * 10
  Return Plus10 - Total
}


Contents of .dat file :
ALBAPLEX

Sortengruppe
GC1
Kundenbarcode1

Kundenbarcode2

Kundenbarcode3

Kundenbarcode4

Kundenbarcode5

Standortbarcode1
0000448046010029
Standortbarcode2
etc.......


Andre
Back to top
View user's profile Send private message
Greg



Joined: 22 Dec 2005
Posts: 246

PostPosted: Thu Jan 19, 2006 2:53 pm    Post subject: Reply with quote

Code:
InputBuffer%InputCounter% := Line
      InputCounter += 1


Until you increment InputCounter, it isn't a number. It has been declared in your script, but never equals anything.You need to at least set it equal to zero when you declare it, otherwise the array isn't refrencing anything. Also, you should look at the help file for using global variables. I think there may actually be a scope issue from declaring the variables inside a function instead of in the main function.
Back to top
View user's profile Send private message
Andre



Joined: 22 Jul 2005
Posts: 52

PostPosted: Thu Jan 19, 2006 2:57 pm    Post subject: Reply with quote

Code:
MsgBox, %InputBuffer3%

Displays the text : Sortengruppe
so that's not the problem the array is filled correct !! Exclamation
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Thu Jan 19, 2006 2:58 pm    Post subject: Reply with quote

Wer Kundenbarcode liest versteht mich auch auf Deutsch. Du pumpst innerhalb der Funktion ein Array voll (InputBuffer). Allein mir fehlt der Glaube das du diesen Array auch ausserhalb der Funktion unreferenziert verarbeiten kannst (Local/Global blabla) ...
Back to top
BoBo
Guest





PostPosted: Thu Jan 19, 2006 3:02 pm    Post subject: Reply with quote

Quote:
test = 2
Msg := InputBuffer%test%
MsgBox, % Msg
Back to top
Andre



Joined: 22 Jul 2005
Posts: 52

PostPosted: Thu Jan 19, 2006 3:04 pm    Post subject: Reply with quote

@Bobo

Ich verstehe (lesen/reden) sicher Deutsch aber schreiben....

Das Variable Inputbuffer ist in die Function als Global definiert.

Meinem beispiel : MsgBox, %InputBuffer3% zeicht den inhalt von die Inputbuffer.......

Andre
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Thu Jan 19, 2006 3:08 pm    Post subject: Reply with quote

Quote:
Line = Line + SSCC(Tmp)
Line = Line + SSCC(Tmp) + Tmp1
That worked fine?

Quote:
Line := (Line + SSCC(Tmp))
Line := (Line + SSCC(Tmp) + Tmp1)
I would have expected something like this. Anyway.

Irgendwie hab ich den Eindruck dein Script ist komplexer als notwendig ...
Back to top
Andre



Joined: 22 Jul 2005
Posts: 52

PostPosted: Thu Jan 19, 2006 3:12 pm    Post subject: Reply with quote

My script is an conversion of an running script in AutoIt and Delphi
so i have not tested al the parts yet Smile
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
Goto page 1, 2  Next
Page 1 of 2

 
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