PDA

View Full Version : dialog.message and file.copy help


dms
08-09-2006, 06:24 AM
I've been using the 'dialog.message' feature to generate messages however long messages seem to spread right across the screen. Is there any way to split the messages into several lines and to control how/where they are split.

Also when using the 'file.copy' script how do I specify to copy to the desktop. Do I really need to specify the full path C:\Documents and settings...Desktop?? Is there a neater way of choosing the desktop as the destination. I ask 'cos I notice that the 'Shell.CreateShortcut' script has a tidy way of installing shortcuts to the desktop. However I would prefer to install the files to the desktop rather than create a shortcut.

Thanks in advance.

Tek
08-09-2006, 07:14 AM
Hi and welcome to the forums.


I've been using the 'dialog.message' feature to generate messages however long messages seem to spread right across the screen. Is there any way to split the messages into several lines and to control how/where they are split.


To do this, you can use variations of the following two escape sequences:

\n - newline
\r - carriage return

For example, if you wanted to display the following dialog message on two lines:


result = Dialog.Message("Notice", "The quick brown fox jumped over the lazy dog. It was certainly a sight to see.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);


It would be changed like this:


result = Dialog.Message("Notice", "The quick brown fox jumped over the lazy dog.\r\nIt was certainly a sight to see.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);


If you wanted to add an extra line in between both sentences, the code would be:


result = Dialog.Message("Notice", "The quick brown fox jumped over the lazy dog.\r\n\nIt was certainly a sight to see.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);



Also when using the 'file.copy' script how do I specify to copy to the desktop. Do I really need to specify the full path C:\Documents and settings...Desktop?? Is there a neater way of choosing the desktop as the destination. I ask 'cos I notice that the 'Shell.CreateShortcut' script has a tidy way of installing shortcuts to the desktop. However I would prefer to install the files to the desktop rather than create a shortcut.


There is an action called Shell.GetFolder that will get the path to the folder on the users system. For some, it might be on one drive and for others it could be on a different drive. For this reason, using C:\Documents and settings\User\Desktop will not always work. Instead, try this code:


result2 = Shell.GetFolder(SHF_DESKTOP);


This will return the path to the users desktop folder. For the 'All Users' profile, use this code:


result2 = Shell.GetFolder(SHF_DESKTOP_COMMON);


I hope this helps.

dms
08-09-2006, 07:49 AM
Tek,
Thanks for quick response. have implemented your suggestions and it's working great. Thanks again.