Font Listing

Vbscript way to list fonts?

I have a need to be able to populate a drop down with a listing of installed fonts.

Does anyone know if there is a way to accomplish this in DX (VBScript)?

Thanks in advance!
4,580 views 14 replies
Reply #2 Top
Thanks MsPooma,

But, I'm looking for VBscript "CODE" that i can use inside of a gadget I'm creating in DX. It would need to use VBScript to generate a listing i can then put into a drop down.
Reply #3 Top
Dear God i feel like a mooooron.

If i would have looked in the preferences in the reference!

Set objBOX = DesktopX.CreateForm
With objBOX
.caption = " DesktopX Form Name... "
.addpreference("Font")
.preference("Font").Type = "Font"
.preference("Font").caption = "Font Name"
End With
Set objBOX = nothing

You gots to love things.. GOOGLE IS THE BEST!!
Reply #4 Top
GOOGLE IS THE BEST!!


...don't say that so loud, around here.

They'll come & take you away...   
Reply #5 Top
Actually I found it by typing in "DESKTOPX FONT LISTING"
and there it was.. should have thought of that first!
Reply #6 Top
Hi David,

I found your message right now. No any problems! Please look below:

'This code can do all that you want.

Sub FontChanger()
On Error Resume Next
fsize = Array("8","9","10","11","12","14","16")'etc... <== the array ao font sizes
Set objBOX = nothing
Set objBOX = DesktopX.CreateForm
With objBOX
.caption = " RomanDA's Font Changer "

.addpreference("FONT") '<== All of installed fonts you will see here
.preference("FONT").Type = "font"
.preference("FONT").defaultvalue = "Arial"
.preference("FONT").caption = "Change a Font: "

.addpreference("SIZE") '<== Applying the values of "font sizes" to the Combolist items
.preference("SIZE").Type = "combolist"
For Each sz In fsize '<== extracting data from the array
.preference("SIZE").addvalue sz
Next
.preference("SIZE").defaultvalue = "8"
.preference("SIZE").caption = "Change Font Size: "

.addpreference("BOLD") '<== check box for "Bold"
.preference("BOLD").caption = " Bold"
.preference("BOLD").Type = "checkbox"
.preference("BOLD").defaultvalue = False

.addpreference("ITALIC") '<== check box for "Italic"
.preference("ITALIC").caption = " Italic"
.preference("ITALIC").Type = "checkbox"
.preference("ITALIC").defaultvalue = False

.addpreference("COLOR") '<== Color Changer
.preference("COLOR").Type = "color" 'the current color of your textobject
.preference("COLOR").defaultvalue = desktopx.object("YOUR TEXT OBJECT").textcolor
.preference("COLOR").caption = "Set a Font Color: "

If .prompt Then

VALUE1 = .preference("FONT").value
VALUE2 = .preference("SIZE").value
VALUE3 = .preference("BOLD").value
VALUE4 = .preference("ITALIC").value
VALUE5 = .preference("COLOR").value

'* Aplying new font properties
desktopx.object("YOUR TEXT OBJECT").setfont VALUE1, VALUE2, VALUE3, VALUE4, 0,0,0

'* Aplying new font color
desktopx.object("YOUR TEXT OBJECT").textcolor = VALUE5

End If
End With
Erase fsize
Set objBOX = nothing
If err.number > 0 Then err.clear
End Sub

Sorry my friend that I can't help you much powerful yet...

Best Regards.
Reply #7 Top
VAD_M,

Thanks, I found these same Pref's the other week. I actually was looking to do this in a custom made window. I found some code to read the registry and list out the fonts, its not super fast, but it works good.

I'm really close to making this all work, its been a lot of work, but its close.
I made code to do pretty much everything here, except the COLOR, i am using a popup window to do this, i might change to do the font the same way, because its very slow.

This is what my EDIT box looks like for the Holiday Countdown PRO (its not 100% yet).


Thanks for the input!
Reply #8 Top
Wow, that's a great script Vad_M. I never knew there was a 'color' option in the frm.preferences type.

Looks like it's going great DA. Keep up the good work.   BTW: how's that logo contest going?

I whipped these out the other day and thought I might as well show 'em to you.




Reply #9 Top
sViz,

Its going, but i cant see the images you posted.
Yeah, that script helps, but its not what i needed for this gadget.
Reply #10 Top
  Strange.

I'll try again:

1st pic


2nd pic
Reply #11 Top
Nice design, but I found the text hard to read.
Reply #12 Top
yep, hard to read but nice design
Reply #13 Top
You guys are right. The letters in 'commercial' especially were kinda merged together. I used a simpler font this time around:

v.3



v.4 (minute difference w/ less bevel)

Reply #14 Top
thanks for the logo ideas.. i think ill keep the one i made.. but thanks!!