2o2 Posted June 18, 2007 Share Posted June 18, 2007 i am making a notepad gui. i would like to know the following. is there any way that i can: make it so that when i drag a text document into the notepad script, it opens it? (urgent) make it so that ctrl + a selects all (medium) and make it so that the gui can get bigger but all of the things in the gui stay proportional? (not so important) thanks -isaac expandcollapse popup;-------------------------------------------- ; ; Name: BetaPad ; Author: Secure_ICT ; Description: A nice text editor with tabs ; Extra Credit: theguy0000, PaulIA ; ;-------------------------------------------- #include <GUIConstants.au3> #include <String.au3> #include <misc.au3> #include <ie.au3> #include <GuiTab.au3> #include <Sound.au3> #include <file.au3> Global $Functions Hotkeyset("{ESC}", "escape") HotKeySet("{TAB}", "tab") HotKeySet("^s", "save") Hotkeyset("^o", "open") hotkeyset("^f", "pref") HotKeySet("^t", "newtab") HotKeySet("^{F4}", "closeall") #Region ### START Koda GUI section ### Form=c:\program files\koda\templates\tabbed pages.kxf $dlgTabbed = GUICreate("BetaPad - Secure_ICT", 600, 500, 303, 219) GUISetIcon("") $pages = GUICtrlCreateTab(8, 104, 396, 288) $TabSheet1 = GUICtrlCreateTabItem("Document 1") GUICtrlSetState(-1,$GUI_SHOW) $doc1 = GUICtrlCreateEdit("", 16, 128, 385, 257, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL)) GUICtrlSetData(-1, "") $TabSheet2 = GUICtrlCreateTabItem("Document 2") $doc2 = GUICtrlCreateEdit("", 16, 128, 385, 257, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL)) GUICtrlSetData(-1, "") $TabSheet3 = GUICtrlCreateTabItem("Document 3") $doc3 = GUICtrlCreateEdit("", 16, 128, 385, 257, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL)) GUICtrlSetData(-1, "") GUICtrlCreateTabItem("") $optgroup = GUICtrlCreateGroup("BetaPad - Options", 8, 8, 393, 89) $menu = GUICtrlCreateMenu("File") $open = GUICtrlCreateMenuItem("Open Ctrl + o", $menu) $save = GUICtrlCreateMenuItem("Save Ctrl + s", $menu) $saveas = Guictrlcreatemenuitem("Save As", $menu) $Encrypter = GUICtrlCreateMenuitem ("&Encrypt", $menu) $Decrypter = GUICtrlCreateMenuitem ("&Decrypt", $menu) $Speaktxt = GUICtrlCreateMenuItem ('&Speak Text', $menu) $exit = GUICtrlCreateMenuItem("Exit", $menu) $about = GUICtrlCreateMenuItem("About", $menu) $edit = GUICtrlCreateMenu("Edit") $undo = GUICtrlCreateMenuItem("Undo Ctrl + z", $edit) $pref = GUICtrlCreateMenuItem("Font Ctrl + f", $edit) $cut = GUICtrlCreateMenuItem("Cut Ctrl + x", $edit) $copy = GUICtrlCreateMenuItem("Copy Ctrl + c", $edit) $paste = GUICtrlCreateMenuItem("Paste Ctrl + v", $edit) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Func newtab() $Functions = Not $Functions While $Functions Sleep(100) GUICtrlSetData(-1, "") $TabSheet2 = GUICtrlCreateTabItem("New Tab") $newdoc = GUICtrlCreateEdit("", 16, 128, 385, 257, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL)) ExitLoop WEnd EndFunc Func closeall() $Functions = Not $Functions While $Functions Sleep(100) _GUICtrlTabDeleteAllItems($pages) ExitLoop WEnd EndFunc While 1 Dim $voice = ObjCreate("Sapi.SpVoice") $Rate = $voice.Rate $Volme = $voice.Volume $msg = GuiGetMsg() Select case ($msg = $doc1) $write = $doc1 Case ($msg = $doc2) $write = $doc2 case ($msg = $doc3) $write = $doc3 Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $Msg = $save $SaveDir = FileSaveDialog("Save",@MyDocumentsDir, "Text Document(*.txt)|Secure Document(*.ict)|Autoit Doccument(*.au3)",16) Switch GUICtrlRead($pages) Case 0 $text = GUICtrlRead($doc1) $write = $doc1 Case 1 $text = GUICtrlRead($doc2) $write = $doc2 Case 2 $text = GUICtrlRead($doc3) $write = $doc3 EndSwitch $filehandle = FileOpen($SaveDir, 2) FileWrite($filehandle, $text) FileClose($filehandle) Case $msg = $open $OpenDir = FileOpenDialog("Open", @MyDocumentsDir, "Text Document(*.txt)|Secure Document(*.ict)|Autoit Doccument(*.au3)",16) $text = FileRead($OpenDir) GUICtrlSetData($TabSheet1, $OpenDir) GUICtrlSetData($doc1, $Text) Case ($msg = $Speaktxt) $empty = "" $txt2speech = GuiCtrlRead($write) If $txt2speech == $empty Then Speak("There is no text too reed", 0, 100) ;sounded out for maximum clarity!!! ;Isaac Rocks!!! so does math! Else Speak($txt2speech, 0, 100) EndIf Case ($msg = $Encrypter) $encrt = GUICtrlRead($write) $word2encrypt = InputBox("Password", "What do you want the password to encrypt the text to be?") GUICtrlSetData($write, _StringEncrypt(1, $encrt, $word2encrypt)) Case ($msg = $Decrypter) $decryt = GuiCtrlRead($write) $word2decrypt = InputBox("Password", "Please enter the password to decrypt the text") GUICtrlSetData($write, _StringEncrypt(0, $decryt, $word2decrypt)) Case ($msg = -3) Exit case ($msg = $cut) send("^v") Case ($msg = $exit) Exit Case ($msg = $saveas) $progsaveas = FileSaveDialog("Save", @desktopcommondir, "text files (*.txt;*.doc)") FileDelete($progsaveas) FileWrite($progsaveas, GUICtrlRead($write)) case ($msg = $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.6." & chr(13) & chr(10) & "-Isaac") case ($msg = $copy) send("^c") Case ($msg = $paste) send("^v") Case $msg = $pref $cfont = _ChooseFont() If @error Then Sleep(10) Else GUICtrlSetFont($write, $cfont[3], $cfont[4], $cfont[1], $cfont[2]) GUICtrlSetColor($write, $cfont[7]) EndIf EndSelect WEnd Func Speak($Text, $Rate, $Volme) $voice.Rate = $Rate $voice.Volume = $Volme $voice.Speak($Text) EndFunc Func tab() send(" ", $write) EndFunc func save() $SaveDir = FileSaveDialog("Save",@MyDocumentsDir, "Text Document(*.txt)|Secure Document(*.ict)|Autoit Doccument(*.au3)",16) Switch GUICtrlRead($pages) Case 0 $text = GUICtrlRead($doc1) $write = $doc1 Case 1 $text = GUICtrlRead($doc2) $write = $doc2 Case 2 $text = GUICtrlRead($doc3) $write = $doc3 EndSwitch $filehandle = FileOpen($SaveDir, 2) FileWrite($filehandle, $text) FileClose($filehandle) 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 pref() $cfont = _ChooseFont() If @error Then Sleep(10) Else GUICtrlSetFont($write, $cfont[3], $cfont[4], $cfont[1], $cfont[2]) GUICtrlSetColor($write, $cfont[7]) EndIf EndFunc Rick rack ree, kick 'em in the knee.Rick rack rass, kick 'em in the other knee! Link to comment Share on other sites More sharing options...
tAKTelapis Posted June 18, 2007 Share Posted June 18, 2007 Have a look in the helpfile GUISetOnEvent() There are some options in there that might help: such as: $GUI_EVENT_DROPPED End of a Drag&Drop action @GUI_DRAGID, @GUI_DRAGFILE and @GUI_DROPID will be used to retrieve the ID's/file corresponding to the involve control. There are all states that you set after your GUI is created, but BEFORE you set its state to show. Link to comment Share on other sites More sharing options...
2o2 Posted June 18, 2007 Author Share Posted June 18, 2007 Have a look in the helpfileGUISetOnEvent()There are some options in there that might help:such as:$GUI_EVENT_DROPPED End of a Drag&Drop action @GUI_DRAGID, @GUI_DRAGFILE and @GUI_DROPID will be used to retrieve the ID's/file corresponding to the involve control. There are all states that you set after your GUI is created, but BEFORE you set its state to show.thanks!! Rick rack ree, kick 'em in the knee.Rick rack rass, kick 'em in the other knee! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now