Jump to content

Recommended Posts

Posted

Any way that i can create a font menu for my notepad script? (URGENT) please help. i am trying to make a script that is a program like notepad and would like to know if there is any way to make maybe a gui that can chose fonts for the program? heres the program so far. Also i would like to set the hotkey ctrl + a to select all but i dont know how to. i know hotkeyset("^a", "selectall") but then i dont know what i would put as func selectall() (NOT SO URGENT)

#NoTrayIcon
#include <GUIConstants.au3>

$12 = GUICreate ("iPad", 600, 400)
guisetbkcolor("blue")
Hotkeyset("{ESC}", "escape")
HotKeySet("^v", "paste")
HotKeySet("{TAB}", "tab")
Hotkeyset("^c", "copy")
HotKeySet("^s", "save")
Hotkeyset("^o", "open")
hotkeyset("^x", "cut")
Global $progopen
Global $progsaveas

$menu = GUICtrlCreateMenu("File")
$open = GUICtrlCreateMenuItem("Open", $menu)
$save = GUICtrlCreateMenuItem("Save Ctrl + S", $menu)
$saveas = Guictrlcreatemenuitem("Save As", $menu)

$about = GUICtrlCreateMenuItem("About", $menu)
$exit = GUICtrlCreateMenuItem("Exit", $menu)
$edit = GUICtrlCreateMenu("Edit")
$cut = GUICtrlCreateMenuItem("Cut Ctrl + x", $edit)
$copy = GUICtrlCreateMenuItem("Copy Ctrl + C", $edit)
$paste = GUICtrlCreateMenuItem("Paste Ctrl + V", $edit)
$undo = GUICtrlCreateMenuItem("Undo Ctrl + Z", $edit)
$write = GUICtrlCreateEdit("",  5, 5, 590, 370)
GUISetState(@SW_SHOW)


while 1
guictrlsetfont("Lucida Sans Unicode", 12)   
    $sav =  GUICtrlRead($write)
    $iResult = GUIGetMsg ()
    Select
    case ($iResult = $open)
    $progopen = FileOpenDialog("Open",@desktopcommondir, "text files(*.txt;*.doc)", 1)
If @error Then
Sleep(10)
else
GUICtrlSetData($write, FileRead($progopen))
endif
    Case ($iResult = -3)
        Exit
    case ($iResult = $cut)
        clipput($write)
send("{backspace}")
Case ($iResult = $exit)
    Exit
    Case ($iResult = $saveas)
    $progsaveas = FileSaveDialog("Save", @desktopcommondir, "text files (*.txt;*.doc)")
FileDelete($progsaveas)
FileWrite($progsaveas, GUICtrlRead($write))
Case ($iResult = $save)
if fileexists($progopen) then
FileDelete($progopen)
FileWrite($progopen, GUICtrlRead($write))
EndIf
if not fileexists($progopen) Then
$progopen = FileSaveDialog("Save", @desktopcommondir, "text files (*.txt;*.doc)")
FileDelete($progopen)
FileWrite($progopen, GUICtrlRead($write))
EndIf
case ($iResult = $about)
    msgbox(0, "iPad", "iPad, Created by Isaac Flaum is a notepad like tool compiled using Autoit v3" & chr(13) & chr(10) & "Thanks For Trying iPad! Updates Coming Soon. Version 1.1." & chr(13) & chr(10) & "-Isaac")
case ($iResult = $copy)
    ClipPut($sav)
Case ($iResult = $paste)
    GUICtrlSendMsg($write, "^v", 1, 1)
EndSelect
WEnd

Func tab()
send("     ", $write)
EndFunc

func save()
if fileexists($progopen) then
FileDelete($progopen)
FileWrite($progopen, GUICtrlRead($write))
EndIf
if not fileexists($progopen) Then
$progopen = FileSaveDialog("Save", @desktopcommondir, "text files (*.txt;*.doc)")
FileDelete($progopen)
FileWrite($progopen, GUICtrlRead($write))
EndIf
EndFunc

Func copy()
Clipput($sav)
EndFunc

func cut()
clipput($write)
send("{backspace}")
EndFunc

func escape()
    Exit
EndFunc

func open()
$progopen = FileOpenDialog("Open",@desktopcommondir, "text files(*.txt;*.doc)", 1)
If @error Then
Sleep(10)
else
GUICtrlSetData($write, FileRead($progopen))
endif
EndFunc

Func paste()
send(clipget(), $write)
EndFunc

Rick rack ree, kick 'em in the knee.Rick rack rass, kick 'em in the other knee!

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
×
×
  • Create New...