Jump to content

i can't save or open in richEdit


Recommended Posts

here is my code :

where is the problem ? 

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <GuiRichEdit.au3>

 Global $child1 = 9999, $Bigger = 9999 ,$ChangeFont= 9999, $ChangeColor= 9999, $HighLight= 9999, $BKColor= 9999,  $Smaller= 9999, $hide= 9999

 gui1()

 Func gui1()
    $main = GUICreate("[IQ-Team]Note", 755, 594, 185, 52,$ws_popup)
GUISetBkColor(0x000000)
$Pic1 = GUICtrlCreatePic("C:\Users\yousefsamy\Desktop\iq1.jpg", 0, 0, 753, 97)
$edit = _GUICtrlRichEdit_Create($main,"", 8, 136, 697, 449)
GUICtrlSetData(-1, "")
$exit = GUICtrlCreateIcon("C:\Users\yousefsamy\Desktop\IQ-Note\x.ico", -1, 704, 104, 48, 48)
GUICtrlSetCursor (-1, 0)
$minimize = GUICtrlCreateIcon("C:\Users\yousefsamy\Desktop\IQ-Note\-.ico", -1, 704, 152, 48, 48)
GUICtrlSetCursor (-1, 0)
$save = GUICtrlCreateIcon("C:\Users\yousefsamy\Desktop\IQ-Note\save.ico", -1, 712, 280, 32, 32)
GUICtrlSetCursor (-1, 0)
$open = GUICtrlCreateIcon("C:\Users\yousefsamy\Desktop\IQ-Note\open.ico", -1, 712, 240, 32, 32)
GUICtrlSetCursor (-1, 0)
$Input1 = GUICtrlCreateInput("عـــــنـــــوان  الـــــدرس", 184, 104, 377, 33, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER))
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xC0C0C0)
GUICtrlSetCursor (-1, 0)
$tools = GUICtrlCreateIcon("C:\Users\yousefsamy\Desktop\IQ-Note\Settings.ico", -1, 712, 320, 32, 32)
GUICtrlSetCursor (-1, 0)
$info = GUICtrlCreateIcon("C:\Users\yousefsamy\Desktop\IQ-Note\info.ico", -1, 704, 536, 48, 48)
GUICtrlSetCursor (-1, 0)
$site = GUICtrlCreateIcon("C:\Users\yousefsamy\Desktop\IQ-Note\site.ico", -1, 704, 480, 48, 48)
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)

     While 1
         $aMsg = GUIGetMsg(1)
         Switch $aMsg[1]
             Case $main
                 Switch $aMsg[0]
                     Case $GUI_EVENT_CLOSE
                         ExitLoop
                                        Case $exit
                    ExitLoop
                     Case $save
                                    $o = GUICtrlRead($edit)
            $oo = FileSaveDialog("File Save",@DesktopDir,"TEXT (*.txt)")
            $ooo = FileOpen($oo,2)
            FileWrite($oo,$o)
                     Case $open
            $k = FileOpenDialog("File Open",@DesktopDir ,"TEXT (*.txt)")
            $kk = FileRead($k)
            GUICtrlSetData($edit,$kk)
                     Case $site
                         ShellExecute("http://www.iq-team.org/vb")
                     Case $info
                         MsgBox(0,"Thank You our User","Coded By : [WiseHacker]Coder"&@CRLF&"اهداء الى كل المسلمين ^_^"&@CRLF&"For All Iq-Team Members")
                Case $minimize
                    GUISetState(@SW_MINIMIZE)
        Case $GUI_EVENT_PRIMARYDOWN
            _SendMessage($main, $WM_SYSCOMMAND, 0xF012, 0)
                     Case $tools
                         GUICtrlSetState($tools,$GUI_DISABLE)
                         gui2()
                 EndSwitch
             Case $child1
                 Switch $aMsg[0]
                     Case $GUI_EVENT_CLOSE
                         GUIDelete($child1)
                         GUICtrlSetState($tools, $GUI_ENABLE)
        Case $Smaller
            _GUICtrlRichEdit_ChangeFontSize($edit,-5)
        Case $Bigger
            _GUICtrlRichEdit_ChangeFontSize($edit,5)

        Case $ChangeColor
            $color = _ChooseColor()
            _GUICtrlRichEdit_SetCharColor($edit,$color)


        Case $ChangeFont
            $font = _ChooseFont()
            _GUICtrlRichEdit_SetFont($edit,$font[3],$font[2])


        Case $BKColor
            $colorbk = _ChooseColor()
            _GUICtrlRichEdit_SetBkColor($edit,$colorbk)
        case $HighLight
            $txtcolor = _ChooseColor(1)
            _GUICtrlRichEdit_SetCharBkColor($edit,$txtcolor)
        Case $hide
            $sethide = GUICtrlRead($hide)
            WinSetTrans("[IQ-Team]Note","",$sethide)
                 EndSwitch
         EndSwitch
     WEnd
 EndFunc

 Func gui2()
