Jump to content

Close not working


Recommended Posts

ok... my cross button (close button)and the minimize button don't work...can anyone get this is work...the minimize button (when clicked) needs to make the GUI go into the icon thing next to clock...

can u add the thing needed to the script below:

CODE
#include <GUIConstants.au3>

HotKeySet("{F1}", "F1")

HotKeySet("{F2}", "F2")

HotKeySet("{F3}", "F3")

HotKeySet("{F4}", "F4")

HotKeySet("{F5}", "F5")

HotKeySet("{F6}", "F6")

HotKeySet("{F7}", "F7")

HotKeySet("{F8}", "F8")

HotKeySet("{F9}", "F9")

HotKeySet("{F10}", "F10")

HotKeySet("{F11}", "F11")

HotKeySet("{F12}", "F12")

GUICreate("Autotyper Basic- By Jag3xm4n",500,363)

GUICtrlCreateLabel("F1",5,10)

GUICtrlCreateLabel("F2",5,35)

GUICtrlCreateLabel("F3",5,60)

GUICtrlCreateLabel("F4",5,85)

GUICtrlCreateLabel("F5",5,110)

GUICtrlCreateLabel("F6",5,135)

GUICtrlCreateLabel("F7",5,160)

GUICtrlCreateLabel("F8",5,185)

GUICtrlCreateLabel("F9",5,210)

GUICtrlCreateLabel("F10",5,235)

GUICtrlCreateLabel("F11",5,260)

GUICtrlCreateLabel("F12",5,285)

GUICtrlCreateLabel("This Autotalker was made by 'Jag3xm4n'... you may use this for free... 'BUT' we ask you not to upload",5,313)

GUICtrlCreateLabel("this to ANY sites.. just put a link to US!!!", 5, 326)

GUICtrlCreateLabel("HOW TO USE",325,10)

GUICtrlCreateLabel("STEP 1:",338,35)

GUICtrlCreateLabel("Type in the text you want...",300,60)

GUICtrlCreateLabel("STEP 2:",338,85)

GUICtrlCreateLabel("Then go on to 'Runescape'",300,110)

GUICtrlCreateLabel("And press the corret 'F' key",300,135)

GUICtrlCreateLabel("This will autotype for you",300,160)

GUICtrlCreateLabel("ENJOY",338,185)

$MenuItem2 = GUICtrlCreateMenu("File")

$MenuItem4 = GUICtrlCreateMenuItem("Save (CTRL + S", $MenuItem2)

$MenuItem3 = GUICtrlCreateMenuItem("EXIT", $MenuItem2)

$MenuItem1 = GUICtrlCreateMenu("Other")

$MenuItem5 = GUICtrlCreateMenuItem("About", $MenuItem1)

$MenuItem6 = GUICtrlCreateMenuItem("Version", $MenuItem1)

$input1 = GUICtrlCreateInput("",25,10)

$input2 = GUICtrlCreateInput("",25,35)

$input3 = GUICtrlCreateInput("",25,60)

$input4 = GUICtrlCreateInput("",25,85)

$input5 = GUICtrlCreateInput("",25,110)

$input6 = GUICtrlCreateInput("",25,135)

$input7 = GUICtrlCreateInput("",25,160)

$input8 = GUICtrlCreateInput("",25,185)

$input9 = GUICtrlCreateInput("",25,210)

$input10 = GUICtrlCreateInput("",25,235)

$input11 = GUICtrlCreateInput("",25,260)

$input12 = GUICtrlCreateInput("",25,285)

GUISetState()

Func F1()

$inputread1 = GUICtrlRead($input1)

Send($inputread1)

Send("{ENTER}")

EndFunc

Func F2()

$inputread2 = GUICtrlRead($input2)

Send($inputread2)

Send("{ENTER}")

EndFunc

Func F3()

$inputread3 = GUICtrlRead($input3)

Send($inputread3)

Send("{ENTER}")

EndFunc

Func F4()

$inputread4 = GUICtrlRead($input4)

Send($inputread4)

Send("{ENTER}")

EndFunc

Func F5()

$inputread5 = GUICtrlRead($input5)

Send($inputread5)

Send("{ENTER}")

EndFunc

Func F6()

$inputread6 = GUICtrlRead($input6)

Send($inputread6)

Send("{ENTER}")

EndFunc

Func F7()

$inputread7 = GUICtrlRead($input7)

Send($inputread7)

Send("{ENTER}")

EndFunc

Func F8()

$inputread8 = GUICtrlRead($input8)

Send($inputread8)

Send("{ENTER}")

EndFunc

Func F9()

$inputread9 = GUICtrlRead($input9)

Send($inputread9)

Send("{ENTER}")

EndFunc

Func F10()

$inputread10 = GUICtrlRead($input10)

Send($inputread10)

