AutoHotkey Community

It is currently May 27th, 2012, 6:40 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Lost with arry's
PostPosted: January 19th, 2006, 2:55 pm 
Help,

Code:
test =2
MsgBox, %InputBuffer2%


Works Fine

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


Fails.....


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 19th, 2006, 3:00 pm 
Offline

Joined: December 22nd, 2005, 7:43 pm
Posts: 245
Code:
test =2
MsgBox, %InputBuffer%%test%


Works.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 19th, 2006, 3:03 pm 
Quote:
To choose a nick, even if not registered.
Works too.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 19th, 2006, 3:04 pm 
Offline

Joined: July 22nd, 2005, 7:36 am
Posts: 52
works... but displays the wrong value : 12

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 19th, 2006, 3:05 pm 
Offline

Joined: July 22nd, 2005, 7:36 am
Posts: 52
BoBo wrote:
Quote:
To choose a nick, even if not registered.
Works too.


forgot to login :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 19th, 2006, 3:29 pm 
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 ... :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 19th, 2006, 3:34 pm 
Offline

Joined: December 22nd, 2005, 7:43 pm
Posts: 245
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 19th, 2006, 3:38 pm 
Offline

Joined: July 22nd, 2005, 7:36 am
Posts: 52
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 19th, 2006, 3:53 pm 
Offline

Joined: December 22nd, 2005, 7:43 pm
Posts: 245
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 19th, 2006, 3:57 pm 
Offline

Joined: July 22nd, 2005, 7:36 am
Posts: 52
Code:
MsgBox, %InputBuffer3%

Displays the text : Sortengruppe
so that's not the problem the array is filled correct !! :!:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 19th, 2006, 3:58 pm 
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) ...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 19th, 2006, 4:02 pm 
Quote:
test = 2
Msg := InputBuffer%test%
MsgBox, % Msg


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 19th, 2006, 4:04 pm 
Offline

Joined: July 22nd, 2005, 7:36 am
Posts: 52
@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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 19th, 2006, 4:08 pm 
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 ...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 19th, 2006, 4:12 pm 
Offline

Joined: July 22nd, 2005, 7:36 am
Posts: 52
My script is an conversion of an running script in AutoIt and Delphi
so i have not tested al the parts yet :)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: batto, Bing [Bot], Exabot [Bot], JSLover and 59 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