Sign in to follow this  
Followers 0
bobheart

Something Back .

23 posts in this topic

This is a small journal post thing that I made with a lot of help from everyone here so I will post it here to ehlp more noobs like me .. :D

You need to make a temp.txt and put it with the exe .

;Generated with AutoBuilder 0.3
$ES_READONLY = 0x800;
$WS_DISABLED = 0x8000000;
$WS_VSCROLL = 0x200000;
$WS_HSCROLL = 0x100000;

$style = $ES_READONLY + $WS_VSCROLL + $WS_HSCROLL
Func _clear()

ControlClick ( "Small Notes", "", "Edit1", "Left", 1)
$temp = ControlGetText ( "Small Notes", "", "Edit1" )
While $temp <> "";not sure if right syntax
Send("{BS}")
$temp = StringTrimRight($temp, 1)
Wend
EndFunc

Opt("GUICoordMode", 1)
Opt("GUINotifyMode", 1)

GuiCreate("Small Notes", 480,272,10,10,0x04CF0000)
$button_1 = GUISetControl("button", "Read", 340,230, 80,20)
$button_2 = GUISetControl("button", "Save", 220,230, 80,20)
$edit_1 = GUISetControl("edit", "", 30,20, 410,180)
$date_1 = GUISetControl("date", "Date 1", 20,220, 190,20)

GuiShow()

While 1
sleep(100)
$msg = GuiMsg(0)
Select
Case $msg = -3
Exit
Case $msg = $button_1
run("notepad.exe " & @scriptdir & "\temp.txt")
;;
Case $msg = $button_2
$file = FileOpen("temp.txt", 1)

; Check if file opened for writing OK
If $file = -1 Then
  MsgBox(0, "Error", "Unable to open file.")
  Exit
EndIf
$textleetcode = ControlGetText ( "Small Notes", "", "Edit1" )
FileWrite($file, $textleetcode)
FileClose($file)
_clear()
;;;
Case $msg = $edit_1
;;;
Case $msg = $date_1
;;;
EndSelect
WEnd
Exit

What it looks like .

Posted Image

enjoy .

Share this post


Link to post
Share on other sites



haha thats great...and useful for phone #'s, websites, and all that, now u dont have to go and find a pen and paper


-Brett

Share this post


Link to post
Share on other sites

Thanks brett , I'm glad someone liked it . lol didn't think anyone cared as noone said a thing about till now .

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

ya lol, i dont think anyone will care about somethin i program, thats why u dont see any of my work :D

Edited by brett

-Brett

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Woah, you've gotta be kidding me.... I was thinking of coding something similar to this the other day. I've gotta download it and play to see if it fits what I was thinking of.

Awesome - thanks!

OK, it needs a lil work, very basic, but still gives me a start as I was too lazy to even design a GUI.

Edited by Chris_1013

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Here is some small changes to that code that now lists time / date and puts spaces between entries.

You could add a lot to this. Such as creating new file to use, deleteing old file etc.

Anyway. heres the code.

;Generated with AutoBuilder 0.3
$ES_READONLY = 0x800;
$WS_DISABLED = 0x8000000;
$WS_VSCROLL = 0x200000;
$WS_HSCROLL = 0x100000;

$style = $ES_READONLY + $WS_VSCROLL + $WS_HSCROLL
Func _clear()

ControlClick ( "Small Notes", "", "Edit1", "Left", 1)
$temp = ControlGetText ( "Small Notes", "", "Edit1" )
While $temp <> "";not sure if right syntax
Send("{BS}")
$temp = StringTrimRight($temp, 1)
Wend
EndFunc

Opt("GUICoordMode", 1)
Opt("GUINotifyMode", 1)

GuiCreate("Small Notes", 480,272,10,10,0x04CF0000)
$button_1 = GUISetControl("button", "Read", 340,230, 80,20)
$button_2 = GUISetControl("button", "Save", 220,230, 80,20)
$edit_1 = GUISetControl("edit", "", 30,20, 410,180)
$date_1 = GUISetControl("date", "Date 1", 20,220, 190,20)

GuiShow()

While 1
sleep(100)
$msg = GuiMsg(0)
Select
Case $msg = -3
Exit
Case $msg = $button_1
run("notepad.exe " & @scriptdir & "\temp.txt")
;;
Case $msg = $button_2
$file = FileOpen("temp.txt", 1)

; Check if file opened for writing OK
If $file = -1 Then
 MsgBox(0, "Error", "Unable to open file.")
 Exit