Send("{ENTER}")

EndFunc

Func F11()

$inputread11 = GUICtrlRead($input11)

Send($inputread11)

Send("{ENTER}")

EndFunc

Func F12()

$inputread12 = GUICtrlRead($input12)

Send($inputread12)

Send("{ENTER}")

EndFunc

While 1

Sleep(10)

Wend

plz help thanks :shocked:

Ok im 14 with a spelling age of a 9 year old... that explanes all my spelling mistakes

Link to comment
Share on other sites

I think you need to read a little more from the AutoIt help file and check out some other scripts in the autoit forums.

You'll pick up a lot of helpfull info by doing so and a better comprehension of how the gui side of autoit works..

With that said here you go , maybe this will help a little , maybe not.. lol

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1) ; Added this since it looks like you using on event mode for your GUI
Opt("TrayMenuMode", 1) ;Added this to only show Autotalker tray menu options
Opt("TrayOnEventMode", 1) ;Added this for tray menu to work on event as well

TraySetClick(16) ; Set tray menu to show when right mouse click

Global $input[13], $Hide[1], $SettingsPath[1],  $label[13] ; Just some arrays for storing settings etc

HotKeySet("^s", "Save") ; This is to call save settings function
HotKeySet("^l", "Load") ; This is to call load settings function
HotKeySet("^h", "Hide") ; This is to call hide function, toggles hide or show gui
HotKeySet("!{ESC}", "Close") ; This is to call close function, this way a user can exit autotalker even if the gui is hidden
HotKeySet("{F1}", "F1")
HotKeySet("{F2}", "F2")
HotKeySet("{F3}", "F3")
HotKeySet("{F4}", "F4")
HotKeySet("{F5}", "F5")
HotKeySet("{F6}", "F6")
HotKeySet("{F7}", "F7")
HotKeySet("{F8}", "F8")
HotKeySet("{F9}", "F9")
HotKeySet("{F10}", "F10")
HotKeySet("{F11}", "F11")
HotKeySet("{F12}", "F12")

$Main = GUICreate("Autotyper Basic- By Jag3xm4n",500,363) ;Put your main window in a variable so you can use it on an event.
WinSetOnTop("Autotyper Basic- By Jag3xm4n","",1)

;---- Gui Labels
GUICtrlCreateLabel("HOW TO USE" & @CRLF & @CRLF & "STEP 1:" & @CRLF & @CRLF & "Type in the text you want..." & _
                    @CRLF & @CRLF & "STEP 2:" & @CRLF & @CRLF & "Then go on to 'Runescape'" & @CRLF & @CRLF & _
                    "And press the corret 'F' key" & @CRLF & @CRLF & "This will autotype for you" & @CRLF & _
                    @CRLF & "ENJOY",300,50,150,280,$SS_CENTER)
GUICtrlCreateLabel("This Autotalker was made by 'Jag3xm4n'... you may use this for free..." & @CRLF & _
                    "'BUT' we ask you not to upload this to ANY sites.. just put a link to US!!!",5,313,490,50,$SS_CENTER)

For $lbl = 13 To 288 Step 25
    $label[Ceiling($lbl/25)] = GUICtrlCreateLabel('F' & Ceiling($lbl/25), -1, $lbl,20,-1,$SS_CENTER) ;<- This creates the "F" labels
Next

;----- Gui Menu
$MenuItem2 = GUICtrlCreateMenu("File")

$MenuItem7 = GUICtrlCreateMenuItem("Load Settings (CTRL + L)", $MenuItem2) ;Load settings File Menu
GUICtrlSetOnEvent(-1, 'Load') ; Added this so your gui will call load function when a user selects load from the File Menu

$MenuItem4 = GUICtrlCreateMenuItem("Save Settings (CTRL + S)", $MenuItem2)
GUICtrlSetOnEvent(-1, 'Save') ; Added this so your gui will call save function when a user selects save from the File Menu

GUICtrlCreateMenuItem('', $MenuItem2) ; Divider line in menu , cosmetic touch...lol

$MenuItem8 = GUICtrlCreateMenuItem("Hide (CTRL + H)", $MenuItem2)
GUICtrlSetOnEvent(-1, 'Hide') ; Added this so your gui will call hide function when a user selects hide from the File Menu

GUICtrlCreateMenuItem('', $MenuItem2) ; Divider line in menu , cosmetic touch...lol

$MenuItem3 = GUICtrlCreateMenuItem("EXIT (ALT + ESC)", $MenuItem2)
GUICtrlSetOnEvent(-1, 'Close') ; Added this so your gui will call close function when a user selects exit from the File Menu

$MenuItem1 = GUICtrlCreateMenu("Other")
$MenuItem5 = GUICtrlCreateMenuItem("About", $MenuItem1)
GUICtrlSetOnEvent(-1, 'About') ; Added this so your gui will call about function when a user selects about from the File Menu

