how to copy *.ttf to fonts folder in windows 10
Announcement
Collapse
No announcement yet.
copy file
Collapse
X
-
Try this , i found it in the manual, i didn't try it but i think you can start from here.
I will try it for u after i finish some tasks and will give u the results to do it.
Code:fonts_dir = Shell.GetFolder(SHF_FONTS); -- Gets the path to the user's Font directory. System.RegisterFont(fonts_dir .. "\\myfont.ttf", "Crazy Font", true);
Comment
-
After i posted my hint i realized that its not that easy, i found a post about it months ago were someone gave the way to install fonts through AMS , and even he put a way to search in system fonts and install the missing fonts only. Sadly i lost the post and didn't find it.
ill be patient and follow.
Comment
-
-
after i searched here i found some examples i hope they make a good start .
This one by Wonderboy :
Code:FontsFolder = Shell.GetFolder(SHF_FONTS); does_exist = File.DoesExist(FontsFolder.."\\yufen__0.ttf"); if does_exist then return true; else do File.Copy("AutoPlay\\Docs\\My_Fonts\\yufen__0.ttf", FontsFolder.."\\yufen__0.ttf", true, true, false, true, nil); System.RegisterFont(Shell.GetFolder(SHF_FONTS).."\\yufen__0.ttf", "Yufenom", true); end end
Code:[COLOR=#0000FF]local[/COLOR] os [COLOR=#FF0000]=[/COLOR] System[COLOR=#FF0000].[/COLOR]GetOSVersionInfo(); [COLOR=#0000FF]local[/COLOR] user [COLOR=#FF0000]=[/COLOR] System[COLOR=#FF0000].[/COLOR]GetUserInfo(); [COLOR=#0000FF]if[/COLOR] (user[COLOR=#FF0000].[/COLOR]IsAdmin) [COLOR=#0000FF]then[/COLOR] [COLOR=#008000]-- Windows Vista and newer needs admin privileges to install fonts[/COLOR] [COLOR=#0000FF]if[/COLOR] ((String[COLOR=#FF0000].[/COLOR]ToNumber(os[COLOR=#FF0000].[/COLOR]MajorVersion) [COLOR=#FF0000]>=[/COLOR] [COLOR=#000000]6[/COLOR] [COLOR=#0000FF]and[/COLOR] [COLOR=#0000FF]not[/COLOR] user[COLOR=#FF0000].[/COLOR]IsVistaAdminLimitedToken) [COLOR=#0000FF]or[/COLOR] String[COLOR=#FF0000].[/COLOR]ToNumber(os[COLOR=#FF0000].[/COLOR]MajorVersion) [COLOR=#FF0000]<=[/COLOR] [COLOR=#000000]5[/COLOR]) [COLOR=#0000FF]then[/COLOR] [COLOR=#0000FF]local[/COLOR] FontsFolder [COLOR=#FF0000]=[/COLOR] Shell[COLOR=#FF0000].[/COLOR]GetFolder(SHF_FONTS); File[COLOR=#FF0000].[/COLOR]Copy([COLOR=#800080]"AutoPlay[COLOR=#800080]\\[/COLOR]Docs[COLOR=#800080]\\[/COLOR]Brian Handwriting.ttf"[/COLOR][COLOR=#FF0000],[/COLOR] FontsFolder[COLOR=#FF0000],[/COLOR] [COLOR=#0000FF]false[/COLOR][COLOR=#FF0000],[/COLOR] [COLOR=#0000FF]false[/COLOR][COLOR=#FF0000],[/COLOR] [COLOR=#0000FF]false[/COLOR][COLOR=#FF0000],[/COLOR] [COLOR=#0000FF]true[/COLOR]); [COLOR=#0000FF]local[/COLOR] [COLOR=#0000FF]error[/COLOR] [COLOR=#FF0000]=[/COLOR] Application[COLOR=#FF0000].[/COLOR]GetLastError(); [COLOR=#0000FF]if[/COLOR] ([COLOR=#0000FF]error[/COLOR] [COLOR=#FF0000]~=[/COLOR] [COLOR=#000000]0[/COLOR]) [COLOR=#0000FF]then[/COLOR] Dialog[COLOR=#FF0000].[/COLOR]Message([COLOR=#800080]"Error"[/COLOR][COLOR=#FF0000],[/COLOR] _tblErrorMessages[COLOR=#FF0000][[/COLOR][COLOR=#0000FF]error[/COLOR][COLOR=#FF0000]],[/COLOR] MB_OK[COLOR=#FF0000],[/COLOR] MB_ICONEXCLAMATION); [COLOR=#0000FF]else[/COLOR] System[COLOR=#FF0000].[/COLOR]RegisterFont(FontsFolder [COLOR=#FF0000]..[/COLOR] [COLOR=#800080]"[COLOR=#800080]\\[/COLOR]Brian Handwriting.ttf"[/COLOR][COLOR=#FF0000],[/COLOR] [COLOR=#800080]"Brian Handwriting"[/COLOR][COLOR=#FF0000],[/COLOR] [COLOR=#0000FF]true[/COLOR]); [COLOR=#0000FF]error[/COLOR] [COLOR=#FF0000]=[/COLOR] Application[COLOR=#FF0000].[/COLOR]GetLastError(); [COLOR=#0000FF]if[/COLOR] ([COLOR=#0000FF]error[/COLOR] [COLOR=#FF0000]~=[/COLOR] [COLOR=#000000]0[/COLOR]) [COLOR=#0000FF]then[/COLOR] Dialog[COLOR=#FF0000].[/COLOR]Message([COLOR=#800080]"Error"[/COLOR][COLOR=#FF0000],[/COLOR] _tblErrorMessages[COLOR=#FF0000][[/COLOR][COLOR=#0000FF]error[/COLOR][COLOR=#FF0000]],[/COLOR] MB_OK[COLOR=#FF0000],[/COLOR] MB_ICONEXCLAMATION); [COLOR=#0000FF]else[/COLOR] Dialog[COLOR=#FF0000].[/COLOR]Message([COLOR=#800080]"Info"[/COLOR][COLOR=#FF0000],[/COLOR] [COLOR=#800080]"Font installed successfully!"[/COLOR][COLOR=#FF0000],[/COLOR] MB_OK[COLOR=#FF0000],[/COLOR] MB_ICONINFORMATION); [COLOR=#0000FF]end[/COLOR] [COLOR=#0000FF]end[/COLOR] [COLOR=#0000FF]else[/COLOR] Dialog[COLOR=#FF0000].[/COLOR]Message([COLOR=#800080]"Error"[/COLOR][COLOR=#FF0000],[/COLOR] [COLOR=#800080]"This program must be run with elevation![COLOR=#800080]\r[/COLOR][COLOR=#800080]\n[/COLOR]Run as administrator, or modify the project settings."[/COLOR][COLOR=#FF0000],[/COLOR] MB_OK[COLOR=#FF0000],[/COLOR] MB_ICONSTOP); [COLOR=#0000FF]end[/COLOR] [COLOR=#0000FF]else[/COLOR] Dialog[COLOR=#FF0000].[/COLOR]Message([COLOR=#800080]"Error"[/COLOR][COLOR=#FF0000],[/COLOR] [COLOR=#800080]"Only administrators can install fonts!"[/COLOR][COLOR=#FF0000],[/COLOR] MB_OK[COLOR=#FF0000],[/COLOR] MB_ICONSTOP); [COLOR=#0000FF]end[/COLOR]
I didn't try any of them , but all other posts that i found here are around these two Codes.
I will try them as soon as i can , or if someone can finish this with the right Code.
Comment
Comment