MAKINCI Posted March 29, 2013 Share Posted March 29, 2013 Selamün Aleyküm; Arkadaşlar fontları yani yazı tiplerini katılımsız yapmak istiyorum ama olmuyor... Denediğim uygulamalar; Autoit FileInstall FileCopy Winrar, 7zip SFX Bu proğramlarla denememe rağmen ilgili fontları C:\Windows\Fonts dizinine birtürlü kopyalatamadım, Fikri olan varmıdır arkadaşlar... Quote Link to comment Share on other sites More sharing options...
reyiz Posted March 29, 2013 Share Posted March 29, 2013 Kullanımı: InstallFont("\\server.local\Software\_Install\_Default\1\CORPORATE FONT\*.*")Func InstallFont($sSourceFile, $sFontDescript="", $sFontsPath="")Local Const $HWND_BROADCAST = 0xFFFFLocal Const $WM_FONTCHANGE = 0x1DIf $sFontsPath = "" Then $sFontsPath = @WindowsDir & "\fonts"Local $sFontName = StringRegExpReplace($sSourceFile, "^.*\\", "")If Not FileCopy($sSourceFile, $sFontsPath & "\" & $sFontName, 1) Then Return SetError(1, 0, 0)Local $hSearch = FileFindFirstFile($sSourceFile)Local $iFontIsWildcard = StringRegExp($sFontName, "\*|\?")Local $aRet, $hGdi32_DllOpen = DllOpen("gdi32.dll")If $hSearch = -1 Then Return SetError(2, 0, 0)If $hGdi32_DllOpen = -1 Then Return SetError(3, 0, 0)While 1$sFontName = FileFindNextFile($hSearch)If @error Then ExitLoopIf $iFontIsWildcard Then $sFontDescript = StringRegExpReplace($sFontName, "\.[^\.]*$", "")$aRet = DllCall($hGdi32_DllOpen, "Int", "AddFontResource", "str", $sFontsPath & "\" & $sFontName)If IsArray($aRet) And $aRet[0] > 0 ThenRegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts", _$sFontDescript, "REG_SZ", $sFontsPath & "\" & $sFontName)EndIfWEndDllClose($hGdi32_DllOpen)DllCall("user32.dll", "Int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_FONTCHANGE, "int", 0, "int", 0)Return 1EndFunc #RequireAdmin eklemeyi unutmayın. Kodları kendinize göre düzenleyebileceğinizi düşündüğümden açıklama vermedim. Gerekirse verebilirim. Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted March 29, 2013 Share Posted March 29, 2013 (edited) #RequireAdmin eklemeyi unutmayın çeşitli örnekler var :) hangisi uyarsa başka işletim sisteminde deneme şansım olmadığı için en iyisi size uyar bilemiyorum kendine göre uyarla :) #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) Global $guititle = 'Install Fonts Manager' Local $hForm = GUICreate($guititle, 363, 112, -1, 200) GUISetIcon(@ProgramFilesDir&'\AutoIt3\Aut2Exe\Icons\AutoIt_Old4.ico', "", $hForm) WinSetOnTop($guititle, "", 1) Local $Input = GUICtrlCreateInput("", 16, 32, 249, 21) GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlCreateLabel("Fonts Dir path", 112, 15, 70, 17) Local $Btn_sel = GUICtrlCreateButton("Browse", 272, 32, 75, 25, $WS_GROUP) Local $Btn_ins = GUICtrlCreateButton("Insatll", 128, 72, 75, 25, $WS_GROUP) GUICtrlSetCursor (-1, 0) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW) TraySetIcon(@ProgramFilesDir&'\AutoIt3\Aut2Exe\Icons\AutoIt_Old4.ico', "") While 1 Local $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete() Exit Case $Btn_sel Local $dialog_text = 'Choose a folder new fonts' Local $source_dir = FileSelectFolder($dialog_text, "", "", "", $hForm) If @error = 1 Then ContinueLoop GUICtrlSetData($Input, $source_dir) GUICtrlSetState($Btn_ins, $GUI_ENABLE) Case $Btn_ins Local $dest_dir = @WindowsDir&'\Fonts' Local $chk_err = DirCopy($source_dir, $dest_dir, 1) If $chk_err = 1 Then MsgBox(64, "", "Installation fonts complete.", 0, $hForm) _reset() Else MsgBox(48, "Error!", "Cannot install fonts.", 0, $hForm) _reset() EndIf EndSwitch WEnd Func _reset() GUICtrlSetData($Input, "") GUICtrlSetState($Btn_ins, $GUI_DISABLE) EndFunc #Include <WinAPIEx.au3> ConsoleWrite(_FontInstall('MyFont.ttf') & @CR) Func _FontInstall($sFile) Local $Font, $Name, $Path $Name = _WinAPI_GetFontResourceInfo($sFile, 1) If @error Then Return SetError(1, 0, 0) EndIf $Name &= ' (TrueType)' $Font = StringRegExpReplace($sFile, '^.*\\', '') If Not RegWrite('HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts', $Name, 'REG_SZ', $Font) Then Return SetError(2, 0, 0) EndIf $Path = _WinAPI_ShellGetSpecialFolderPath($CSIDL_FONTS) If Not FileCopy($sFile, $Path) Then RegDelete('HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts', $Name) Return SetError(3, 0, 0) EndIf If Not _WinAPI_AddFontResourceEx($Path & '\' & $Font, 0, 1) Then Return SetError(4, 0, 0) EndIf Return 1 EndFunc ;==>_FontInstall #Include <APIConstants.au3> #Include <StaticConstants.au3> #Include <WinAPIEx.au3> Opt('MustDeclareVars', 1) FileCopy("myfont.ttf", @WindowsDir & "Fonts") _WinAPI_AddFontResourceEx(@WindowsDir & 'Fontsmyfont.ttf', $FR_PRIVATE, 1) Const $FONTS = 0x14 $oShell = ObjCreate("Shell.Application") $oWinFonts = $oShell.Namespace($FONTS) ; The fonts must be in the same directory $sFirstFile = FileFindFirstFile("*.*") If $sFirstFile = -1 Then Exit EndIf While 1 Local $sFile = FileFindNextFile($sFirstFile) If @error Then ExitLoop Switch StringRight($sFile, 3) Case 'ttf', 'otf', 'pfm', 'fon' $sWinFontsPath = @WindowsDir & 'Fonts' & $sFile $sLocFontsPath = @ScriptDir & '' & $sFile If NOT FileExists($sWinFontsPath) Then $oWinFonts.CopyHere($sLocFontsPath) Else MsgBox(262144, $sFile, 'The file is already installed', 1) EndIf EndSwitch WEnd Edited March 29, 2013 by mesale0077 Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted March 29, 2013 Share Posted March 29, 2013 #Include <File.au3> $_Dir = FileSelectFolder ( "Choose the folder where are fonts to install.", @DesktopDir ) If Not FileExists ( $_Dir ) Then Exit $_Filelist = _FileListToArray ( $_Dir, "*.ttf", 1 ) If Not IsArray ( $_Filelist ) Or @Error Then Exit MsgBox ( 0, "", "No Files\Folders Found." ) For $_I = 1 To $_Filelist[0] $_Installed = _InstallFont ( $_Dir & "\" & $_Filelist[$_I] ) If Not $_Installed Then ConsoleWrite ( "Install Font of " & $_Filelist[$_I] & " : " & $_Installed & @LF ) Next Func _InstallFont ( $sSourceFile, $sFontDescript="", $sFontsPath="" ) Local Const $HWND_BROADCAST = 0xFFFF Local Const $WM_FONTCHANGE = 0x1D If $sFontsPath = "" Then $sFontsPath = @WindowsDir & "\fonts" Local $sFontName = StringRegExpReplace ( $sSourceFile, "^.*\\", "" ) If Not FileCopy ( $sSourceFile, $sFontsPath & "\" & $sFontName, 1 ) Then Return SetError ( 1, 0, 0 ) Local $hSearch = FileFindFirstFile ( $sSourceFile ) Local $iFontIsWildcard = StringRegExp ( $sFontName, "\*|\?" ) Local $aRet, $hGdi32_DllOpen = DllOpen ( "gdi32.dll" ) If $hSearch = -1 Then Return SetError ( 2, 0, 0 ) If $hGdi32_DllOpen = -1 Then Return SetError ( 3, 0, 0 ) While 1 $sFontName = FileFindNextFile ( $hSearch ) If @error Then ExitLoop If $iFontIsWildcard Then $sFontDescript = StringRegExpReplace ( $sFontName, "\.[^\.]*$", "" ) $aRet = DllCall ( $hGdi32_DllOpen, "Int", "AddFontResource", "str", $sFontsPath & "\" & $sFontName ) If IsArray ( $aRet ) And $aRet[0] > 0 Then RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts", $sFontDescript, "REG_SZ", $sFontsPath & "\" & $sFontName ) WEnd DllClose ( $hGdi32_DllOpen ) DllCall ( "user32.dll", "Int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_FONTCHANGE, "int", 0, "int", 0 ) Return 1 EndFunc ; _InstallFont ( ) Quote Link to comment Share on other sites More sharing options...
MAKINCI Posted March 29, 2013 Author Share Posted March 29, 2013 Bu kadar koddan sonra ben hala kopyalatamadım, bütün kodları denedim bendemi sorun çözemedim... :facepalm: Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted March 29, 2013 Share Posted March 29, 2013 #RequireAdmin ekledinmi en sondaki verdigim koda Quote Link to comment Share on other sites More sharing options...
MAKINCI Posted March 29, 2013 Author Share Posted March 29, 2013 Ekledim hocam hepsine en son kodda yer soruyor gösteriyorum yine kopyalamıyor, kopyalasa kodları değiştirip direk kopyalatan yapacaktım olmadı... Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted March 29, 2013 Share Posted March 29, 2013 (edited) pm attım Edited March 29, 2013 by mesale0077 Quote Link to comment Share on other sites More sharing options...
yasak_ask Posted March 29, 2013 Share Posted March 29, 2013 İşletim sistemi ile alakalı bir sorun olabilirmi ki acaba :o Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted March 29, 2013 Share Posted March 29, 2013 olabilir işletim sisteminden ve yetki meselesi olabilir Quote Link to comment Share on other sites More sharing options...
MAKINCI Posted March 29, 2013 Author Share Posted March 29, 2013 Bütün yetkiler verilmiş sistemde ama, hayırlısı... Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted March 29, 2013 Share Posted March 29, 2013 Smart Install Maker ile katılımsız yapmayı denediniz mi? Quote Link to comment Share on other sites More sharing options...
MAKINCI Posted March 29, 2013 Author Share Posted March 29, 2013 En son onla deneyeceğim hocam çare kalmadı, yardımlarınız için çok sağolun hocam... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.