Sign in to follow this  
Followers 0
Donato

help

6 posts in this topic

Hello to everyone is an Italian (for this I apologise if I explain well) are new here, let me ask you a briefing.

I am making an editor with the richtext using these commands: http://www.autoitscript.com/forum/index.ph...amp;hl=richtext. I used is also the function FIleRegister to open the text file with this program that I am creating. But I can not make it work because the compiling and trying to open a text file (eg written inside this text file hello to everyone) opens the program but without any written in the editor. how can I do? Who could help me!.

I thank in advance

Share this post


Link to post
Share on other sites



#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <GuiStatusBar.au3>
#include <FileDialog.au3>
#include <GUIEnhance.au3>
#include <EditConstants.au3>
#include <ModernMenu.au3>
#include <Array.au3>
#include <FIle.au3>
#include <GDIPlus.au3>
Global Const $AC_SRC_ALPHA = 1
Global $DocEd1 = ObjCreate("RICHTEXT.RichTextCtrl")
Global $lang[100]
Global $cong
Global $Format_Filter = "Atrix Edito Files (*.atx)|*.atx|Documenti di Testo (*.txt)|*.txt|Rich Text Document (*.rtf)|.rtf|Autoit Script (*.au3)|*.au3|C (*.c)|*.c|C++ (*.cpp)|*.cpp|Perl Linguage (*.pl)|*.pl|HTML (*.html)|*.html|Python Script(*.py)|*.py|Visual Basic Script(*.vbs)|*.vbs|Java Script (*.js)|*.js|Tutti i file (*.*)|*.*|"
Global $sFormat_Filter = "Atrix Editor Files (*.atx)|Documenti di Testo (*.txt)|Rich Text Document (*.rtf)|Autoit Script (*.au3)|C (*.c)|C++ (*.cpp)|Perl Linguage (*.pl)|HTML (*.html)|Python Script(*.py)|Visual Basic Script(*.vbs)|Java Script (*.js)|Tutti i file (*.*)|"
Global $String
Global $where
$Uni="Unitield "
$Version = " v:1.0"
$Author = @CR&@UserName
$ndt = "Nuovo Documento"

$inipath = @ScriptDir & "\Bin\Crack.ini"
$lng = IniRead($inipath,"Language","Lang","ITA")
For $i = 0 To 88
$lang[$i] = IniRead(@ScriptDir & "\Bin\" & $lng &".ini",$lng,$i,"Lang File Error !")
Next

$_New= @TempDir & "\new.ico"
FileInstall("Icons\new.ico", $_New, 1)
$_Open= @TempDir & "\open.ico"
FileInstall("Icons\open.ico", $_Open, 1)
$_Save = @TempDir & "\save.ico"
FileInstall("Icons\save.ico", $_Save, 1)
$_Taglia= @TempDir & "\cut.ico"
FileInstall("Icons\Cut.ico", $_Taglia, 1)
$_Copia= @TempDir & "\copy.ico"
FileInstall("Icons\copy.ico", $_Copia, 1)
$_Incolla= @TempDir & "\paste.ico"
FileInstall("Icons\paste.ico", $_Incolla, 1)
$_Saveas= @TempDir & "\saveas.ico"
FileInstall("Icons\saveas.ico", $_Saveas, 1)
$_D_T = @TempDir & "\insertdatetime.ico"
FileInstall("Icons\insertdatetime.ico",$_D_T,1)
$_Exit= @TempDir & "\exit.ico"
FileInstall("Icons\exit.ico", $_Exit, 1)
$sping = @TempDir & "\ScreenSplash.png"
FileInstall("Pictures\ScreenSplash.png", $sping, 1)
$_about = @TempDir & "\aboutico.ico"
FileInstall ("Icons\aboutico.ico",$_about,1)
$_atx_icon = @TempDir &"\atx_icon.ico"
FileInstall ("Icons\atx_icon.ico",$_atx_icon,1)
$_icon_programma = @TempDir & "\icona_programma2.ico"
FileInstall ("Icons\icona_programma2.ico",$_icon_programma,1)

;~ splash
Splash()
;~ splash
$Atrix = GUICreate($Uni&"- Atrix Editor", 735, 600, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_MAXIMIZEBOX))
_GUIEnhanceAnimateWin ($atrix, 2000, $GUI_EN_ANI_FADEIN)