$MenuItem6 = GUICtrlCreateMenuItem("Version", $MenuItem1)
GUICtrlSetOnEvent(-1, 'Version') ; Added this so your gui will call version function when a user selects version from the File Menu

;---- Gui Input Boxes
For $in = 10 To 285 Step 25
    $input[Ceiling($in/25)] = GUICtrlCreateInput("", 30, $in, 200) ; <- This creates the input boxes
Next

GUISetOnEvent($GUI_EVENT_CLOSE, 'Close') ; Added this so your GUI will call a function to exit
GUISetOnEvent($GUI_EVENT_MINIMIZE, 'Hide') ; Added this so your GUI will call a function to hide gui

GUISetState()

;--- Tray Menu
$HideShow = TrayCreateItem('Hide Autotalker',  -1, 0)
TrayItemSetOnEvent(-1, "Hide")

TrayCreateItem('',  -1, 1) ;Divider line in tray menu , cosmetic touch...lol

$Load = TrayCreateItem('Load Settings',  -1, 2)
TrayItemSetOnEvent(-1, "Load")

$Save = TrayCreateItem('Save Settings',  -1, 3)
TrayItemSetOnEvent(-1, "Save")

TrayCreateItem('',  -1, 4) ;Divider line in tray menu , cosmetic touch...lol

$Close = TrayCreateItem('Exit',  -1, 5)
TrayItemSetOnEvent(-1, "Close")

TraySetState()

StartupLoad() ;Load settings from Autotalker.ini if it exists in the script directory.

While 1
    Sleep(10)
Wend

;~ Func Menu

Func F1() ;Maybe make it so the send function only works if the window it sends to is active, just a suggestion
    If GUICtrlRead($input[1]) <> "" Then
        Send(GUICtrlRead($input[1]))
        Send("{ENTER}")
    EndIf
EndFunc

Func F2()
    If GUICtrlRead($input[2]) <> "" Then
        Send(GUICtrlRead($input[2]))
        Send("{ENTER}")
    EndIf
EndFunc

Func F3()
    If GUICtrlRead($input[3]) <> "" Then
        Send(GUICtrlRead($input[3]))
        Send("{ENTER}")
    EndIf   
EndFunc

Func F4()
    If GUICtrlRead($input[4]) <> "" Then
        Send(GUICtrlRead($input[4]))
        Send("{ENTER}")
    EndIf   
EndFunc

Func F5()
    If GUICtrlRead($input[5]) <> "" Then
        Send(GUICtrlRead($input[5]))
        Send("{ENTER}")
    EndIf
EndFunc

Func F6()
    If GUICtrlRead($input[6]) <> "" Then
        Send(GUICtrlRead($input[6]))
        Send("{ENTER}")
    EndIf
EndFunc

Func F7()
    If GUICtrlRead($input[7]) <> "" Then 
        Send(GUICtrlRead($input[7]))
        Send("{ENTER}")
    EndIf
EndFunc

Func F8()
    If GUICtrlRead($input[8]) <> "" Then 
        Send(GUICtrlRead($input[8]))
        Send("{ENTER}")
    EndIf   
EndFunc

Func F9()
    If GUICtrlRead($input[9]) <> "" Then 
        Send(GUICtrlRead($input[9]))
        Send("{ENTER}")
    EndIf   
EndFunc

Func F10()
    If GUICtrlRead($input[10]) <> "" Then 
        Send(GUICtrlRead($input[10]))
        Send("{ENTER}")
    EndIf
EndFunc

Func F11()
    If GUICtrlRead($input[11]) <> "" Then 
        Send(GUICtrlRead($input[11]))
        Send("{ENTER}")
    EndIf
EndFunc

Func F12() ; F12 will NOT work as a hotkey on it's own as it's reserved by windows, this is documented in the AutoIt help file!
    If GUICtrlRead($input[12]) <> "" Then 
        Send(GUICtrlRead($input[12]))
        Send("{ENTER}")
    EndIf   
EndFunc

Func Hide() ; Toggle hide or show the gui function.
    If $Hide[0] = 1 Then
        GUISetState(@SW_SHOW, $Main)
        If BitAnd(WinGetState("Autotyper Basic- By Jag3xm4n", ""), 16) Then
            WinSetState("Autotyper Basic- By Jag3xm4n", '', @SW_RESTORE)
        EndIf
        WinSetOnTop("Autotyper Basic- By Jag3xm4n","",1)
        $Hide[0] = 0
        TrayItemSetText($HideShow, 'Hide Autotalker')
    ElseIf $Hide[0] = 0 Then
        
        GUISetState(@SW_HIDE, $Main)
        $Hide[0] = 1
        TrayItemSetText($HideShow, 'Show Autotalker')
    EndIf