EndIf
$textleetcode = ControlGetText ( "Small Notes", "", "Edit1" )

;$timehour
;if @Hour <> 00 
;$timehour = 12  

$amORpm = "AM"; am by default
if @HOUR > 12 Then
$amORpm = "PM"; pm
Endif

$Hour = ""
Select
    Case @HOUR < 13
        $Hour = @HOUR

    Case Else
        $Hour = @HOUR - 12     
    
EndSelect


$time = String ("")
$time = $time &  @MON  & "/" & @MDAY & "/" & @YEAR & " at " &  $Hour & ":" & @MIN & " " &$amORpm

FileWrite($file, "This note was made on:" & $time & @CRLF & "-----------" & @CRLF & @CRLF)


FileWrite($file, $textleetcode & @CRLF &  @CRLF & "-----------" & @CRLF & @CRLF )
FileClose($file)

_clear()
;;;
Case $msg = $edit_1
;;;
Case $msg = $date_1
;;;
EndSelect
WEnd
Exit

Here is the code that makes the text come up in a box instead of in a Nodepad file. The change is documented boldy i think. Was asked about this...

;Generated with AutoBuilder 0.3
$ES_READONLY = 0x800;
$WS_DISABLED = 0x8000000;
$WS_VSCROLL = 0x200000;
$WS_HSCROLL = 0x100000;

$style = $ES_READONLY + $WS_VSCROLL + $WS_HSCROLL
Func _clear()

ControlClick ( "Small Notes", "", "Edit1", "Left", 1)
$temp = ControlGetText ( "Small Notes", "", "Edit1" )
While $temp <> "";not sure if right syntax
Send("{BS}")
$temp = StringTrimRight($temp, 1)
Wend
EndFunc

Opt("GUICoordMode", 1)
Opt("GUINotifyMode", 1)

GuiCreate("Small Notes", 480,272,10,10,0x04CF0000)
$button_1 = GUISetControl("button", "Read", 340,230, 80,20)
$button_2 = GUISetControl("button", "Save", 220,230, 80,20)
$edit_1 = GUISetControl("edit", "", 30,20, 410,180)
$date_1 = GUISetControl("date", "Date 1", 20,220, 190,20)

GuiShow()

While 1
sleep(100)
$msg = GuiMsg(0)
Select
Case $msg = -3
Exit

Case $msg = $button_1
;run("notepad.exe " & @scriptdir & "\temp.txt")  ;;;; !!!!! THIS IS THE OLD WAY THIS ONE LINE
;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   THE CODE THAT PRINTS TXT FILE TO BOX


$file = FileOpen("temp.txt", 0)

;Check if file opened for reading OK
If $file = -1 Then
   MsgBox(0, "Error", "Unable to open file.")
   Exit
EndIf

$chars = FileRead($file, 100000)
MsgBox(0, "Char read:", $chars)

;;
FileClose($file)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   END OF PRINT TXT TO BOX CODE






Case $msg = $button_2
$file = FileOpen("temp.txt", 1)

; Check if file opened for writing OK
If $file = -1 Then
 MsgBox(0, "Error", "Unable to open file.")
 Exit
EndIf
$textleetcode = ControlGetText ( "Small Notes", "", "Edit1" )

;$timehour
;if @Hour <> 00 
;$timehour = 12  

$amORpm = "AM"; am by default
if @HOUR > 12 Then
$amORpm = "PM"; pm
Endif

$Hour = ""
Select
    Case @HOUR < 13
        $Hour = @HOUR

    Case Else
        $Hour = @HOUR - 12     
    
EndSelect


$time = String ("")
$time = $time &  @MON  & "/" & @MDAY & "/" & @YEAR & " at " &  $Hour & ":" & @MIN & " " &$amORpm



FileWrite($file, "This note was made on:" & $time & @CRLF & "-----------" & @CRLF & @CRLF)


FileWrite($file, $textleetcode & @CRLF &  @CRLF & "-----------" & @CRLF & @CRLF )
FileClose($file)

_clear()
;;;
Case $msg = $edit_1
;;;
Case $msg = $date_1
;;;
EndSelect
WEnd
Exit
Edited by Falling

Share this post


Link to post
Share on other sites

@falling: It's a start.

I'm gonna use your script and make it read the approriate note from a certain file.

The text file will have as filename the format month-day.txt

Example: 05-27.txt

Saved in @ScriptDir & "\notes"

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I've updated your script. (Well, actually I've rewritten most of the stuff)

What this script can:

  • Save notes
  • Read notes
  • Add/Delete/Rename tabs (default is General and can't be deleted)
  • Save the current tab every second
  • On startup, the script reads the notes from the current day (if available)
  • When you select another day, the edit box will automatically read the contents of the new day.
$ES_READONLY = 0x800;
$WS_DISABLED = 0x8000000;
$WS_VSCROLL = 0x200000;
$WS_HSCROLL = 0x100000;
$IniFile = @ScriptDir & "\Journal.ini"

$Match = 0
Global $TabSelect
Global $PrevTab
Global $PrevDay
Global $PrevMon

$style = $ES_READONLY + $WS_VSCROLL + $WS_HSCROLL

Opt ("GUICoordMode", 1)
Opt ("GUINotifyMode", 1)

GUICreate("Small Notes", 480, 272, -1, -1, 0x04CF0000)
$button_Read = GUISetControl("button", "Read Tab", 240, 220, 80, 20)
$button_Save = GUISetControl("button", "Save Tab", 340, 220, 80, 20)
$button_Add = GUISetControl("button", "Add Tab", 140, 245, 80, 20)
$button_Ren = GUISetControl("button", "Rename Tab", 240, 245, 80, 20)
$button_Del = GUISetControl("button", "Delete Tab", 340, 245, 80, 20)

$edit_1 = GUISetControl("edit", "", 30, 30, 410, 180)
$date_1 = GUISetControl("date", "Date 1", 30, 220, 190, 20, 0x04)

GUISetControl("tab", "", 30, 10, 250, 22)
GUISetControl("tabitem", "General", 1, 60)

$Count = IniRead($IniFile, "Tabs", "Count", "0")
$Count = Number($Count)

If $Count > 0 Then
   For $i = 1 To $Count
      $Tab = IniRead($IniFile, "Tabs", "Tab" & $i, "")
      DirCreate(@ScriptDir & "\notes\" & $Tab)
      GUISetControl("tabitem", $Tab, 1, 60)
   Next
Else
   DirCreate(@ScriptDir & "\notes")
EndIf

GUISetControl("tabitem", "", 0, 0)

GUIShow()

If Not WinActive("Small Notes", "") Then WinActivate("Small Notes", "")

$TabSelect = ControlCommand("Small Notes", "", "SysTabControl321", "CurrentTab", "")
$PrevTab = $TabSelect

ReadDate ()
ReadTab ()

$msg = GUIMsg(0)
$x = 1

While $msg <> - 3
   $msg = GUIMsg(0)
   
   Select
      
      Case $msg = $button_Read
         GUIWrite($edit_1, 0, "")
         ReadTab ()
         
      Case $msg = $button_Save
         SaveTab ()
         
      Case $msg = $button_Add
         AddTab ()
         
      Case $msg = $button_Ren
         RenTab ()
         
      Case $msg = $button_Del
         DelTab ()
         
      Case Else
         If $msg <> $edit_1 Then
            $TabSelect = ControlCommand("Small Notes", "", "SysTabControl321", "CurrentTab", "")
            If $PrevTab <> $TabSelect Then
               $PrevTab = $TabSelect
               GUIWrite($edit_1, 0, "")
               Sleep(50)
               GUIWrite($edit_1, 0, "")
               ReadTab ()
            EndIf
         EndIf
         
   EndSelect
   
   If $x = 4 Then
      SaveTab ()
      $x = 0
   EndIf
   
   $x = $x + 1
   Sleep(250)
Wend

Func CheckTab ($TabNum)
   If IsString($TabNum) Then Number($TabNum)
   If $TabNum = 1 Then 
      Return "General"
   Else
      $TabNum = $TabNum - 1
      $Tab = IniRead($IniFile, "Tabs", "Tab" & $TabNum, "none")
      Return $Tab
   EndIf
EndFunc  ;==>CheckTab 

Func RenTab ()
   $Count = IniRead($IniFile, "Tabs", "Count", "0")
   $Count = Number($Count)
   $List = @CRLF & @CRLF
   
   For $i = 1 To $Count
      $List = $List & $i & ") " & IniRead($IniFile, "Tabs", "Tab" & $i, "") & @CRLF
   Next
   
   $RenTab1 = InputBox("Rename Tab", "Enter the number in front of " & _
         "the tab you want to rename." & $List, "")
   If $RenTab1 = "" Then Return
   
   $ReadRenTab = IniRead($IniFile, "Tabs", "Tab" & $RenTab1, "")
   
   $RenTab2 = InputBox("Rename Tab", "Enter a new name for the tab.", $ReadRenTab)
   If $RenTab2 = "" Then Return
   
   IniWrite($IniFile, "Tabs", "Tab" & $RenTab1, $RenTab2)
   
   DirCopy(@ScriptDir & "\notes\" & $ReadRenTab, @ScriptDir & "\notes\" & $RenTab2)
   
   DirRemove(@ScriptDir & "\notes\" & $ReadRenTab, 1)
   
   MsgBox(64, "Rename Tab", "Restart the script for the changes to take effect.")
   
EndFunc  ;==>RenTab 

Func AddTab ()
   $NewTab = InputBox("Add Tab", "Enter a name for the new tab.", "")
   If $NewTab = "" Then Return
   
   $Count = IniRead($IniFile, "Tabs", "Count", "0")
   $Count = Number($Count)
   $NewTabNum = $Count + 1
   
   IniWrite($IniFile, "Tabs", "Tab" & $NewTabNum, $NewTab)
   IniWrite($IniFile, "Tabs", "Count", $NewTabNum)
   
   DirCreate(@ScriptDir & "\notes\" & $NewTab)
   GUISetControl("tabitem", $NewTab, 1, 60)
   GUISetControl("tabitem", "", 0, 0)
   GUIWrite($edit_1, 0, "")
   ReadTab ()
EndFunc  ;==>AddTab 

Func DelTab ()
   $Count = IniRead($IniFile, "Tabs", "Count", "0")
   $Count = Number($Count)
   $List = @CRLF & @CRLF
   
   For $i = 1 To $Count
      $List = $List & $i & ") " & IniRead($IniFile, "Tabs", "Tab" & $i, "") & @CRLF
   Next
   
   $DelTab = InputBox("Delete Tab", "Enter the number in front of " & _
         "the tab you want to delete." & $List, "")
   
   If $DelTab = "" Then Return
   
   $ReadTabDir = IniRead($IniFile, "Tabs", "Tab" & $DelTab, "")
   
   DirRemove(@ScriptDir & "\notes\" & $ReadTabDir, 1)
   
   IniDelete($IniFile, "Tabs", "Tab" & $DelTab)
   IniWrite($IniFile, "Tabs", "Count", $Count - 1)
   
   $num = $DelTab + 1
   
   If $DelTab <> $Count Then
      Do
         $BackupTab = IniRead($IniFile, "Tabs", "Tab" & $num, "")
         IniWrite($IniFile, "Tabs", "Tab" & $DelTab, $BackupTab)
         IniDelete($IniFile, "Tabs", "Tab" & $num)
         
         $DelTab = $DelTab + 1
         $num = $DelTab + 1
      Until $num > $Count
   EndIf
   
   MsgBox(64, "Delete Tab", "Restart the script for the changes to take effect.")
   
EndFunc  ;==>DelTab 

Func ReadTab ()
   $Tab = CheckTab ($TabSelect)
   
   $ReadDate = ReadDate ()
   
   $Day = $ReadDate[1]
   $Month = $ReadDate[2]
   
   If $Tab = "General" Then
      $Note = @ScriptDir & "\notes\" & $Month & "-" & $Day & ".txt"
   ElseIf $Tab = "none" Then
      MsgBox(0, "Save Tabs", "There's something wrong with saving the tabs.")
      Return
   Else
      $Note = @ScriptDir & "\notes\" & $Tab & "\" & $Month & "-" & $Day & ".txt"
   EndIf
   
   $OpenNote = FileOpen($Note, 0)
   
   If $OpenNote <> - 1 Then
      $ReadNote = FileRead($OpenNote, FileGetSize($Note))
      FileClose($OpenNote)
      GUIWrite($edit_1, 0, $ReadNote)
   EndIf
EndFunc  ;==>ReadTab 

Func SaveTab ()
   $Date = GUIRead($date_1)
   $Date = StringSplit($Date, " ")
   
   $Day = $Date[3]
   $Month = $Date[2]
   
   If $PrevDay <> $Day Or $PrevMon <> $Month Then
      
      GUIWrite($edit_1, 0, "")
      Sleep(50)
      GUIWrite($edit_1, 0, "")
      ReadTab ()
      
      $PrevDay = $Day
      $PrevMon = $Month
   EndIf
   
   $Tab = CheckTab ($TabSelect)
   
   $ReadDate = ReadDate ()
   
   $Day = $ReadDate[1]
   $Month = $ReadDate[2]
   
   $Content = GUIRead($edit_1)
   
   If $Tab = "General" Then
      $Note = @ScriptDir & "\notes\" & $Month & "-" & $Day & ".txt"
   ElseIf $Tab = "none" Then
      MsgBox(0, "Save Tabs", "There's something wrong with saving the tabs.")
      Return
   Else
      $Note = @ScriptDir & "\notes\" & $Tab & "\" & $Month & "-" & $Day & ".txt"
   EndIf
   
   $OpenNote = FileOpen($Note, 2)
   If $OpenNote <> - 1 Then
      FileWrite($OpenNote, $Content)
      FileClose($OpenNote)
   EndIf
EndFunc  ;==>SaveTab 

Func ReadDate ()
   $Date = GUIRead($date_1)
   $Date = StringSplit($Date, " ")
   
   $Day = $Date[3]
   $Month = $Date[2]
   
   $PrevDay = $Day
   $PrevMon = $Month
   
$Months = StringSplit("January,February,March,April,May,June,July,August,_
September,October,November,December", ",")
   For $i = 1 To $Months[0]
      If $Month = $Months[$i] Then $Month = $i
   Next
   
   If StringLen($Day) <> 2 And StringInStr($Day, "0") = 0 Then
      $Day = "0" & $Day
   EndIf
   
   If StringLen($Month) <> 2 And StringInStr($Month, "0") = 0 Then
      $Month = "0" & $Month
   EndIf
   
   Dim $ReadDate[3]
   
   $ReadDate[1] = $Day
   $ReadDate[2] = $Month
   
   Return $ReadDate
   
EndFunc  ;==>ReadDate 

SaveTab ()
Exit
Edited by SlimShady

Share this post


Link to post
Share on other sites

I updated the journal script.

I added tabs.

See my post above this one.

Share this post


Link to post
Share on other sites

Needs a little work . if you post to one tab and then add a tab then post to it , it does not show the post the other tab post .

But it does save it to txt file .

Share this post


Link to post
Share on other sites

Needs a little work . if you post to one tab and then  add a tab then post to it , it does not show the post the other tab post .

But it does save it to txt file .

I'll explain the function of the tabs.

If you have a job and go to school, it's nice to have the notes seperated.

- You can save the usual stuff in the General tab

- Create a School tab for the school stuff

- Create a Work tab for meetings, appointments and such

- Create an Important tab for urgent things like: picking your kids up from school.

- Create a Private tab for personal stuff

@bobheart: Can you explain what you want to accomplish?

Share this post


Link to post
Share on other sites

Oh you have gone way past what i was going to do . but I don't know all the commands and how this all works .

I don't understand 1/2 of this tuff . lol well 1/4 ..

Share this post


Link to post
Share on other sites

Easy, it's a form, a graphical user interface.

There are no commands only buttons and a textbox.

Save the script and run it.

Share this post


Link to post
Share on other sites

Updated again.

- Fixed some major bugs

Share this post


Link to post
Share on other sites

Updated.

- I fixed the auto-save

- I added a delay when switching tabs, so the script doesn't overwrite the previous tab.

Share this post


Link to post
Share on other sites

seems to no longer work Slim.. though the simple version posted by bob heart still works though. However odd that it eats up the words while it saves the text.. that was a little startling. :D

anyway, Slim if you're still interested in pursuing this.. a couple of things that would be nice are:

Font selection.. just for the whole note? not neccesary though. obviously

word wrap instead of having to hit "enter" on every line

and when saving it actually asks what you want to name it as well as where to save it to.

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

I've managed to make it here perfectly.

So, the main problems have been solved.

Only problem exists:

I have a Dutch version of XP. The date that is used is different than on the English version.

If you tell me what the order is of the date that is displayed on the application (eg: Day, Month, Daynumber, Year),

I can update it, upload it and share the link.

About your requests...

First I want to finish the Gui of my Website DB, later I will try to implement your suggestions.

Edited by SlimShady

Share this post


Link to post
Share on other sites

One save txt is named 06-02,.txt

Is that what you wanted to know ?

Share this post


Link to post
Share on other sites

You didn't provide me the information that I needed,

so I guessed what it could be and updated the script.

(I know, I'm not patient. That's because I'm busy...)

here is the link to the script:

...http://Neoangelo.3x.ro/scripts/Journal.au3

Copy the link above, remove the three dots and paste it in a new browser window.

Share this post


Link to post
Share on other sites

I am impressed of the script - wow.

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