$File = GUICtrlCreateMenu($lang[1])
$New = _GUICtrlCreateODMenuitem ($lang[2], $File,$_new)
$Open = _GUICtrlCreateODMenuitem ($lang[3], $File, $_open)
_GUICtrlCreateODMenuitem ("", $File)
$Save = _GUICtrlCreateODMenuitem ($lang[4], $File,$_save)
$Saveas = _GUICtrlCreateODMenuitem ($lang[5], $File, $_saveas)
_GUICtrlCreateODMenuitem ("", $File)
$Exit = _GUICtrlCreateODMenuitem ($lang[6], $File, $_exit)

$Edit = GUICtrlCreateMenu("&Modifica")
$EditTaglia = _GUICtrlCreateODMenuitem ($lang[7], $Edit,$_Taglia, 0)
$EditCopia = _GUICtrlCreateODMenuitem ($lang[8], $Edit, $_Copia, 0)
$EditIncolla = _GUICtrlCreateODMenuitem ($lang[9], $Edit, $_Incolla, 0)
_GUICtrlCreateODMenuitem ("", $Edit)
$InsDT = _GUICtrlCreateODMenuitem ($lang[10], $Edit, $_D_T,0)

$Help = GUICtrlCreateMenu("Help")
$About = _GUICtrlCreateODMenuitem ($lang[15], $Help, @ScriptDir & "\Icons\aboutico.ico")
_GUICtrlCreateODMenuitem ("", $Help)

GUICtrlCreateLabel("", 10, 5, 715, 32, $SS_SUNKEN)
GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKHEIGHT)
GUICtrlSetState(-1, $GUI_DISABLE)
FileChangeDir(@ScriptDir & "\Icons")
$IconNew = GUICtrlCreateButton("", 15, 10, 22, 22, $BS_ICON)
GUICtrlSetImage($IconNew,$_New)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKSIZE)
GUICtrlSetTip($IconNEW,$lang[2] , $lang[0], 1, 1)
$IconOpen = GUICtrlCreateButton("", 42, 10, 22, 22, $BS_ICON)
GUICtrlSetImage($IconOpen,$_Open)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKSIZE)
GUICtrlSetTip($IconOpen,$lang[3] ,  $lang[0], 1, 1)
$IconSave = GUICtrlCreateButton("", 69, 10, 22, 22, $BS_ICON)
GUICtrlSetImage($IconSave,$_Save)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKSIZE)
GUICtrlSetTip($IconSave,$lang[4] ,  $lang[0], 1, 1)
GUICtrlCreateLabel("", 96, 10, 1, 22)
GUICtrlSetBkColor(-1, 0)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKSIZE)
$IconTaglia = GUICtrlCreateButton("", 101, 10, 22, 22, $BS_ICON)
GUICtrlSetImage($IconTaglia,$_Taglia)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKSIZE)
GUICtrlSetTip($IconTaglia,$lang[7] , $lang[0], 1, 1)
$IconCopia = GUICtrlCreateButton("", 128, 10, 22, 22, $BS_ICON)
GUICtrlSetImage($IconCopia,$_Copia)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKSIZE)
GUICtrlSetTip($IconCopia,$lang[8] ,  $lang[0], 1, 1)
$IconIncolla = GUICtrlCreateButton("", 155, 10, 22, 22, $BS_ICON)
GUICtrlSetImage($IconIncolla,$_Incolla)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKSIZE)
GUICtrlSetTip($IconIncolla,$lang[9] ,  $lang[0], 1, 1)
GUICtrlCreateLabel("", 182, 10, 1, 22)
GUICtrlSetBkColor(-1, 0)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKSIZE)

$Doc1 = GUICtrlCreateTabItem("Doc1")
$GUIActiveX = GUICtrlCreateObj($DocEd1, 10, 70)
With $DocEd1
    .OLEObjects ()
    .OLEDrag ()
    .OLEDropMode = 2
    .ScrollBars ()
    .AutoVerbMenu = 1
    .SelStart = 0
    .SelFontName = "Arial"
    .SelFontSize = 9
    .HideSelection = False
    .BackColor = 0xFFFFFF
    EndWith
GUICtrlSetPos(-1, 10, 100, 715,450)
GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)

$statusbar = _GUICtrlStatusBar_Create($Atrix)
Dim $statusbar_PartsWidth[3] = [150, 550,400]
_GUICtrlStatusBar_SetParts($statusbar, $statusbar_PartsWidth)
_GUICtrlStatusBar_SetText($statusbar, $lang[0] &$version, 0)
_GUICtrlStatusBar_SetText($statusbar,$lang[12] & $Author , 1)
_GUICtrlStatusBar_SetText($statusbar,$lang[13], 2)
GUISetState(@SW_SHOW)
GUISetBkColor(0xEBEFF5)
_GUICtrlStatusBar_Resize($StatusBar)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE , $exit
        If Not $DocEd1.Text = "" Then
        $1 = MsgBox (51,$lang[0], "Attenzione il testo del file è stato cambiato"& @CRLF & @CRLF &"Salvare il file correnti ?")
        If $1 = 7 Then Testo()
        If $1 = 6 Then
        Save()
        EndIf
        EndIf
        Splash()
        FileDelete(@TempDir & "\new.ico")
        FileDelete(@TempDir & "\save.ico")
        FileDelete(@TempDir & "\saveas.ico")
        FileDelete(@TempDir & "\cut.ico")
        FileDelete(@TempDir & "\copy.ico")
        FileDelete(@TempDir & "\paste.ico")
        FileDelete(@TempDir & "\exit.ico")
        FileDelete(@TempDir & "\insertdatetime.ico")
        FileDelete(@TempDir & "\open.ico")
        FileDelete(@TempDir & "\abutico.ico")
        FileDelete(@TempDir & "\atx_icon.ico")
        FileDelete(@TempDir & "\icona_programma2.ico")
        FileDelete(@TempDir & "\ScreenSplash.png")
        Sleep (1000)
        Exit
        
        Case $GUI_EVENT_RESIZED, $GUI_EVENT_MINIMIZE, $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE
        _GUICtrlStatusBar_Resize($StatusBar)

        Case $New,$IconNew
        If Not $DocEd1.Text = "" Then
        $1 = MsgBox (51,$lang[0], "Attenzione il testo del file è stato cambiato"& @CRLF & @CRLF &"Salvare il file correnti ?")
        If $1 = 7 Then Testo()
        If $1 = 6 Then Save()
        Testo()
        EndIf
        WinSetTitle($Atrix,"", $ndt&' - Atrix Editor')

        Case $IconOpen, $Open
        _GUICtrlStatusBar_SetText($statusbar, $lang[3], 2)
        $OpenDir= FileOpenDialog ("Apri",@DesktopDir,$sFormat_Filter,3)
        If Not $OpenDir = "" Then
        $DocEd1.LoadFile ($OpenDir, 1)
        EndIf
        $title = _FileGetTitle($OpenDir)
        WinSetTitle($Atrix, '', $title&' - Atrix Editor')
        _GUICtrlStatusBar_SetText($statusbar, $lang[13], 2)

    Case $Save,$IconSave
        Save()
        
    Case $SaveAs
        SaveAs()
        
    Case $EditTaglia, $IconTaglia
        ClipPut($DocEd1.SelText)
        $DocEd1.SelText = ""
        
    Case $EditCopia, $IconCopia
        ClipPut ($DocEd1.SelText)
        
    Case $EditIncolla, $IconIncolla
        $DocEd1.SText=ClipGet()
        
    Case $InsDT
        $text = $DocEd1.Text
        $DocEd1.Text = $text & " " & @HOUR & ":" & @MIN & "  "& @MDAY & "/" & @MON & "/" & @YEAR & " "
        
    Case $about
        Local $scrltext
        $scrltext = "                        Atrix Editor v." & $version & @CRLF & _
        "                              © Copyright 2007, 2008" & @CRLF & _
        @CRLF & _
        "                                          Atrix Editor" & @CRLF & _
        "Questo programma è un software libero: è possibile redistribuirlo" & @CRLF & _
        @CRLF & _
        "Esso  è stato reallizato con l'aiuto del sito ufficliale" & @CRLF & _
        "<http://www.autoitscript.com/forum/index.php?> e con l'aiuto" & @CRLF & _
        "di hight <h1gh@live.it> nel settore grafica"
        $scrgui = GUICreate("L|M|TER Media Player - GPL", 303, 291)
        GUISetBkColor(0xEBEFF5)
        $scrolltxt = GUICtrlCreateLabel($scrltext, 5, 300, 303, 285)
        GUICtrlSetColor(-1, 0x000000)
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $scrgui, "int", 400, "long", 0x00080000);fade-in
        GUISetState(@SW_SHOW)
        AdlibEnable('_MoveMarquee', 60)
While 1
    $iMsg = GUIGetMsg()
    Select
        Case $iMsg = $GUI_EVENT_CLOSE
        GUIDelete($scrgui)
        ExitLoop
        Case $iMsg = $Exit
        GUIDelete($scrgui)
        ExitLoop
    EndSelect
WEnd
        GUISwitch($Atrix)
EndSwitch
WEnd

 Func _MoveMarquee()
    $aCpos = ControlGetPos($scrgui, '', $scrolltxt)
    If IsArray($aCpos) Then
        If $aCpos[1] <= -300 Then $aCpos[1] = 100
        ControlMove($scrgui, '', $scrolltxt, 5, $aCpos[1] - 1)
    EndIf
EndFunc 


Func Testo()
        With $DocEd1
        .TextRTF = ""
        .SelColor = 0x000000
        .BackColor = 0xFFFFFF
        .SelStart = 0
        .SelFontName = "Arial"
        .SelFontSize = 9
EndWith
EndFunc
            
Func SaveAs()
        _GUICtrlStatusBar_SetText($statusbar, $lang[14], 2)
        $String = StringRegExpReplace ($ndt, "^.*\\", "")
        $where = _FileSaveDialog ("Salvataggio in corso ...", @DesktopDir ,$Format_Filter,18,$string)
        If @error Then Return 2 And _GUICtrlStatusBar_SetText($statusbar, $lang[13], 2)
        $DocEd1.SaveFile ($where, 1)
        $title = _FileGetTitle($where)
        WinSetTitle($Atrix,"", $title&' - Atrix Editor')
         _GUICtrlStatusBar_SetText($statusbar, $lang[13], 2)
EndFunc
        
Func Save()
        If WinGetTitle ($Atrix) = $Uni&"- Atrix Editor" Then
        SaveAs()
Else
$DocEd1.SaveFile ($where, 1)
EndIf
EndFunc

    Func _FileGetTitle($sFile)
    $string = StringSplit($sFile, '\', 1)
    $txt = $string[$string[0]]
    $split = StringSplit($txt, '.', 1)
    return StringReplace($txt, '.'&$split[$split[0]], '')
EndFunc

    Func about()
    EndFunc  ;==>about
    
Func SetBitmap($hGUI, $hImage, $iOpacity)
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC(0)
    $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
    DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)
    _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteDC($hMemDC)
EndFunc  ;==>SetBitmap

Func Splash()
    _GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile($sping)
$width = _GDIPlus_ImageGetWidth($hImage)
$height = _GDIPlus_ImageGetHeight($hImage)
$Splash = GUICreate("Atrix Editor", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED, $DS_MODALFRAME)
GUISetState(@SW_LOCK)
SetBitmap($Splash, $hImage, 0)
GUISetState()
WinSetOnTop($Splash, "", 1)
For $i = 0 To 255 Step 10
    SetBitmap($Splash, $hImage, $i)
    Sleep(10)
Next
Sleep (3000)
For $i = 255 To 0 Step -10
    SetBitmap($Splash, $hImage, $i)
    Sleep(10)
Next
GUIDelete($Splash)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()
EndFunc

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

As far as I know you can use only RTF file format in $DocEd1.LoadFile ($OpenDir, 1)

Try it with $DocEd1.LoadFile ('C:\file.rtf', 1)

Edited by Zedna

Share this post


Link to post
Share on other sites

No. But I to open the formats I want is not a problem, what I can not do is as follows:

If I compiling the program and go to open a file associated with the program just completed (with written into the file for example hello to everyone) normally you would open the program with written to the editor hello to everyone, instead of queesto do everything that happens to me only opens the program with nothing written nel'editor

How can I do?

Share this post


Link to post
Share on other sites

no one I can answer

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
Sign in to follow this  
Followers 0