EndFunc

Func Save() ;Save the settings to an ini when a user select Save from File Menu, Hotkey or Tray. Settings will be saved to loaded ini if it's got write access.
    If FileExists($SettingsPath[0]) Then
        For $i = 1 To 12
            $SaveIni1 = IniWrite($SettingsPath[0], 'Settings', 'F' & $i, GUICtrlRead($input[$i]))
        Next
        If $SaveIni1 <> 1 Then
            For $i = 1 To 12
                $SaveIni = IniWrite(@ScriptDir & '\Autotalker.ini', 'Settings', 'F' & $i, GUICtrlRead($input[$i]))
            Next
            If $SaveIni = 1 Then
                $SettingsPath[0] =  @ScriptDir & '\Autotalker.ini'
            ElseIf $SaveIni <> 1 Then ;If the script is run from read only directory then offer the user where to save the settings.
                WinSetOnTop("Autotyper Basic- By Jag3xm4n","",0)
                $SaveFile = FileSaveDialog('Save Autotalker settings to ...', '::{450D8FBA-AD25-11D0-98A8-0800361B1103}', 'Autotalker (*.ini)', 18, 'Autotalker.ini')
                If Not @error = 1 Then
                    For $i = 1 To 12
                        $SaveIni2 = IniWrite($SaveFile, 'Settings', 'F' & $i, GUICtrlRead($input[$i]))
                    Next
                    $SettingsPath[0] =  $SaveFile
                EndIf
                WinSetOnTop("Autotyper Basic- By Jag3xm4n","",1)
            EndIf
        EndIf
    ElseIf Not FileExists($SettingsPath[0]) Then ; <- Start updated, this was the part I forgot to add when there's no ini path stored in array
        For $i = 1 To 12
            $SaveIni = IniWrite(@ScriptDir & '\Autotalker.ini', 'Settings', 'F' & $i, GUICtrlRead($input[$i]))
        Next
        If $SaveIni = 1 Then
            $SettingsPath[0] =  @ScriptDir & '\Autotalker.ini'
        ElseIf $SaveIni <> 1 Then
            WinSetOnTop("Autotyper Basic- By Jag3xm4n","",0)
            $SaveFile = FileSaveDialog('Save Autotalker settings to ...', '::{450D8FBA-AD25-11D0-98A8-0800361B1103}', 'Autotalker (*.ini)', 18, 'Autotalker.ini')
            If Not @error = 1 Then
                For $i = 1 To 12
                    $SaveIni2 = IniWrite($SaveFile, 'Settings', 'F' & $i, GUICtrlRead($input[$i]))
                Next
                $SettingsPath[0] =  $SaveFile
            EndIf
            WinSetOnTop("Autotyper Basic- By Jag3xm4n","",1)
        EndIf
    EndIf  ;<- This is the end of what I updated
EndFunc

Func Load() ; File Menu Load settings from an ini that the user has saved somewhere.
    WinSetOnTop("Autotyper Basic- By Jag3xm4n","",0)
    $FileLoad = FileOpenDialog('Load Autotalker settings from...', '::{450D8FBA-AD25-11D0-98A8-0800361B1103}', '(Autotalker.ini)|(*.ini)', 3, 'Autotalker.ini')
    If Not @error = 1 Then
        $ReadSection = IniReadSection($FileLoad, 'Settings')
        For $i = 1 To 12
            GUICtrlSetData($input[$i], $ReadSection[$i][1])
        Next
        $SettingsPath[0] = $FileLoad
    EndIf
    WinSetOnTop("Autotyper Basic- By Jag3xm4n","",1)
EndFunc

Func StartupLoad() ;On startup load settings from ini if it exists into the input boxes. Default the ini will be loaded from script directory when started
    If FileExists(@ScriptDir & '\Autotalker.ini') Then
        $ReadSection = IniReadSection(@ScriptDir & '\Autotalker.ini', 'Settings')
        For $i = 1 To 12
            GUICtrlSetData($input[$i], $ReadSection[$i][1])
        Next
    EndIf
EndFunc

Func About() ; Other File Menu About function
    WinSetOnTop("Autotyper Basic- By Jag3xm4n","",0)
    MsgBox(64, 'About Autotalker', 'Autotalker is for....' & @CRLF & 'The conception of Autotalker originated...' & _
                @CRLF & 'For more information...')
    WinSetOnTop("Autotyper Basic- By Jag3xm4n","",1)
EndFunc

Func Version() ; Other File Menu Version function
    WinSetOnTop("Autotyper Basic- By Jag3xm4n","",0)
    MsgBox(64, 'Autotalker Version', 'v 0.1 Alpha')
    WinSetOnTop("Autotyper Basic- By Jag3xm4n","",1)
EndFunc

Func Close() ; This is the function called from GUISetOnEvent to exit.
    Exit
