stuka Posted November 17, 2008 Share Posted November 17, 2008 (edited) . Edited August 23, 2009 by stuka Link to comment Share on other sites More sharing options...
Achilles Posted November 17, 2008 Share Posted November 17, 2008 If you use GUICtrlCreateLabel('', x, y, width, height) and actually put in values for width and height then it the label size by default should not exceed what you put in. Alternatively, you could use StringLen() for the path you are using and then StringTrimRight() if needed to shorten the string. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 17, 2008 Moderators Share Posted November 17, 2008 (edited) SS_WORDELLIPSIS I believe. Edit: Global Const $SS_WORDELLIPSIS = 0x00C000 $s_text = "C:/LoooooooonnnnnnngggggFolderName\AnotherLoooooonnnnngFolderName\FileName.jpg" GUICreate("GUI") $i_label = GUICtrlCreateLabel($s_text, 10, 10, 180, 20, $SS_WORDELLIPSIS) GUISetState() While GUIGetMsg() <> -3 WEnd Edited November 17, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
martin Posted November 17, 2008 Share Posted November 17, 2008 SS_WORDELLIPSIS I believe. Edit: Global Const $SS_WORDELLIPSIS = 0x00C000 $s_text = "C:/LoooooooonnnnnnngggggFolderName\AnotherLoooooonnnnngFolderName\FileName.jpg" GUICreate("GUI") $i_label = GUICtrlCreateLabel($s_text, 10, 10, 180, 20, $SS_WORDELLIPSIS) GUISetState() While GUIGetMsg() <> -3 WEndMaybe combine that with a hint? Global Const $SS_WORDELLIPSIS = 0x00C000 $s_text = "C:/LoooooooonnnnnnngggggFolderName\AnotherLoooooonnnnngFolderName\FileName.jpg" GUICreate("GUI") $i_label = GUICtrlCreateLabel($s_text, 10, 10, 180, 20, $SS_WORDELLIPSIS) GUICtrlSetTip(-1,$s_text) GUISetState() While GUIGetMsg() <> -3 WEnd Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 17, 2008 Moderators Share Posted November 17, 2008 Maybe combine that with a hint? Global Const $SS_WORDELLIPSIS = 0x00C000 $s_text = "C:/LoooooooonnnnnnngggggFolderName\AnotherLoooooonnnnngFolderName\FileName.jpg" GUICreate("GUI") $i_label = GUICtrlCreateLabel($s_text, 10, 10, 180, 20, $SS_WORDELLIPSIS) GUICtrlSetTip(-1,$s_text) GUISetState() While GUIGetMsg() <> -3 WEndVery good point/idea. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 17, 2008 Moderators Share Posted November 17, 2008 Thanks SmOke_N and martin!But, I can't seem to find $SS_WORDELLIPSIS in the help file? That's why I provided the global constant value for you in the post Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 17, 2008 Moderators Share Posted November 17, 2008 (edited) Oh wait, it doesn't seem to produce the result I need... Long label: C:/LoooooooonnnnnnngggggFolderName\AnotherLoooooonnnnngFolderName\FileName.jpg shortened to... Shortened Label: C:/Loooooooonnnnnnng\.....\FileName.jpg Only the middle should be shortened, not the end. It should before the last '\'. I got this description from the Win32::GUI website: Any idea?That's perl... the proper way to do it with windows api (which is what autoit uses) is what I provided. If you need something different, you could spend the rest of the day writing it (probably won't take that long, but you'll have to learn how to get text len in pixel size etc...) Edit: Might see if you can get DT_PATH_ELLIPSIS working right. Edited November 17, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 17, 2008 Moderators Share Posted November 17, 2008 That's big task for me, a not so experienced coder. But I'll see what I can do. Thank you! Edit: How does the code below work? Global Const $SS_WORDELLIPSIS = 0x00C000 P/S: Might be a good style addition to AutoIt The DT_etc I posted got me thinking:Global Const $SS_PATHELLIPSIS = 0x008000 $s_text = "C:\LoooooooonnnnnnngggggFolderName\AnotherLoooooonnnnngFolderName\FileName.jpg" GUICreate("GUI") $i_label = GUICtrlCreateLabel($s_text, 10, 10, 180, 20, $SS_PATHELLIPSIS) GUICtrlSetTip(-1,$s_text) GUISetState() While GUIGetMsg() <> -3 WEndI believe that is what you wanted. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
ResNullius Posted November 17, 2008 Share Posted November 17, 2008 Let's say I have a GUI with a width of 200. Then I have this label which has a width of 180. The label length changes according to another variable. So it is possible for the label length to be longer than the 180 limit. How do I shorten the label length? For example: Long label: C:/LoooooooonnnnnnngggggFolderName\AnotherLoooooonnnnngFolderName\FileName.jpg shortened to... Shortened Label: C:/Loooooooonnnnnnng\.....\FileName.jpg Can it be done? And is it possible to tell the script to end the label with the FULL file name(eg. \FileName.jpg)? Thank you! Check Out: http://www.autoitscript.com/forum/index.ph...st&p=356660 for some ideas. Link to comment Share on other sites More sharing options...
ResNullius Posted November 17, 2008 Share Posted November 17, 2008 Interesting, but SmOke_N and martin's 2 examples seems easier and shorter too. Oppps, didn't see SmOke_N's last post (I opened a browser tab to reply and then didn't do so right away and he snuck in there with the much more elegant answer ) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now