Skysnake

MsgBox does not display & (ampersand)

11 posts in this topic

Quick search did not supply existing threads.

Maybe I am missing something.

Problem is this 

Local $DisplayText="This & that, shows that this & that does not display the ampersand correctly"

MsgBox(0,"Show &",$DisplayText)

What I get is:

This _that, shows that this _that does not display the ampersand correctly.

For Labels one cures the problem with the style $SS_NOPREFIX, but what's to do with the MsgBox?

Just a nudge in the right direction would be appreciated.

Thanks :)

 

 

Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites



I believe it is a UTF related issue. 

The example above works correctly :(

But when I read text from a .txt file and display that, I get the problem as discribed. So its probably not a MsgBox issue, but rather a file read issue... I will look at this again in the morning. 

Thanks. :)

 


Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites

I can't recreate that. Your ampersands get replaced with an underline?

Your code works just fine for me.

56bb5a6ecbb82_2016-02-1016_41_45-.jpg.ce

 

I've also tried this using FileRead (warning: this does an actual file write, read and delete to your temp dir, just saying).

Global $hFile = FileOpen(@TempDir & "\test1234.txt", 10)
FileWrite($hFile, "This & that, shows that this & that does not display the ampersand correctly.")
FileClose($hFile)

Sleep(2000)

$hFile = FileOpen(@TempDir & "\test1234.txt", 0)
MsgBox(0, "", FileRead($hFile))
FileClose($hFile)

FileDelete(@TempDir & "\test1234.txt")

Same result as above. There must be something else to your code which alters it that way.

Share this post


Link to post
Share on other sites

Next steps, what's your version of Autoit and possibly Scite? And what package did you install?

Share this post


Link to post
Share on other sites

Interesting...it sounds like it's creating an access key on the msgbox dialog box.  I'm not sure how that is happening or how to reproduce it.  You're not using a custom msgbox function are you?  

Share this post


Link to post
Share on other sites

Standard MSGBOX in latest AutoIt, on Win7 and Win10.

However, what I did not mention is that string is encreypted, saved to disk, then another process decrypts and displays the text.  It is this second display that creates the problem...


Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites

It's probably not the message box that's the problem then, and has nothing to do with the error you're experiencing.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

And you are positive that the second script is using the standard MsgBox?  I don't mean to berate the point I am seriously struggling to reproduce the issue.  Can you post some code that does reproduce the issue?

Share this post


Link to post
Share on other sites

Only if I use two scripts. If I use the example posted here, it works correctly. And I do not understand why


Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites

Its a set of encrypt / decrypt scripts that are basically mirrors. used for sending secure communication. deliver encrypted text file to recipient, opens it and sees the decoded content --- I actually started with the encrypter, then copied to the decrypt script and made minimal changes.

Its at the office.  I will sanitize and provide a copy. Thank you for your interest.


Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • Nareshm
      By Nareshm
      I have autoit script like this :
      winActivate ("BillReceipt") ControlClick ( "BillReceipt", "", "[NAME:winviewer]", "right") Send ( "{ENTER}") WinWait ("Print") ControlClick ("Print", "", "[CLASS:Button; INSTANCE:13]") Winwait ("Save As") WinActivate ("Save As") Send ("{TAB 5} {Backspace} ^v {Enter}") I need Saved successfully msgbox with file name as i saved like Filename.extension (Example = test.pdf is saved successfull)

      Please Help
    • Verssuss
      By Verssuss
      hi guys i want avoid to multiple MsgBox by hold Hotkey "]" in my script
       
      #include <GuiConstantsEx.au3> #include <Windowsconstants.au3> #include <SendMessage.au3> #include <WinAPI.au3> ;~ HotKeySet("{[}", "_boxminus") HotKeySet("{]}", "_boxplus") HotKeySet("{ESC}", "On_Exit") $hGUI = GUICreate("", 100, 100, -1, -1, $WS_POPUP, BitOr($WS_EX_LAYERED, $WS_EX_COMPOSITED, $WS_EX_TOPMOST)) GUISetBkColor(0x00FF00) GuiCtrlCreateLabel("", 3, 3, 94, 94) GUICtrlSetBkColor(-1, 0xABCDEF) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUISetState() _WinAPI_SetLayeredWindowAttributes($hGui, 0xABCDEF) $box_range = 100 While 1 $pos = MouseGetPos() WinMove($hGUI, "", $pos[0] - ($box_range / 2), $pos[1] - ($box_range / 2), $box_range, $box_range) WEnd ;~ Func _boxminus() ;~ If $box_range >= 30 Then $box_range = $box_range - 10 ;~ If $box_range < 30 Then $box_range = $box_range - 1 ;~ EndFunc Func _boxplus() If $box_range < 200 Then $box_range = $box_range + 10 Else MsgBox(0,"ERROR", "Maximum size already exist") EndIf EndFunc Func On_Exit() Exit EndFunc i wish after i get first MsgBox another gonna replaced with first one or just cancel in and apeear again
      how can i make it right ???
    • AnonymousX
      By AnonymousX
      Hello,
      I'm trying to make it so that when a message box pops up that the GUI will be unresponsive until that message box has been closed. From reading through the help the closest thing I can find is the WinWaitClose function, however this doesn't work fully as desired. If user tries to click on GUI the actions are more just waiting for the message box to close, so that once it closes everything happens at once. I want it so that the GUI is completely unusable until message box is closed. 
       
      Below is test code to demonstrate the problem and help explain what I want. Any advice on this?
       
      #include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example") Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) local $but = GUICtrlCreateButton("Hello", 150,150,85,25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) MsgBox( 262144,"Message","Try hitting the hello button several times,without closing this window. Now close this window and see how script wasn't restricted it just was waiting and storing the instructions") WinWaitClose("Message") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK Exit case $but MsgBox(0,"","Hello") EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example  
    • hcI
      By hcI
      Hello !
      I'm making a little script with only a tray option, no GUI.
      And i would like to know if someone created a function to set a personalized icon in top-left corner of the MsgBox and/or InputBox...
      -hcI
    • SkysLastChance
      By SkysLastChance
      I am a little confused and not sure what I am doing wrong.
      I am trying to get a OK and Cancel button that is always on top. 
      $MB_OKCANCEL 1 OK and Cancel $MB_TOPMOST 262144 MsgBox() has top-most attribute set  
      But when I try to run this code. 
      $Msg = MsgBox(1 & 262144, "Registration", "Would you like to continue?") I get this.