EndFunc

Good luck

Cheers

Edit: Here you go , forgot to write if the ini file doesn't exist ..doh

Edit again: just so you can see that what sandman suggested does work with a bit of tweaking.

Also changed some other bits , see if you can spot the differances in the script for yourself SalazarCheats :shocked:

Edit once again: Fixed a bug with show gui after being hidden from the gui minimise button.

Also added check when a user hits a hotkey that if there's no text in the input box then don't send.

Edited by smashly
Link to comment
Share on other sites

Also, instead of making all these seperate labels:

GUICtrlCreateLabel("F1",5,10)
GUICtrlCreateLabel("F2",5,35)
GUICtrlCreateLabel("F3",5,60)
GUICtrlCreateLabel("F4",5,85)
GUICtrlCreateLabel("F5",5,110)
GUICtrlCreateLabel("F6",5,135)
GUICtrlCreateLabel("F7",5,160)
GUICtrlCreateLabel("F8",5,185)
GUICtrlCreateLabel("F9",5,210)
GUICtrlCreateLabel("F10",5,235)
GUICtrlCreateLabel("F11",5,260)
GUICtrlCreateLabel("F12",5,285)
GUICtrlCreateLabel("This Autotalker was made by 'Jag3xm4n'... you may use this for free... 'BUT' we ask you not to upload",5,313)
GUICtrlCreateLabel("this to ANY sites.. just put a link to US!!!", 5, 326)
GUICtrlCreateLabel("HOW TO USE",325,10)
GUICtrlCreateLabel("STEP 1:",338,35)
GUICtrlCreateLabel("Type in the text you want...",300,60)
GUICtrlCreateLabel("STEP 2:",338,85)
GUICtrlCreateLabel("Then go on to 'Runescape'",300,110)
GUICtrlCreateLabel("And press the corret 'F' key",300,135)
GUICtrlCreateLabel("This will autotype for you",300,160)
GUICtrlCreateLabel("ENJOY",338,185)

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Link to comment
Share on other sites

I think you need to read a little more from the AutoIt help file and check out some other scripts in the autoit forums.

You'll pick up a lot of helpfull info by doing so and a better comprehension of how the gui side of autoit works..

With that said here you go , maybe this will help a little , maybe not.. lol

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1) ; Added this since it looks like you using on event mode for your GUI
Opt("TrayMenuMode", 1) ;Added this to only show Autotalker tray menu options
Opt("TrayOnEventMode", 1) ;Added this for tray menu to work on event as well
TraySetClick(16) ; Set tray menu to show when right mouse click

Global $input[13], $Hide[1], $SettingsPath[1]

HotKeySet("^s", "Save") ; This is to call save settings function
HotKeySet("^l", "Load") ; This is to call load settings function
HotKeySet("^h", "Hide") ; This is to call hide function, toggles hide or show gui
HotKeySet("!{ESC}", "Close") ; This is to call close function, this way a user can exit autotalker even if the gui is hidden
HotKeySet("{F1}", "F1")
HotKeySet("{F2}", "F2")
HotKeySet("{F3}", "F3")
HotKeySet("{F4}", "F4")
HotKeySet("{F5}", "F5")
HotKeySet("{F6}", "F6")
HotKeySet("{F7}", "F7")
HotKeySet("{F8}", "F8")
HotKeySet("{F9}", "F9")
HotKeySet("{F10}", "F10")
HotKeySet("{F11}", "F11")
HotKeySet("{F12}", "F12")

$Main = GUICreate("Autotyper Basic- By Jag3xm4n",500,363) ;Put your main window in a variable so you can use it on an event.
WinSetOnTop("Autotyper Basic- By Jag3xm4n","",1)
GUICtrlCreateLabel("F1",5,10)
GUICtrlCreateLabel("F2",5,35)
GUICtrlCreateLabel("F3",5,60)
GUICtrlCreateLabel("F4",5,85)
GUICtrlCreateLabel("F5",5,110)
GUICtrlCreateLabel("F6",5,135)
GUICtrlCreateLabel("F7",5,160)
GUICtrlCreateLabel("F8",5,185)
GUICtrlCreateLabel("F9",5,210)
GUICtrlCreateLabel("F10",5,235)
GUICtrlCreateLabel("F11",5,260)
GUICtrlCreateLabel("F12",5,285)
GUICtrlCreateLabel("This Autotalker was made by 'Jag3xm4n'... you may use this for free... 'BUT' we ask you not to upload",5,313)
GUICtrlCreateLabel("this to ANY sites.. just put a link to US!!!", 5, 326)
GUICtrlCreateLabel("HOW TO USE",325,10)
GUICtrlCreateLabel("STEP 1:",338,35)
GUICtrlCreateLabel("Type in the text you want...",300,60)
GUICtrlCreateLabel("STEP 2:",338,85)
GUICtrlCreateLabel("Then go on to 'Runescape'",300,110)
GUICtrlCreateLabel("And press the corret 'F' key",300,135)
GUICtrlCreateLabel("This will autotype for you",300,160)
GUICtrlCreateLabel("ENJOY",338,185)