$child1 = GUICreate("Tools", 178, 177, 2, 469)
GUISetBkColor(0x008080)
$Bigger = GUICtrlCreateButton("Bigger", 8, 8, 81, 57)
$ChangeFont = GUICtrlCreateButton("ChangeFont", 8, 64, 73, 33)
$ChangeColor = GUICtrlCreateButton("ChangeColor", 80, 64, 89, 33)
$HighLight = GUICtrlCreateButton("HighLight", 8, 96, 97, 33)
$BKColor = GUICtrlCreateButton("BKColor", 104, 96, 65, 33)
$Smaller = GUICtrlCreateButton("Smaller", 88, 8, 81, 57)
$hide = GUICtrlCreateSlider(0, 136, 177, 33)
GUICtrlSetLimit($hide,254,0)
GUICtrlSetData($hide,180)
     GUISetState()
 EndFunc
Edited by yousefsamy
Link to comment
Share on other sites

  • Moderators

yousefsamy,

GUICtrlRead only works on standard edit controls created by the GUICtrlCreateEdit function - the parameter you pass is the ControlID returned from the creation function. You cannot use it to read a RichEdit control created by the RichEdit UDF as the return from the _GUICtrlRichEdit_Create function is a Windows handle and not a ControlID. You need to use the other UDF functions to get at the content, just as you are using them to change the colour and font. :)

So, as usual, my advice is to read the Help file - there are some _GUICtrlRichEdit_* functions in there which will do the job very nicely. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

yousefsamy,

 

really i had searched in richedit funcs with no result

It must have been a very cursory search if none of the following appeared to be helpful. ;)

_GUICtrlRichEdit_AppendText     - Appends text at the end of the client area
_GUICtrlRichEdit_GetText        - Get all of the text in the control
_GUICtrlRichEdit_StreamFromFile - Sets text in a control from a file
_GUICtrlRichEdit_StreamFromVar  - Sets text in a control from a variable
_GUICtrlRichEdit_StreamToFile   - Writes contents of a control to a file
_GUICtrlRichEdit_StreamToVar    - Writes contents of a control to a variable
M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

yousefsamy,

I strongly suggest that you spend a few hours actually scrolling through the Help file and seeing what is in there - unless you know exactly what you are looking for the "Search" tab is not what you want. If you had done as I suggested and entered "_GUICtrlRichEdit" into the "Index" tab, you would have seen ALL the RichEdit functions listed. :)

I have lost count of the number of times I have told you to use the Help file and then had to hand you the answer - there will not be too many more. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

yousefsamy,

So do what we keep telling you - READ THE HELP FILE. Then you will not need to ask so many basic questions. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Sir i want tell you that i had read really many of funcs of _guictrlrichedit list but i didn't get the chance to see these ,, so don't think me a lazy one :) try to believe me.

so sorry because my weak language didn't able me to explain what i want to say :)

Edited by yousefsamy
Link to comment
Share on other sites

My language skills are also not the best :)

Question 1:

First what I want to ask you @yousefsamy is what Editor you use ?

is it SciTe4AutoIt3  ??

Question 2:

Did you found in HelpFile    _GUICtrlRichEdit_Copy  ?

Question 3:

{is related to previous quetion}

Did you chceck and study example from HelpFile    for this function _GUICtrlRichEdit_Copy  ?

 

mLipok

ps.

look in my signatur you can find there "How to use HelpFile" link and many other useful links

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

o man....

you ask "where is the problem ?"

I say you where: You did not tell us what you want to do.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • Moderators

yousefsamy,

In post #4 above I told you which functions to use to save and load RichText files - what more do you want? Are you expecting someone to write the script for you? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

yousefsamy,

 

i have completed my script

Excellent. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...