#127568 - 2004-10-07 05:25 PM
this type of array not supported in expressions
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
ok.. I must be brain damaged, but I just cannot find this error
Quote:
C:\Documents and Settings\wheelerc>kix32 "C:\Documents and Settings\wheelerc\Des ktop\Switches.kix"
ERROR : Error in expression: this type of array not supported in expressions.! Script: C:\Documents and Settings\wheelerc\Desktop\Switches.kix Line : 161
C:\Documents and Settings\wheelerc>
the code segment is: Code:
$=WriteProfileString(@scriptdir+'\package.sed','Strings','FriendlyName','Silent '+$file) $=WriteProfileString(@scriptdir+'\package.sed','Strings','AppLaunched',$file+' '+$switch) $=WriteProfileString(@scriptdir+'\package.sed','Strings','FILE0',$file) $=WriteProfileString(@scriptdir+'\package.sed','SourceFiles','SourceFiles0',$path) Shell 'IExpress /n package.sed' EndFunction ;****************************************************************** Function WriteFile($file,$array)
The error occurs on the shell statement, after it completes
|
|
Top
|
|
|
|
#127569 - 2004-10-07 05:28 PM
Re: this type of array not supported in expressions
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
found it...
the command in the shell statement "Iexpress" is the same as the name of the function.
Rename the function, error goes away...
|
|
Top
|
|
|
|
#127573 - 2004-10-07 09:13 PM
Re: this type of array not supported in expressions
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
does it still happen with NoStringsInVars turned on?
|
|
Top
|
|
|
|
#127575 - 2004-10-07 09:54 PM
Re: this type of array not supported in expressions
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I guess I have things a bit inside out today. 
As Les astutely points out - I rarely know what I am talking. 
SETOPTION ("NoVarsInStrings","ON")
|
|
Top
|
|
|
|
#127578 - 2004-10-08 04:24 AM
Re: this type of array not supported in expressions
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
The problem seems to be that the name of a function in the SHELL command string was being interpretted as its value and not as test.
I can not reproduce the described problem. I wrote this simple script that should reflect the problem as I read it. The script was tested with 4.02 and 4.22.
Code:
;setoption("NoVarsInStrings","ON") function CMD() ? "in function 'CMD'" Dim $A $A = "1","a" $CMD = $A endfunction
shell 'CMD /c notepad.exe'
|
|
Top
|
|
|
|
#127580 - 2004-10-08 01:54 PM
Re: this type of array not supported in expressions
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Even if I move the SHELL statement inside the function, I can not reproduce the problem.
|
|
Top
|
|
|
|
#127582 - 2004-10-08 04:01 PM
Re: this type of array not supported in expressio
|
Bryce
KiX Supporter
   
Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
|
me too, even used a function named CMD :P could not reproduce.
even tried returning an array from the CMD function.
Code:
$ = cmd(1) Shell 'cmd /c type test.kix'
Function cmd($things) $cmd = Split($things) EndFunction
Bryce
|
|
Top
|
|
|
|
#127584 - 2004-10-08 09:56 PM
Re: this type of array not supported in expressio
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
Code:
Function Wrap() Del @scriptdir+'\Package.sed' Del '%userprofile%\desktop\silent_'+$file $iexpress = '[Version]','Class=IEXPRESS','SEDVersion=3','[Options]','PackagePurpose=InstallApp', 'ShowInstallProgramWindow=1','HideExtractAnimation=1','UseLongFileName=1','InsideCompressed=0', 'CAB_FixedSize=0','CAB_ResvCodeSigning=0','RebootMode=N','InstallPrompt=%%InstallPrompt%%', 'DisplayLicense=%%DisplayLicense%%','FinishMessage=%%FinishMessage%%','TargetName=%%TargetName%%', 'FriendlyName=%%FriendlyName%%','AppLaunched=%%AppLaunched%%','PostInstallCmd=%%PostInstallCmd%%', 'AdminQuietInstCmd=%%AdminQuietInstCmd%%','UserQuietInstCmd=%%UserQuietInstCmd%%', 'SourceFiles=SourceFiles','[Strings]','InstallPrompt=','DisplayLicense=','FinishMessage=','TargetName=', 'FriendlyName=','AppLaunched=','PostInstallCmd=<None>','AdminQuietInstCmd=','UserQuietInstCmd=', 'FILE0=','[SourceFiles]','SourceFiles0=','[SourceFiles0]','%%FILE0%%=' $rc = writefile(@scriptdir+'\package.sed',$iexpress) $=WriteProfileString(@scriptdir+'\package.sed','Strings','TargetName','%userprofile%\desktop\silent_'+$file) $=WriteProfileString(@scriptdir+'\package.sed','Strings','FriendlyName','Silent '+$file) $=WriteProfileString(@scriptdir+'\package.sed','Strings','AppLaunched',$file+' '+$switch) $=WriteProfileString(@scriptdir+'\package.sed','Strings','FILE0','"'+$file+'"') $=WriteProfileString(@scriptdir+'\package.sed','SourceFiles','SourceFiles0',$path) Shell 'IExpress /n package.sed' EndFunction
the funct was named iexpress, before I renamed it to wrap
|
|
Top
|
|
|
|
#127585 - 2004-10-08 09:58 PM
Re: this type of array not supported in expressio
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
Code:
Break On $System = CreateObject("Kixtart.System")
;KD START
;************* Form ************** $SubForm1 = $System.Form() $SubForm1.BackColor = 212,208,200 $SubForm1.Height = 391 $SubForm1.Left = 13 $SubForm1.MaximizeBox = "False" $SubForm1.MinimizeBox = "False" $SubForm1.ShowInTaskBar = "False" $SubForm1.Text = "Select Command Line Switches" $SubForm1.Top = 8 $SubForm1.Width = 342 ;**************************************
$SubForm1.OpenFileDialog1 = $System.OpenFileDialog() $SubForm1.OpenFileDialog1.InitialDirectory = '%userprofile%\desktop' $SubForm1.OpenFileDialog1.Filter = "EXE files (*.exe)|*.exe|MSI Installers (*.msi)|*.msi" $SubForm1.OpenFileDialog1.FilterIndex = 2 $SubForm1.OpenFileDialog1.RestoreDirectory = True
;************* FindApp ************** $FindApp = $SubForm1.Controls.Button("Find", 15, 15, 35, 20) $FindApp.OnClick = "Find" ;**************************************
;************* TextBox2 ************** $SFXText2 = $SubForm1.Controls.TextBox("", 55, 15, 265, 20) $SFXText2.Enabled = "False" $SFXText2.FontBold = "True" $SFXText2.TextAlign = 2 ;**************************************
;************* GroupBox1 ************** $GroupBox1 = $SubForm1.Controls.GroupBox("Application Install Switches", 15, 45, 305, 274) $GroupBox1.BackColor = 212,208,200 ;**************************************
;************* RadioButton8 ************** $SFXOption8 = $GroupBox1.Controls.RadioButton("None", 30, 30, 64, 19) $SFXOption8.BackColor = 212,208,200 $SFXOption8.Checked = "False" ;**************************************
;************* RadioButton1 ************** $SFXOption1 = $GroupBox1.Controls.RadioButton("/U /O /N /Z", 30, 60, 227, 19) $SFXOption1.BackColor = 212,208,200 $SFXOption1.Checked = "False" $SFXOption1.TabStop = "False" ;**************************************
;************* RadioButton2 ************** $SFXOption2 = $GroupBox1.Controls.RadioButton("/Q:A /R:N", 30, 90, 229, 19) $SFXOption2.BackColor = 212,208,200 $SFXOption2.Checked = "False" $SFXOption2.TabStop = "False" ;**************************************
;************* RadioButton3 ************** $SFXOption3 = $GroupBox1.Controls.RadioButton("-S", 30, 120, 230, 18) $SFXOption3.BackColor = 212,208,200 $SFXOption3.Checked = "False" $SFXOption3.TabStop = "False" ;**************************************
;************* RadioButton4 ************** $SFXOption4 = $GroupBox1.Controls.RadioButton("/SP- /VERYSILENT /NOREBOOT", 30, 150, 230, 17) $SFXOption4.BackColor = 212,208,200 $SFXOption4.Checked = "False" $SFXOption4.TabStop = "False" ;**************************************
;************* RadioButton5 ************** $SFXOption5 = $GroupBox1.Controls.RadioButton("/S", 30, 180, 230, 18) $SFXOption5.BackColor = 212,208,200 $SFXOption5.Checked = "False" $SFXOption5.TabStop = "False" ;**************************************
;************* RadioButton6 ************** $SFXOption6 = $GroupBox1.Controls.RadioButton("/qn Reboot=Suppress", 30, 210, 231, 18) $SFXOption6.BackColor = 212,208,200 $SFXOption6.Checked = "False" $SFXOption6.TabStop = "False" ;**************************************
;************* RadioButton7 ************** $SFXOption7 = $GroupBox1.Controls.RadioButton("Custom:", 30, 240, 64, 18) $SFXOption7.BackColor = 212,208,200 $SFXOption7.Checked = "False" $SFXOption7.TabStop = "False" ;**************************************
;************* TextBox1 ************** $SFXText1 = $GroupBox1.Controls.TextBox("", 100, 240, 183, 20) ;**************************************
;************* Button1 ************** $SFXOK = $SubForm1.Controls.Button("OK", 30, 330, 75, 23) $SFXOK.Onclick = "Wrap()" ;**************************************
;************* Button2 ************** $SFXCancel = $SubForm1.Controls.Button("Cancel", 225, 330, 75, 23) ;**************************************
$Timer1 = $SubForm1.Timer() $timer1.interval = 250 $timer1.ontick ="tick()" $timer1.start()
;KD END
$SubForm1.Show While $SubForm1.Visible $= Execute($System.Application.DoEvents) Loop
Exit 1
Function Tick() $SFXText1.enabled = iif($SFXOption7.Checked,'true','false') if $file Select Case $SFXOption8.checked $switch = '' Case $SFXOption1.checked $switch = $SFXOption1.text Case $SFXOption2.checked $switch = $SFXOption2.text Case $SFXOption3.checked $switch = $SFXOption3.text Case $SFXOption4.checked $switch = $SFXOption4.text Case $SFXOption5.checked $switch = $SFXOption5.text Case $SFXOption6.checked $switch = $SFXOption6.text Case 1 $switch = $SFXtext1.text EndSelect $SFXText2.text = $File+' '+$switch endif EndFunction ;****************************************************************** Function Find() If $SubForm1.OpenFileDialog1.ShowDialog() = $System.DialogResult.OK $FileName = $SubForm1.OpenFileDialog1.Filename
$FilePos = instrrev($FileName ,"\") $File = right($FileName,len($FileName)-$FilePos) $Path = left($FileName,$FilePos) $SFXText2.text = $File+' '+$switch endif Endfunction ;****************************************************************** Function Wrap() Del @scriptdir+'\Package.sed' Del '%userprofile%\desktop\silent_'+$file $iexpress = '[Version]','Class=IEXPRESS','SEDVersion=3','[Options]','PackagePurpose=InstallApp', 'ShowInstallProgramWindow=1','HideExtractAnimation=1','UseLongFileName=1','InsideCompressed=0', 'CAB_FixedSize=0','CAB_ResvCodeSigning=0','RebootMode=N','InstallPrompt=%%InstallPrompt%%', 'DisplayLicense=%%DisplayLicense%%','FinishMessage=%%FinishMessage%%','TargetName=%%TargetName%%', 'FriendlyName=%%FriendlyName%%','AppLaunched=%%AppLaunched%%','PostInstallCmd=%%PostInstallCmd%%', 'AdminQuietInstCmd=%%AdminQuietInstCmd%%','UserQuietInstCmd=%%UserQuietInstCmd%%', 'SourceFiles=SourceFiles','[Strings]','InstallPrompt=','DisplayLicense=','FinishMessage=','TargetName=', 'FriendlyName=','AppLaunched=','PostInstallCmd=<None>','AdminQuietInstCmd=','UserQuietInstCmd=', 'FILE0=','[SourceFiles]','SourceFiles0=','[SourceFiles0]','%%FILE0%%=' $rc = writefile(@scriptdir+'\package.sed',$iexpress) $=WriteProfileString(@scriptdir+'\package.sed','Strings','TargetName','%userprofile%\desktop\silent_'+$file) $=WriteProfileString(@scriptdir+'\package.sed','Strings','FriendlyName','Silent '+$file) $=WriteProfileString(@scriptdir+'\package.sed','Strings','AppLaunched',$file+' '+$switch) $=WriteProfileString(@scriptdir+'\package.sed','Strings','FILE0','"'+$file+'"') $=WriteProfileString(@scriptdir+'\package.sed','SourceFiles','SourceFiles0',$path) Shell 'IExpress.exe /n package.sed' EndFunction ;****************************************************************** Function WriteFile($file,$array) Dim $f, $_, $line If Not VarType($Array) & 8192 Exit(1) EndIf $f=FreeFileHandle $_=Open($f,$file,5) If @error Exit @error EndIf For Each $line in $array $_=WriteLine($f,$line+@crlf) If @error Exit @error EndIf Next $_=Close($f) EndFunction
there are 3 external file dependancies (iexpress.exe, makecab.exe, wextract.exe) and kixforms of course.
|
|
Top
|
|
|
|
#127586 - 2004-10-08 10:04 PM
Re: this type of array not supported in expressio
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
now I see the problem...
I had a funct named Iexpress, then I populated that named function as a var ($iexpress, like you do for return values), and then I executed an external file named the same as the funct, and it looked to be trying to recurse to itself.
Basically it was a giant mess. I guess that is to be expected when trying to get back into an old project...
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 778 anonymous users online.
|
|
|