$MenuItem2 = GUICtrlCreateMenu("File")

$MenuItem7 = GUICtrlCreateMenuItem("Load Settings (CTRL + L)", $MenuItem2) ;Load settings File Menu
GUICtrlSetOnEvent(-1, 'Load') ; Added this so your gui will call load function when a user selects load from the File Menu

$MenuItem4 = GUICtrlCreateMenuItem("Save Settings (CTRL + S)", $MenuItem2)
GUICtrlSetOnEvent(-1, 'Save') ; Added this so your gui will call save function when a user selects save from the File Menu

GUICtrlCreateMenuItem('', $MenuItem2) ; Divider line in menu , cosmetic touch...lol

$MenuItem8 = GUICtrlCreateMenuItem("Hide (CTRL + H)", $MenuItem2)
GUICtrlSetOnEvent(-1, 'Hide') ; Added this so your gui will call hide function when a user selects hide from the File Menu

GUICtrlCreateMenuItem('', $MenuItem2) ; Divider line in menu , cosmetic touch...lol

$MenuItem3 = GUICtrlCreateMenuItem("EXIT (ALT + ESC)", $MenuItem2)
GUICtrlSetOnEvent(-1, 'Close') ; Added this so your gui will call close function when a user selects exit from the File Menu

$MenuItem1 = GUICtrlCreateMenu("Other")
$MenuItem5 = GUICtrlCreateMenuItem("About", $MenuItem1)
GUICtrlSetOnEvent(-1, 'About') ; Added this so your gui will call about function when a user selects about from the File Menu

$MenuItem6 = GUICtrlCreateMenuItem("Version", $MenuItem1)
GUICtrlSetOnEvent(-1, 'Version') ; Added this so your gui will call version function when a user selects version from the File Menu
$input[1] = GUICtrlCreateInput("",25,10)
$input[2] = GUICtrlCreateInput("",25,35)
$input[3] = GUICtrlCreateInput("",25,60)
$input[4] = GUICtrlCreateInput("",25,85)
$input[5] = GUICtrlCreateInput("",25,110)
$input[6] = GUICtrlCreateInput("",25,135)
$input[7] = GUICtrlCreateInput("",25,160)
$input[8] = GUICtrlCreateInput("",25,185)
$input[9] = GUICtrlCreateInput("",25,210)
$input[10] = GUICtrlCreateInput("",25,235)
$input[11] = GUICtrlCreateInput("",25,260)
$input[12] = GUICtrlCreateInput("",25,285)

GUISetOnEvent($GUI_EVENT_CLOSE, 'Close') ; Added this so your GUI will call a function to exit
GUISetOnEvent($GUI_EVENT_MINIMIZE, 'Hide') ; Added this so your GUI will call a function to hide gui

GUISetState()

;--- Tray Menu
$HideShow = TrayCreateItem('Hide Autotalker',  -1, 0)
TrayItemSetOnEvent(-1, "Hide")

TrayCreateItem('',  -1, 1) ;Divider line in tray menu , cosmetic touch...lol

$Load = TrayCreateItem('Load Settings',  -1, 2)
TrayItemSetOnEvent(-1, "Load")

$Save = TrayCreateItem('Save Settings',  -1, 3)
TrayItemSetOnEvent(-1, "Save")

TrayCreateItem('',  -1, 4) ;Divider line in tray menu , cosmetic touch...lol

$Close = TrayCreateItem('Exit',  -1, 5)
TrayItemSetOnEvent(-1, "Close")

TraySetState()

StartupLoad() ;Load settings from Autotalker.ini if it exists in the script directory.

While 1
    Sleep(10)
Wend

;~ Func Menu

Func F1() ;Maybe make it so the send function only works if the window it sends to is active, just a suggestion
    Send(GUICtrlRead($input[1]))
    Send("{ENTER}")
EndFunc

Func F2()
    Send(GUICtrlRead($input[2]))
    Send("{ENTER}")
EndFunc

Func F3()
    Send(GUICtrlRead($input[3]))
    Send("{ENTER}")
EndFunc

Func F4()
    Send(GUICtrlRead($input[4]))
    Send("{ENTER}")
EndFunc

Func F5()
    Send(GUICtrlRead($input[5]))
    Send("{ENTER}")
EndFunc

Func F6()
    Send(GUICtrlRead($input[6]))
    Send("{ENTER}")
EndFunc

Func F7()
    Send(GUICtrlRead($input[7]))
    Send("{ENTER}")
EndFunc

