Old 25th June 2006, 18:14   #1
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
Invalid filehandle 123

whenever i'm running my script, i'm getting the error-message "Invalid file handle 123".

i've modified the line 65 of FontReg.nsh to

CopyFiles '${FontFile}' '$FONT_DIR\${FontFileName}'.

i checked the input-file for the macro and don't see why this shall not work. any clues?
Yathosho is offline   Reply With Quote
Old 26th June 2006, 03:34   #2
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
Is ${FontFileName} an actual file name?

The reason I ask is that I thought CopyFiles needed a file name and a folder name as parameters. The way I'm reading your example, it looks as if you supplied 2 file names.
Comperio is offline   Reply With Quote
Old 26th June 2006, 08:57   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
The destination parameter for CopyFiles requires the full path to the file name to be copied as.
Having a folder name works, but if that folder doesn't exist it will create the file of that folder name instead.

-Stu
Afrow UK is offline   Reply With Quote
Old 27th June 2006, 17:31   #4
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
thanks for the response, seems like it was a tiny " that caused the mistake
Yathosho is offline   Reply With Quote
Old 28th June 2006, 18:30   #5
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
unfortunately, the errors still occurs. the reason why i replaced that line from FontReg.nsh is, that the font i want to install is stored in a variable.

in order to find the mistake, i replaced the variable with "path/to/font.ttf" and the error-message changes to "MappedFile error: 1006".

i've added a messagebox displaying..

${FontFile}: "C:\MyDir\myfont.ttf"
$FONT_DIR: C:\MyDir\myfont.ttf
${FontFileName}: myfont.ttf"

..please mind the quotes!

i don't understand why they get messed up like this and why i still get this error replacing the variable with a path to my font. any clues?
Yathosho is offline   Reply With Quote
Old 29th June 2006, 16:27   #6
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
it's all working now, problem was in the a later fontname macro

Last edited by Yathosho; 29th June 2006 at 17:05.
Yathosho is offline   Reply With Quote
Old 29th July 2006, 22:47   #7
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
once again i'm getting MappedFile error: 1006 when using the following script
code:
GetTempFileName $TempFile
ReadEnvStr $R1 COMSPEC
nsExec::Exec '"$R1" /C dir "$Input\*.ttf" /a-d /b /s /on>$TempFile"'

StrCpy $FONT_DIR $FONTS
StrCpy "$Counter" "1"

Loop:
${LineRead} "$TempFile" "$Counter" "$Line" ;${LineRead} "[File]" "[LineNumber]" $var
IfErrors PostEnd

Push $Line
Call TrimNewlines
Pop $Line

Push $Line
Call GetName
Pop $File

IfFileExists "$Line" 0 +3
MessageBox MB_OK "Yay!"
Goto +3
MessageBox MB_OK "Nay!"
Quit

!insertmacro InstallTTF "$Line"
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000

IntOp $Counter $Counter + 1
Goto Loop



what i don't understand about it, IfFileExists is always reporting "Yay!", but only one font from the $TempFile is being installed. once it's reading line 2 i get that error. what am i doing wrong?!
Yathosho is offline   Reply With Quote
Old 29th July 2006, 23:24   #8
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Why are you using the dir command to list the font files? Why not use FindFirst, FindNext etc. It would be much easier.

-Stu
Afrow UK is offline   Reply With Quote
Old 29th July 2006, 23:28   #9
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
good point. i actually used this from another script of mine where i needed a sorted list (a-z)
Yathosho is offline   Reply With Quote
Old 29th July 2006, 23:39   #10
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
It may be safer to use an array (NSISArray) to sort it, but dir exists on all systems to my knowledge. It's still a bit unprofessional though I'd say, as you're relying on another executable for the installer to function correctly.

Here's another thing:
You're using GetName and Popping $File from it, yet you're using $Line afterwards. Surely you should be using $File?

Congrats if this is fixed. I'm drunk

-Stu
Afrow UK is offline   Reply With Quote
Old 30th July 2006, 00:58   #11
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
it's working, had to change the FontName function
Yathosho is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump