Jump to content

Recommended Posts

Xkdash

Hello Friends , Recently I made a simple text editor that enables you to Type, Save ,Open ,Edit , Change font etc.. I made separate buttons for them.

Everything is working fine but I am stuck at a point. I want a .txt file to be opened by my standalone application. When I go to the file properties, then openWith and choose my editor.exe. The .txt file doesn't seem to open with my application. Although when I open a file using the dedicated buttons it works fine. What should I do ?.

Share this post


Link to post
Share on other sites
water

You should post your script so we are able to help you with your problem :)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Xkdash

;------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;Created by Kuntal Das
;Xtreme Labs,Team SDK
;Xtreme Note
;------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

;FLAG DEFINITION
;---------------
;$flag1=-2    - file has not been saved even once i.e. text has only been typed in the text box
;$flag1=-1  - File has been saved atleast once
;$flag2=-2    - File has not been opened i.e. text has only been typed in the text box
;$flag2=-1    - File has been opened
;------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

#include <ColorConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiEdit.au3>
#include <File.au3>
#include <Misc.au3>

_Main()
Func _Main()
    Local $GUIWidth = 700, $GUIHeight = 300
    Local $sDrive = "", $sDir = "", $sFilename = "", $sExtension = ""
    Local $Edit, $Save,$About,$msg,$Open,$temp,$fopen1,$get,$fopen2,$split,$flag1=-2,$opf1,$fread,$name,$flag2=-2,$saf,$lab,$dark,$light,$font,$fd,$file,$lab2
    Local $msg1= "Choose a filename.",$msg2= "Select a single text file."
    $file=FileOpen(@ScriptDir&"\settings.xns")
    $fn=FileReadLine($file,6)
    GUICreate("Xtreme Note. v1.0 ", $GUIWidth, $GUIHeight)

    $Edit = GUICtrlCreateEdit("", 10, 10, 630, 255)
    $Open = GUICtrlCreateButton("Open", 440, 270, 70, 25)
    $Save = GUICtrlCreateButton("Save", 530, 270, 70, 25)
    $About= GUICtrlCreateButton("About", 620, 270, 70, 25)
    $New  = GUICtrlCreateButton("New", 350, 270, 70, 25)
    $lab=GUICtrlCreateLabel(" FILE_NAME : Untitled.txt", 10, 275, 320, 20)
    $lab2=GUICtrlCreateLabel("Presets", 643, 110, 320, 20)
    $dark=GUICtrlCreateButton(" Dark ", 650, 180, 45, 40)
    $light=GUICtrlCreateButton(" Light ", 650, 130, 45, 40)
    $font=GUICtrlCreateButton(" Font ", 650, 60, 45, 40)

    GUISetBkColor(FileReadLine($file,5))
    GUICtrlSetBkColor($Edit, FileReadLine($file,4))

    GUICtrlSetBkColor($Open, FileReadLine($file,2))
    GUICtrlSetBkColor($Save, FileReadLine($file,2))
    GUICtrlSetBkColor($About,FileReadLine($file,2))
    GUICtrlSetBkColor($New, FileReadLine($file,2))
    GUICtrlSetBkColor($dark, $COLOR_BLACK)
    GUICtrlSetBkColor($light, 0xDFEEFC)
    GUICtrlSetBkColor($font, FileReadLine($file,2))

    GUICtrlSetColor($Edit,FileReadLine($file,1))

    GUICtrlSetColor($dark, 0x00FF00)

    GUICtrlSetColor($Open, FileReadLine($file,3))
    GUICtrlSetColor($Save, FileReadLine($file,3))
    GUICtrlSetColor($About,FileReadLine($file,3))
    GUICtrlSetColor($New,FileReadLine($file,3))
    GUICtrlSetColor($lab, FileReadLine($file,3))
    GUICtrlSetColor($lab2, FileReadLine($file,3))
    GUICtrlSetColor($font,FileReadLine($file,3))

    GUICtrlSetFont($Edit,FileReadLine($file,8),FileReadLine($file,10),FileReadLine($file,9),FileReadLine($file,7))
    GUICtrlSetFont($Open,10, 600, "Arial")
    GUICtrlSetFont($Save, 10, 600,  "Arial")
    GUICtrlSetFont($About, 10, 600, "Arial")
    GUICtrlSetFont($New, 10, 600, "Arial")
    GUICtrlSetFont($lab, 10, 600, "Arial")
    GUICtrlSetFont($lab2, 9, 600,4, "Arial")
    GUICtrlSetFont($dark, 10, 600,"Arial")
    GUICtrlSetFont($light, 10,600,"Arial")
    GUICtrlSetFont($font, 10,600,"Arial")
    GUISetState(@SW_SHOW )
    While 1
        $msg = GUIGetMsg()
        Select
;Window Close Button
         Case $msg = $GUI_EVENT_CLOSE
            if NOT(_GUICtrlEdit_GetText($Edit)==$get) Then                            ;if what is written , is not saved and user wants to quit.
               $ch=MsgBox(3,"Attention"," Would you like to Save Changes to the Current Document before Exiting?.")

               if $ch=6 Then                                                        ;yes button
                  If $flag1==-2 then                                                ;if file has not been saved even once
                     $saf = FileSaveDialog($msg1, @DesktopDir, "Text (*.txt)|All Files (*.*)",BitOR(2,16),"Untitled.txt")
                     if NOT($saf=="") Then                                            ;checks if file name has been specified or not
                        $split = _PathSplit($saf, $sDrive, $sDir, $sFilename, $sExtension)
                        if $split[4] = "" Then                                        ; if extension not specified
                           $saf=$saf&".txt"
                           _FileCreate($saf)
                           $fopen2=FileOpen($saf,$FO_OVERWRITE)

                        Else                                                        ;Exension has been specified
                           _FileCreate($saf)
                           $fopen2=FileOpen($saf,$FO_OVERWRITE)

                        EndIf
                        $get=_GUICtrlEdit_GetText($Edit)
                        FileWrite($fopen2,$get)
                        GUIDelete()
                        Exit
                     Endif

                  Else                                                                ;if file has been saved at least once
                     $get=_GUICtrlEdit_GetText($Edit)
                     FileClose($fopen2)
                     $fopen2=FileOpen($saf,$FO_OVERWRITE)
                     FileWrite($fopen2,$get)
                  EndIf

               Elseif $ch=7 Then                                                    ;No button
                  GUIDelete()
                  Exit
               EndIf

            Else                                                                    ;if no modification has been made after saving and user wants to quit
               GUIDelete()
               Exit
            EndIf
;Save Button
         Case $msg = $Save

            IF $flag1==-1 Then                                                        ;if file has been saved at least once
               $get=_GUICtrlEdit_GetText($Edit)
               if $fopen1 Then                                                        ;if file has already been opened
                  FileClose($fopen1)
                  $name=$opf1
               Else                                                                    ;if file has already been saved
                  $name=$saf
               EndIf
               $fopen1=FileOpen($name,$FO_OVERWRITE)
               FileWrite($fopen1,$get)
            EndIf

            if $flag1==-2 Then                                                        ;if file has not been saved even once
               $saf = FileSaveDialog($msg1, @DesktopDir, "Text (*.txt)|All Files (*.*)",BitOR(2,16))
               if NOT($saf=="") Then                                                ;checks if file name has been specified or not
                  $split = _PathSplit($saf, $sDrive, $sDir, $sFilename, $sExtension)
                  if $split[4] = "" Then                                            ;if extension is not specified
                     $saf=$saf&".txt"
                     GUICtrlSetData($lab," FILE_NAME : "&$split[3]&".txt")
                     _FileCreate($saf)
                     $fopen2=FileOpen($saf,$FO_OVERWRITE)
                  Else                                                                ;if extension has been specified
                     _FileCreate($saf)
                     GUICtrlSetData($lab," FILE_NAME : "&$split[3]&$split[4])
                     $fopen2=FileOpen($saf,$FO_OVERWRITE)
                  EndIf
                  $flag1=-1
                  $flag2=-1
                  $get=_GUICtrlEdit_GetText($Edit)
                  FileWrite($fopen2,$get)
               EndIf
            EndIf
;open button

         Case $msg = $Open
            if NOT(_GUICtrlEdit_GetText($Edit)==$get) Then                            ;if what is written , is not saved and user wants to open another file.
               $ch=MsgBox(3,"Attention"," Would you like to Save Changes to the Current Document?.")

               if $ch=6 Then                                                        ;Yes button
                  If $flag1==-2 then                                                ;if file has not been saved even once
                     $saf = FileSaveDialog($msg1, @DesktopDir, "Text (*.txt)|All Files (*.*)",BitOR(2,16),"Untitled.txt" )
                     if NOT($saf=="") Then                                            ;checks if file name has been specified or not
                        $split = _PathSplit($saf, $sDrive, $sDir, $sFilename, $sExtension)
                        if $split[4] = "" Then                                        ;if extension not specified
                           $saf=$saf&".txt"
                           _FileCreate($saf)
                           $fopen2=FileOpen($saf,$FO_OVERWRITE)
                        Else                                                        ;if extension has been specified
                           _FileCreate($saf)
                           $fopen2=FileOpen($saf,$FO_OVERWRITE)
                        EndIf
                        $get=_GUICtrlEdit_GetText($Edit)
                        FileWrite($fopen2,$get)
                        $opf1=FileOpenDialog($msg2, @DesktopDir& "\", "Text files (*.txt)|All Files (*.*)", $FD_FILEMUSTEXIST)
                        if NOT($opf1=="") Then                                        ;checks if file name has been specified or not
                           $split = _PathSplit($opf1, $sDrive, $sDir, $sFilename, $sExtension)
                           GUICtrlSetData($lab," FILE_NAME : "&$split[3]&$split[4])
                           $fopen1 = FileOpen($opf1, $FO_READ)
                           $fread = FileRead($fopen1)
                           _GUICtrlEdit_SetText($Edit, $fread)
                           $flag1=-1
                           $flag2=-1
                        Endif
                     Endif
                  Else                                                                ;if file has been saved at least once
                     $get=_GUICtrlEdit_GetText($Edit)
                     FileClose($fopen2)
                     $fopen2=FileOpen($saf,$FO_OVERWRITE)
                     FileWrite($fopen2,$get)
                     $opf1=FileOpenDialog($msg2, @DesktopDir& "\", "Text files (*.txt)|All Files (*.*)", $FD_FILEMUSTEXIST)
                        if NOT($opf1=="") Then                                        ;checks if file name has been specified or not
                           $fopen1 = FileOpen($opf1, $FO_READ)
                           $split = _PathSplit($opf1, $sDrive, $sDir, $sFilename, $sExtension)
                           GUICtrlSetData($lab," FILE_NAME : "&$split[3]&$split[4])
                           $fread = FileRead($fopen1)
                           _GUICtrlEdit_SetText($Edit, $fread)
                        Endif
                  Endif
               Elseif $ch=7 Then                                                    ;no button
                  $opf1=FileOpenDialog($msg2, @DesktopDir& "\", "Text files (*.txt)|All Files (*.*)", $FD_FILEMUSTEXIST)
                  if NOT($opf1=="") Then                                            ;checks if file name has been specified or not
                     $fopen1 = FileOpen($opf1, $FO_READ)
                     $fread = FileRead($fopen1)
                     $split = _PathSplit($opf1, $sDrive, $sDir, $sFilename, $sExtension)
                     GUICtrlSetData($lab," FILE_NAME : "&$split[3]&$split[4])
                     _GUICtrlEdit_SetText($Edit, $fread)
                     $flag1=-1
                     $flag2=-1
                  EndIf
               EndIf

            Else                                                                    ;If no modification  has been made and user wants to open a new file
               $opf1=FileOpenDialog($msg2, @DesktopDir& "\", "Text files (*.txt)|All Files (*.*)", $FD_FILEMUSTEXIST)
               if NOT($opf1=="") Then                                                ;checks if file name has been specified or not
                  $flag2=-1
                  $flag1=-1
                  $split = _PathSplit($opf1, $sDrive, $sDir, $sFilename, $sExtension)
                  GUICtrlSetData($lab," FILE_NAME : "&$split[3]&$split[4])
                  $fopen1 = FileOpen($opf1, $FO_READ)
                  $fread = FileRead($fopen1)
                  _GUICtrlEdit_SetText($Edit, $fread)
                  $get=_GUICtrlEdit_GetText($Edit)
               EndIf
           EndIf
;about button

         Case $msg = $About
            MsgBox(0, "About Xtreme Note", "Xtreme Note v1.0" & @CRLF & "Copyright 2014" & @CRLF & "Created By Xtreme Labs"& @CRLF & "Xtreme Note is Created by Kuntal Das,Xtreme Labs, Team SDK.")
;new button

         Case $msg = $New
            if NOT(_GUICtrlEdit_GetText($Edit)==$get) Then
               $ch=MsgBox(3,"Attention"," Would you like to Save Changes to the Current Document?.")

               if $ch=6 Then                                                        ;yes button
                  If $flag1==-2 then                                                ;if file has not been saved even once
                     $saf = FileSaveDialog($msg1, @DesktopDir, "Text (*.txt)|All Files (*.*)",BitOR(2,16),"Untitled.txt" )
                     if NOT($saf=="") Then                                            ;checks if file name has been specified or not
                        $split = _PathSplit($saf, $sDrive, $sDir, $sFilename, $sExtension)
                        if $split[4] = "" Then                                        ;if extension not specified
                           $saf=$saf&".txt"
                           _FileCreate($saf)
                           $fopen2=FileOpen($saf,$FO_OVERWRITE)
                        Else                                                        ;if extension has been specified
                           _FileCreate($saf)
                           $fopen2=FileOpen($saf,$FO_OVERWRITE)
                        EndIf
                        $get=_GUICtrlEdit_GetText($Edit)
                        FileWrite($fopen2,$get)
                        _GUICtrlEdit_SetText($Edit, "")
                        GUICtrlSetData($lab," FILE_NAME : "&"Untitled.txt")
                        $flag1=-2
                        $flag2=-2
                        $opf1=""
                        $saf=""
                        $fopen1=""
                        $fopen2=""
                        $get=""
                     Endif
                  Else                                                                ;if file has been saved at least once
                     $get=_GUICtrlEdit_GetText($Edit)
                     FileClose($fopen2)
                     $fopen2=FileOpen($saf,$FO_OVERWRITE)
                     FileWrite($fopen2,$get)
                        _GUICtrlEdit_SetText($Edit, "")
                        GUICtrlSetData($lab," FILE_NAME : "&"Untitled.txt")
                        $flag1=-2
                        $flag2=-2
                        $opf1=""
                        $saf=""
                        $fopen1=""
                        $fopen2=""
                        $get=""
                  Endif
               Elseif $ch=7 Then                                                    ;no button
                        _GUICtrlEdit_SetText($Edit, "")
                        GUICtrlSetData($lab," FILE_NAME : "&"Untitled.txt")
                        $flag1=-2
                        $flag2=-2
                        $opf1=""
                        $saf=""
                        $fopen1=""
                        $fopen2=""
                        $get=""
               EndIf
            Else                                                                    ;if no modifications has been done
               _GUICtrlEdit_SetText($Edit, "")
               GUICtrlSetData($lab," FILE_NAME : "&"Untitled.txt")
               $flag1=-2
               $flag2=-2
               $opf1=""
               $saf=""
               $fopen1=""
               $fopen2=""
               $get=""
            Endif
         Case $msg= $dark
            GUISetBkColor($COLOR_BLACK)

            GUICtrlSetBkColor($Edit, $COLOR_BLACK)
            GUICtrlSetBkColor($Open, $COLOR_BLACK)
            GUICtrlSetBkColor($Save, $COLOR_BLACK)
            GUICtrlSetBkColor($About, $COLOR_BLACK)
            GUICtrlSetBkColor($New, $COLOR_BLACK)
            GUICtrlSetBkColor($font, $COLOR_BLACK)

            GUICtrlSetColor($Edit, 0x00FF00)
            _FileWriteToLine(@ScriptDir&"\settings.xns", 1,"0x00FF00", 1)


            GUICtrlSetColor($Open, 0x00FF00)
            GUICtrlSetColor($Save, 0x00FF00)
            GUICtrlSetColor($About, 0x00FF00)
            GUICtrlSetColor($New, 0x00FF00)
            GUICtrlSetColor($lab, 0x00FF00)
            GUICtrlSetColor($lab2, 0x00FF00)
            GUICtrlSetColor($font, 0x00FF00)

            _FileWriteToLine(@ScriptDir&"\settings.xns", 2,"0x000000", 1)
            _FileWriteToLine(@ScriptDir&"\settings.xns", 3,"0x00FF00", 1)
            _FileWriteToLine(@ScriptDir&"\settings.xns", 4,"0x000000", 1)
            _FileWriteToLine(@ScriptDir&"\settings.xns", 5,"0x000000", 1)

         Case $msg=$light
            GUISetBkColor(0xF0F0F0)

            GUICtrlSetBkColor($Edit,  0xFFFFFF)
            GUICtrlSetBkColor($Open, 0xDFEEFC)
            GUICtrlSetBkColor($Save, 0xDFEEFC)
            GUICtrlSetBkColor($About,0xDFEEFC)
            GUICtrlSetBkColor($New, 0xDFEEFC)
            GUICtrlSetBkColor($font, 0xDFEEFC)

            GUICtrlSetColor($Edit, $COLOR_BLACK)
            _FileWriteToLine(@ScriptDir&"\settings.xns", 1,"0x000000", 1)

            GUICtrlSetColor($Open, $COLOR_BLACK)
            GUICtrlSetColor($Save, $COLOR_BLACK)
            GUICtrlSetColor($About,$COLOR_BLACK)
            GUICtrlSetColor($New, $COLOR_BLACK)
            GUICtrlSetColor($lab, $COLOR_BLACK)
            GUICtrlSetColor($lab2, $COLOR_BLACK)
            GUICtrlSetColor($font, $COLOR_BLACK)

            _FileWriteToLine(@ScriptDir&"\settings.xns", 2,"0xDFEEFC", 1)
            _FileWriteToLine(@ScriptDir&"\settings.xns", 3,"0x000000", 1)
            _FileWriteToLine(@ScriptDir&"\settings.xns", 4,"0xFFFFFF", 1)
            _FileWriteToLine(@ScriptDir&"\settings.xns", 5,"0xF0F0F0", 1)

         Case $msg=$font
            $fd = _ChooseFont(FileReadLine($file,7),FileReadLine($file,8),FileReadLine($file,1),FileReadLine($file,10),FileReadLine($file,9))
            If NOT @error Then
               $fn=-1
               GUICtrlSetFont($Edit,$fd[3],$fd[1],$fd[4],$fd[2])
               GUICtrlSetColor($Edit, $fd[7])
               _FileWriteToLine(@ScriptDir&"\settings.xns", 1,$fd[7], 1)
               _FileWriteToLine(@ScriptDir&"\settings.xns", 6,$fn, 1)
               _FileWriteToLine(@ScriptDir&"\settings.xns", 7,$fd[2], 1)
               _FileWriteToLine(@ScriptDir&"\settings.xns", 8,$fd[3], 1)
               _FileWriteToLine(@ScriptDir&"\settings.xns", 9,$fd[1], 1)
               _FileWriteToLine(@ScriptDir&"\settings.xns", 10,$fd[4],1)
            EndIf

      EndSelect
    WEnd
 EndFunc

 

Share this post


Link to post
Share on other sites
Xkdash

Here is the code...

notepad.au3

Edited by Xkdash
Forgot to mention the purpose..

Share this post


Link to post
Share on other sites
JLogan3o13

What happens if you go through Control Panel>>Default Programs>>Associate File Type with a Program?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Xkdash

I want a simple text file to run by double clicking on it. It should automatically open the editor and that too in edit mode.

 

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

    • rm4453
      By rm4453
      I have a problem with my code where the File Open keeps opening itself... This gui is not fully functional. I am trying to allow the user to select an image for each of the image buttons, when they do all I want to grab is the full file path ex: C:\windows\user\username\images\image.jpg to a variable. "I am just diving into guis myself and have used Koda for most of this form generation. The custom code I have either written myself " most of it " or got help for it on here or the help files. I have searched for at least an hour now and can't seem to figure out what is causing the infinite loop where the file open box continually opens... I am sure its something simple like changing the state of the button that was clicked back to not clicked however I can't figure out how to do that or if that is even the answer... Here is all of the code I can share "This is an NDA project so I will have to take some parts out that are non pertinent etc...."  (ANY * are edits to protect the NDA any missing lines are as well.... :D)
      #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <***Login.au3> $section = "Test" $Item_Wanted = "false" $For_Sale = "true" $Business_Listing = "false" $Private_Listing = "true" $Posts = 0 $Submit = 0 $SaveListingSettings = 0 $Image1_Description = 0 $Image2_Description = 0 $Image3_Description = 0 $Image4_Description = 0 $Image5_Description = 0 $Image6_Description = 0 $Description1 = 0 $Description2 = 0 $Description3 = 0 $Description4 = 0 $Image1_Pressed = 0 ; AutoItSetOption ("GUIOnEventMode", 1) Func ReadIni() ;Login Info Global $Email_ini = IniRead("Settings.ini", $section, "Email", "Email") Global $Password_ini = IniRead("Settings.ini", $section, "Password", "Password") ;Listing Info Global $Price_ini = IniRead("Settings.ini", $section, "Price", "0") Global $Title_ini = IniRead("Settings.ini", $section, "Title", "Title Example") ;Listing Type Global $For_Sale_ini = IniRead("Settings.ini", $section, "For_Sale", "True") Global $Item_Wanted_ini = IniRead("Settings.ini", $section, "Item_Wanted", "False") If $For_Sale_ini = "false" Then GUICtrlSetState($Item_Wanted, 1) Else If $For_Sale_ini = "true" Then GUICtrlSetState($For_Sale, 1) EndIf EndIf ;Business Or Private Global $Business_Listing_ini = IniRead("Settings.ini", $section, "Business_Listing", "False") Global $Private_Listing_ini = IniRead("Settings.ini", $section, "Private_Listing", "True") If $Private_Listing_ini = "false" Then GUICtrlSetState($Business_Listing, 1) Else If $Private_Listing_ini = "true" Then GUICtrlSetState($Private_Listing, 1) EndIf EndIf ;Image FilePaths and Descriptions Global $Image1_ini = IniRead("Settings.ini", $section, "Image1", "C:\image1.jpg") Global $Image1_Description_ini = IniRead("Settings.ini", $section, "Image1_Description", "Default Descrip") Global $Image2_ini = IniRead("Settings.ini", $section, "Image2", "C:\image2.jpg") Global $Image2_Description_ini = IniRead("Settings.ini", $section, "Image2_Description", "Default Descrip") Global $Image3_ini = IniRead("Settings.ini", $section, "Image3", "C:\image3.jpg") Global $Image3_Description_ini = IniRead("Settings.ini", $section, "Image3_Description", "Default Descrip") Global $Image4_ini = IniRead("Settings.ini", $section, "Image4", "C:\image4.jpg") Global $Image4_Description_ini = IniRead("Settings.ini", $section, "Image4_Description", "Default Descrip") Global $Image5_ini = IniRead("Settings.ini", $section, "Image5", "C:\image5.jpg") Global $Image5_Description_ini = IniRead("Settings.ini", $section, "Image5_Description", "Default Descrip") Global $Image6_ini = IniRead("Settings.ini", $section, "Image6", "C:\image6.jpg") Global $Image6_Description_ini = IniRead("Settings.ini", $section, "Image6_Description", "Default Descrip") ;Listing Descriptions Global $Description1_ini = IniRead("Settings.ini", $section, "Description1", "Default Descrip") Global $Description2_ini = IniRead("Settings.ini", $section, "Description2", "Default Descrip") Global $Description3_ini = IniRead("Settings.ini", $section, "Description3", "Default Descrip") Global $Description4_ini = IniRead("Settings.ini", $section, "Description4", "Default Descrip") ;Contact Info Global $Phone1_ini = IniRead("Settings.ini", $section, "Phone1", "888") Global $Phone2_ini = IniRead("Settings.ini", $section, "Phone2", "999") Global $Phone3_ini = IniRead("Settings.ini", $section, "Phone3", "9090") Global $Address_ini = IniRead("Settings.ini", $section, "Address", "491 S 231 E") Global $City_ini = IniRead("Settings.ini", $section, "City", "Sandy") Global $State_ini = IniRead("Settings.ini", $section, "State", "WA") Global $Zip_ini = IniRead("Settings.ini", $section, "Zip", "84119") ;Post Interval in Minutes Global $Post_Interval_In_Minutes_ini = IniRead("Settings.ini", $section, "Post_Interval_In_Minutes", "10") EndFunc Func Gui() $***AutoPoster = GUICreate("*** Auto Poster", 615, 437, 340, 172) $LoginInfo = GUICtrlCreateGroup("Login Info", 8, 8, 177, 113) $Submit = GUICtrlCreateButton("Submit", 58, 84, 75, 25) GUICtrlSetTip(-1, "Verify Login Information") Global $Email = GUICtrlCreateInput($Email_ini, 23, 31, 145, 21) GUICtrlSetTip(-1, "*** Email") Global $Password = GUICtrlCreateInput($Password_ini, 23, 57, 145, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD)) GUICtrlSetTip(-1, "*** Password") GUICtrlCreateGroup("", -99, -99, 1, 1) Global $ListingInfo = GUICtrlCreateGroup("Listing Info", 200, 8, 401, 417) Global $Price = GUICtrlCreateInput($Price_ini, 232, 40, 137, 21) GUICtrlSetTip(-1, "Asking Price For Listing") Global $Title = GUICtrlCreateInput($Title_ini, 232, 72, 137, 21) GUICtrlSetTip(-1, "Title Of Listing") Global $ListingType = GUICtrlCreateGroup("Listing Type", 376, 24, 193, 81) Global $For_Sale = GUICtrlCreateRadio("For Sale", 384, 39, 193, 21) GUICtrlSetTip(-1, "Is Item For Sale") Global $Item_Wanted = GUICtrlCreateRadio("Item Wanted", 384, 71, 193, 21) GUICtrlSetTip(-1, "Are You Looking For Item") GUICtrlCreateGroup("", -99, -99, 1, 1) Global $Business_or_Private = GUICtrlCreateGroup("Business or Private", 232, 112, 337, 65) Global $Business_Listing = GUICtrlCreateRadio("Business Listing", 248, 136, 137, 25) GUICtrlSetTip(-1, "Is This A Business Listing") Global $Private_Listing = GUICtrlCreateRadio("Private Listing", 408, 136, 137, 25) GUICtrlSetTip(-1, "Is This A Private Listing") GUICtrlCreateGroup("", -99, -99, 1, 1) Global $ContactInfo = GUICtrlCreateGroup("Contact Info", 232, 312, 337, 73) Global $Phone1 = GUICtrlCreateInput($Phone1_ini, 237, 330, 33, 21) GUICtrlSetTip(-1, "Phone Number Area Code") Global $Phone3 = GUICtrlCreateInput($Phone3_ini, 317, 330, 33, 21) GUICtrlSetTip(-1, "Last 4 Numbers Of Phone Number") Global $Phone2 = GUICtrlCreateInput($Phone2_ini, 277, 330, 33, 21) GUICtrlSetTip(-1, "First 3 Numbers Of Phone Number") Global $Address = GUICtrlCreateInput($Address_ini, 360, 328, 201, 21) GUICtrlSetTip(-1, "Address For Listing") Global $City = GUICtrlCreateInput($City_ini, 360, 352, 49, 21) GUICtrlSetTip(-1, "City For Listing") Global $State = GUICtrlCreateInput($State_ini, 416, 352, 97, 21) GUICtrlSetTip(-1, "State For Listing (Only Use Abrieviations)") Global $Zip = GUICtrlCreateInput($Zip_ini, 520, 352, 41, 21) GUICtrlSetTip(-1, "Zip Code For Listing") GUICtrlCreateGroup("", -99, -99, 1, 1) Global $SaveListingSettings = GUICtrlCreateButton("Save Listing Settings", 456, 392, 114, 25) GUICtrlSetTip(-1, "Save Listing Settings") Global $Post_Interval_In_Minutes = GUICtrlCreateInput($Post_Interval_In_Minutes_ini, 232, 392, 209, 21) GUICtrlSetTip(-1, "How Often Program Should Auto Post (Will Be Randomized Somewhat For Validity)") Global $Description1_Button = GUICtrlCreateButton($Description1_ini, 232, 189, 145, 49) Global $Description2_Button = GUICtrlCreateButton($Description2_ini, 426, 189, 145, 49) Global $Description3_Button = GUICtrlCreateButton($Description3_ini, 232, 252, 145, 49) Global $Description4_Button = GUICtrlCreateButton($Description4_ini, 426, 252, 145, 49) GUICtrlCreateGroup("", -99, -99, 1, 1) Global $Select_Images = GUICtrlCreateGroup("Select Images", 8, 136, 177, 89) Global $Image1 = GUICtrlCreateButton($Image1_ini, 16, 160, 41, 25) Global $Image2 = GUICtrlCreateButton($Image2_ini, 69, 160, 41, 25) Global $Image3 = GUICtrlCreateButton($Image3_ini, 128, 160, 41, 25) Global $Image4 = GUICtrlCreateButton($Image4_ini, 17, 192, 41, 25) Global $Image5 = GUICtrlCreateButton($Image5_ini, 69, 192, 41, 25) Global $Image6 = GUICtrlCreateButton($Image6_ini, 129, 192, 41, 25) GUICtrlCreateGroup("", -99, -99, 1, 1) Global $PostCounter = GUICtrlCreateGroup("Post Counter", 8, 240, 177, 65) Global $TotalPosts = GUICtrlCreateLabel("Total Posts", 32, 267, 57, 18) Global $PostCount = GUICtrlCreateLabel($Posts, 104, 267, 50, 18) GUICtrlCreateGroup("", -99, -99, 1, 1) Global $ListingSelection = GUICtrlCreateGroup("Listing Selection", 8, 312, 177, 113) Global $SelectListing = GUICtrlCreateButton("Select Listing", 24, 336, 145, 33) Global $BeginSubmission = GUICtrlCreateButton("Begin Submission", 24, 376, 145, 33) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) EndFunc Func OpenImages() $message = "Please Find and Select Your Image." $var = FileOpenDialog($message, @WindowsDir & "\", "Images (*.jpg;*.gif)") FileChangeDir(@ScriptDir) Global $imagePath = $var ;$filepathmsg = MsgBox("Path","Here is File Path", $imagePath) EndFunc $Save_Section = 1 Func SaveIni() IniWrite ( "Settings.ini", $Save_Section, "Email", GUICtrlRead($Email)) IniWrite ( "Settings.ini", $Save_Section, "Password", GUICtrlRead($Password)) IniWrite ( "Settings.ini", $Save_Section, "Price", GUICtrlRead($Price)) IniWrite ( "Settings.ini", $Save_Section, "Title", GUICtrlRead($Title)) IniWrite ( "Settings.ini", $Save_Section, "For_Sale", GUICtrlRead($For_Sale)) IniWrite ( "Settings.ini", $Save_Section, "Item_Wanted", GUICtrlRead($Item_Wanted)) IniWrite ( "Settings.ini", $Save_Section, "Business_Listing", GUICtrlRead($Business_Listing)) IniWrite ( "Settings.ini", $Save_Section, "Private_Listing", GUICtrlRead($Private_Listing)) IniWrite ( "Settings.ini", $Save_Section, "Image1", GUICtrlRead($Image1)) IniWrite ( "Settings.ini", $Save_Section, "Image1_Description", GUICtrlRead($Image1_Description)) IniWrite ( "Settings.ini", $Save_Section, "Image2", GUICtrlRead($Image2)) IniWrite ( "Settings.ini", $Save_Section, "Image2_Description", GUICtrlRead($Image2_Description)) IniWrite ( "Settings.ini", $Save_Section, "Image3", GUICtrlRead($Image3)) IniWrite ( "Settings.ini", $Save_Section, "Image3_Description", GUICtrlRead($Image3_Description)) IniWrite ( "Settings.ini", $Save_Section, "Image4", GUICtrlRead($Image4)) IniWrite ( "Settings.ini", $Save_Section, "Image4_Description", GUICtrlRead($Image4_Description)) IniWrite ( "Settings.ini", $Save_Section, "Image5", GUICtrlRead($Image5)) IniWrite ( "Settings.ini", $Save_Section, "Image5_Description", GUICtrlRead($Image5_Description)) IniWrite ( "Settings.ini", $Save_Section, "Image6", GUICtrlRead($Image6)) IniWrite ( "Settings.ini", $Save_Section, "Image6_Description", GUICtrlRead($Image6_Description)) IniWrite ( "Settings.ini", $Save_Section, "Description1", GUICtrlRead($Description1)) IniWrite ( "Settings.ini", $Save_Section, "Description2", GUICtrlRead($Description2)) IniWrite ( "Settings.ini", $Save_Section, "Description3", GUICtrlRead($Description3)) IniWrite ( "Settings.ini", $Save_Section, "Description4", GUICtrlRead($Description4)) IniWrite ( "Settings.ini", $Save_Section, "Phone1", GUICtrlRead($Phone1)) IniWrite ( "Settings.ini", $Save_Section, "Phone2", GUICtrlRead($Phone2)) IniWrite ( "Settings.ini", $Save_Section, "Phone3", GUICtrlRead($Phone3)) IniWrite ( "Settings.ini", $Save_Section, "Address", GUICtrlRead($Address)) IniWrite ( "Settings.ini", $Save_Section, "City", GUICtrlRead($City)) IniWrite ( "Settings.ini", $Save_Section, "State", GUICtrlRead($State)) IniWrite ( "Settings.ini", $Save_Section, "Zip", GUICtrlRead($Zip)) IniWrite ( "Settings.ini", $Save_Section, "Post_Interval_In_Minutes", GUICtrlRead($Post_Interval_In_Minutes)) EndFunc $GuiOpened = 1 $im = 1 While 1 = 1 If $GuiOpened = 1 Then ReadIni() Gui() ReadIni() $GuiOpened = 2 EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Submit $email = $Email_ini $pass = $Password_ini Login() Case $SaveListingSettings $Save_Section = InputBox("Listing Name", "Please Type The Name For Your Listing", "EXAMPLE: Blue Blanket") SaveIni() Case $Image1 OpenImages() Global $Image1 = $imagePath Global $Image1_Description = GUICtrlCreateEdit("Image Description", 615, 437, 50, 40) EndSwitch WEnd  
×