Func F8()
    Send(GUICtrlRead($input[8]))
    Send("{ENTER}")
EndFunc

Func F9()
    Send(GUICtrlRead($input[9]))
    Send("{ENTER}")
EndFunc

Func F10()
    Send(GUICtrlRead($input[10]))
    Send("{ENTER}")
EndFunc

Func F11()
    Send(GUICtrlRead($input[11]))
    Send("{ENTER}")
EndFunc

Func F12() ; F12 will NOT work as a hotkey on it's own as it's reserved by windows, this is documented in the AutoIt help file!
    Send(GUICtrlRead($input[12]))
    Send("{ENTER}")
EndFunc

Func Hide() ; Toggle hide or show the gui function.
    If $Hide[0] = 1 Then
        GUISetState(@SW_SHOW, $Main)
        WinSetOnTop("Autotyper Basic- By Jag3xm4n","",1)
        $Hide[0] = 0
        TrayItemSetText($HideShow, 'Hide Autotalker')
    ElseIf $Hide[0] = 0 Then
        GUISetState(@SW_HIDE, $Main)
        $Hide[0] = 1
        TrayItemSetText($HideShow, 'Show Autotalker')
    EndIf
EndFunc

Func Save() ;Save the settings to an ini when a user select Save from File Menu, Hotkey or Tray. Settings will be saved to loaded ini if it's got write access.
    If FileExists($SettingsPath[0]) Then
        For $i = 1 To 12
            $SaveIni1 = IniWrite($SettingsPath[0], 'Settings', 'F' & $i, GUICtrlRead($input[$i]))
        Next
        If $SaveIni1 <> 1 Then
            For $i = 1 To 12
                $SaveIni = IniWrite(@ScriptDir & '\Autotalker.ini', 'Settings', 'F' & $i, GUICtrlRead($input[$i]))
            Next
            If $SaveIni = 1 Then
                $SettingsPath[0] =  @ScriptDir & '\Autotalker.ini'
            ElseIf $SaveIni <> 1 Then ;If the script is run from read only directory then offer the user where to save the settings.
                WinSetOnTop("Autotyper Basic- By Jag3xm4n","",0)
                $SaveFile = FileSaveDialog('Save Autotalker settings to ...', '::{450D8FBA-AD25-11D0-98A8-0800361B1103}', 'Autotalker (*.ini)', 18, 'Autotalker.ini')
                If Not @error = 1 Then
                    For $i = 1 To 12
                        $SaveIni2 = IniWrite($SaveFile, 'Settings', 'F' & $i, GUICtrlRead($input[$i]))
                    Next
                    $SettingsPath[0] =  $SaveFile
                EndIf
                WinSetOnTop("Autotyper Basic- By Jag3xm4n","",1)
            EndIf
        EndIf
    EndIf
EndFunc

Func Load() ; File Menu Load settings from an ini that the user has saved somewhere.
    WinSetOnTop("Autotyper Basic- By Jag3xm4n","",0)
    $FileLoad = FileOpenDialog('Load Autotalker settings from...', '::{450D8FBA-AD25-11D0-98A8-0800361B1103}', '(Autotalker.ini)|(*.ini)', 3, 'Autotalker.ini')
    If Not @error = 1 Then
        $ReadSection = IniReadSection($FileLoad, 'Settings')
        For $i = 1 To 12
            GUICtrlSetData($input[$i], $ReadSection[$i][1])
        Next
        $SettingsPath[0] = $FileLoad
    EndIf
    WinSetOnTop("Autotyper Basic- By Jag3xm4n","",1)
EndFunc

Func StartupLoad() ;On startup load settings from ini if it exists into the input boxes. Default the ini will be loaded from script directory when started
    If FileExists(@ScriptDir & '\Autotalker.ini') Then
        $ReadSection = IniReadSection(@ScriptDir & '\Autotalker.ini', 'Settings')
        For $i = 1 To 12
            GUICtrlSetData($input[$i], $ReadSection[$i][1])
        Next
    EndIf
EndFunc

Func About() ; Other File Menu About function
    WinSetOnTop("Autotyper Basic- By Jag3xm4n","",0)
    MsgBox(64, 'About Autotalker', 'Autotalker is for....' & @CRLF & 'The conception of Autotalker originated...' & _
                @CRLF & 'For more information...')
    WinSetOnTop("Autotyper Basic- By Jag3xm4n","",1)
EndFunc

Func Version() ; Other File Menu Version function
    WinSetOnTop("Autotyper Basic- By Jag3xm4n","",0)
    MsgBox(64, 'Autotalker Version', 'v 0.1 Alpha')
    WinSetOnTop("Autotyper Basic- By Jag3xm4n","",1)
EndFunc

Func Close() ; This is the function called from GUISetOnEvent to exit.
    Exit
EndFunc

Good luck

Cheers

Thanks smashly...

But i have one problem...

This don't make the 'ini' file... i made one my self but them when oping the autotalker i get errors can you fix this...

BTW... sorry sandman... but your bit did not work...

Can anyone hlpe me thanks

Ok im 14 with a spelling age of a 9 year old... that explanes all my spelling mistakes

Link to comment
Share on other sites

Updated my post above with what was missing (added comments to what I updated in the save function)

The advice sandman gave would just needs some tweaking to work the way you want.

As for help you need to commit some time into reading the help file to get a better grasp of autoit's features.

Good luck

Cheers

Edit: updated my post above by adding a tweaked version sandmans advice for the labels.

Also made the input boxes a little wider and created the input boxes with less code :shocked:

Anything else ? lol

l8r

Edit: fixed bug with show gui and added small check if data is in the input box before sending.

Edited by smashly
Link to comment
Share on other sites

yes there is one more thing...

Is there a way for there to be an input box with the number '3' allready in it... but can be edited buy the user... which will then for excample if it is left at 3 this will type the message in 3 seconds...

Ok im 14 with a spelling age of a 9 year old... that explanes all my spelling mistakes

Link to comment
Share on other sites

yes there is one more thing...

Is there a way for there to be an input box with the number '3' allready in it... but can be edited buy the user... which will then for excample if it is left at 3 this will type the message in 3 seconds...

Not sure chich way you'd like but,

3 ways:

GUICtrlCreateInput ("3", 0, 0, 100, 21)oÝ÷ Ù«­¢+ÙU%Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°À°À°ÄÀÀ°ÈĤ)Õ±
ÑɱMÑÑ ´Ä°Ì¤oÝ÷ Ù«­¢+Ù%¹ÁÕÑ    ½à ÅÕ½ÐíQ¥Ñ±ÅÕ½Ðì°ÅÕ½ÐíAɽµÁÐÅÕ½Ðì°ÅÕ½ÐìÌÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðì´ÄÅÕ½Ðì°ÅÕ½Ðì´ÄÅÕ½Ðì°ÅÕ½Ðì´ÄÅÕ½Ðì°ÅÕ½Ðì´ÄÅÕ½Ðì¤

EDIT; Script

Regards

Edited by bert
Link to comment
Share on other sites

@ SalazarCheats

To do what your after you'll first need to make your script either have a pause function or

make your script detect when the runescape window is active.

Better yet give your script both a pause function and also make it detect when runscape window is active :shocked:

Reason why I say this is, currently if you set a setting and the runescape window isn't active then text will be sent to anything that has focus.

Adding the auto type after so many seconds would be easy enough , but if it's just sending text automatically to any old window then your script would be painfull to use.

I've heard the name runescape but have never looked into it,

Is it run in your web browser ?

Cheers

Edited by smashly
Link to comment
Share on other sites

@ SalazarCheats

To do what your after you'll first need to make your script either have a pause function or

make your script detect when the runescape window is active.

Better yet give your script both a pause function and also make it detect when runscape window is active :shocked:

Reason why I say this is, currently if you set a setting and the runescape window isn't active then text will be sent to anything that has focus.

Adding the auto type after so many seconds would be easy enough , but if it's just sending text automatically to any old window then your script would be painfull to use.

I've heard the name runescape but have never looked into it,

Is it run in your web browser ?

Cheers

yes sorry i neaver replyed... yes it it is at runescape.com... but it boaring at the begining

Ok im 14 with a spelling age of a 9 year old... that explanes all my spelling mistakes

Link to comment
Share on other sites

Not sure chich way you'd like but,

3 ways:

GUICtrlCreateInput ("3", 0, 0, 100, 21)oÝ÷ Ù«­¢+ÙU%Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°À°À°ÄÀÀ°ÈĤ)Õ±
ÑɱMÑÑ ´Ä°Ì¤oÝ÷ Ù«­¢+Ù%¹ÁÕÑ    ½à ÅÕ½ÐíQ¥Ñ±ÅÕ½Ðì°ÅÕ½ÐíAɽµÁÐÅÕ½Ðì°ÅÕ½ÐìÌÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðì´ÄÅÕ½Ðì°ÅÕ½Ðì´ÄÅÕ½Ðì°ÅÕ½Ðì´ÄÅÕ½Ðì°ÅÕ½Ðì´ÄÅÕ½Ðì¤

EDIT; Script

Regards

ok thats not what i ment... i ment how can i make it so that the user can change the speed that it autotypes...

For excample...

If i have this in a input box: 'helo my name is salazarcheats' and i want it to type that massage... but i want it to type it slow... say the whole sentance in like 15 seconds id put 15 in a input box and it would do that any ideas.

Ok im 14 with a spelling age of a 9 year old... that explanes all my spelling mistakes

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...