ayuda con aplicacion de receta de cocina
Publicado: 12/06/2013 00:15
hola de nuevo , ahora tengo otro imcomveniente , le hice a mi esposa esta aplicacion con exemplo de otro claro esta mis conocimientos no dan para tanto jajaja .. bueno el caso es una aplicacion para ella poner las recetas d la cocina , y cuando las desee ver las busque y la lea desde ahi , el caso es queria hacerle varias modificaciones al script pero como mis conocimientos no llegan para tanto , pedire ayudita , queria ve r si podia cambiarle el fondo de la aplicacion , no donde escribo , sino las otras partes , y otra cosa , si se agregar al script , un osk externo , no el de la pc , sino uno externo que uso , como el monitor es touch screen
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#Include <Array.au3>
$GUI = GUICreate("RECIPES", 800, 500, 0 ,0, $WS_POPUP ) ;CUADRO TOTAL TAMANO CON FRAMELESS
GUICtrlCreateLabel("INGREDIENTES",220,65,80,20);Label INGREDIENTES Top section
GUICtrlSetColor(-1, 0xff0000)
GUISetState(@SW_SHOW)
GUICtrlCreateLabel("PREPARACION",220,235,80,20);Label PREPARACION Top section
GUICtrlSetColor(-1, 0xFF0000)
GUISetState(@SW_SHOW)
$NewRecipeButton = GUICtrlCreateButton("New Recipe", 40, 0, 125, 42, $WS_GROUP) ;TAMANO Y POSICION DEL BOTON DE NEW RECIPE
GUICtrlSetFont(-1, 11, 800, 2, "HandelGotDL") ;TAMANO DE LETRA DEL BOTON DE NEW RECIPE
$RecipeListBox = GUICtrlCreateList("", 10, 45, 200, 450) ;TAMANO Y UBICACION DEL CUADRO DE LIST
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman") ;TAMANO DE LETRA DE LIST
$TitleInput = GUICtrlCreateInput("", 270, 15, 335, 30) ;TAMANO Y UBICACION CUADRO TITULO
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
Dim $Ing[11]
Dim $Q[11]
Dim $QT[11]
$Ing[1] = GUICtrlCreateInput("", 265, 80, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[1] = GUICtrlCreateInput("", 220, 80, 40, 25)
$Ing[2] = GUICtrlCreateInput("", 265, 105, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[2] = GUICtrlCreateInput("", 220, 105, 40, 25)
$Ing[3] = GUICtrlCreateInput("", 265, 130, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[3] = GUICtrlCreateInput("", 220, 130, 40, 25)
$Ing[4] = GUICtrlCreateInput("", 265, 155, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[4] = GUICtrlCreateInput("", 220, 155, 40, 25)
$Ing[5] = GUICtrlCreateInput("", 265, 180, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[5] = GUICtrlCreateInput("", 220, 180, 40, 25)
$Ing[6] = GUICtrlCreateInput("", 500, 80, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[6] = GUICtrlCreateInput("", 455, 80, 40, 25)
$Ing[7] = GUICtrlCreateInput("", 500, 105, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[7] = GUICtrlCreateInput("", 455, 105, 40, 25)
$Ing[8] = GUICtrlCreateInput("", 500, 130, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[8] = GUICtrlCreateInput("", 455, 130, 40, 25)
$Ing[9] = GUICtrlCreateInput("", 500, 155, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[9] = GUICtrlCreateInput("", 455, 155, 40, 25)
$Ing[10] = GUICtrlCreateInput("", 500, 180, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[10] = GUICtrlCreateInput("", 455, 180, 40, 25)
$InstructionBox = GUICtrlCreateEdit("", 220, 250, 500, 200, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL)) ; CUADRO DE PREPARAION
GUICtrlSetFont(-1, 13, 400, 2, "Times New Roman")
$SaveButton = GUICtrlCreateButton("Save", 280, 453, 165, 42, $WS_GROUP) ; BOTON DE SAVE
GUICtrlSetFont(-1, 15, 800, 2, "HandelGotDL") ; LETRA DEL BOTON DE SAVE
$DiscardButton = GUICtrlCreateButton("Discard", 495, 453, 165, 42, $WS_GROUP) ; BOTON DE DISCAR
GUICtrlSetFont(-1, 15, 800, 2, "HandelGotDL") ; LETRA DEL BOTON DE DISCAR
LoadFirstRecipe()
RecipeListBoxRefresh()
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $RecipeListBox
LoadRecipe()
Case $NewRecipeButton
NewRecipe()
Case $SaveButton
SaveRecipe()
Case $DiscardButton
Discard()
EndSwitch
WEnd
Func NewRecipe()
$SaveTitleData = GUICtrlRead($TitleInput)
If FileExists(@ScriptDir & "\SB-" & $SaveTitleData & ".txt") Then
ResetInputs()
Else
$ForgotSaveMsgBox = MsgBox(4, "Save?", "Before you go on, do you want to save this " & $SaveTitleData & " recipe?")
If $ForgotSaveMsgBox = 6 then
WriteSaveFile()
ResetInputs()
Else
ResetInputs()
EndIf
EndIf
EndFunc
Func ResetInputs()
GUICtrlSetData($TitleInput, "")
For $Number = 1 to 10
GUICtrlSetData($Ing[$Number], "")
GUICtrlSetData($Q[$Number], "")
Next
GUICtrlSetData($InstructionBox, "")
EndFunc
Func SaveRecipe()
$SaveTitleData = GUICtrlRead($TitleInput)
If FileExists(@ScriptDir & "\SB-" & $SaveTitleData & ".txt") Then
$OverwriteMsgBox = MsgBox(4, "Overwrite?", "Do you want to overwrite your other " & $SaveTitleData & " recipe?")
If $OverwriteMsgBox = 6 then
FileDelete(@ScriptDir & "\PB-" & $SaveTitleData & ".txt")
WriteSaveFile()
EndIf
Else
WriteSaveFile()
EndIf
EndFunc
Func WriteSaveFile()
$SaveTitleData = GUICtrlRead($TitleInput)
FileWrite(@ScriptDir & "\SB-" & $SaveTitleData & ".txt", $SaveTitleData & @TAB)
For $Number = 1 to 10
$SaveIngData = GUICtrlRead($Ing[$Number])
FileWrite(@ScriptDir & "\SB-" & $SaveTitleData & ".txt", $SaveIngData & @TAB)
$SaveQData = GUICtrlRead($Q[$Number])
FileWrite(@ScriptDir & "\SB-" & $SaveTitleData & ".txt", $SaveQData & @TAB)
$SaveQTData = GUICtrlRead($QT[$Number])
FileWrite(@ScriptDir & "\SB-" & $SaveTitleData & ".txt", $SaveQTData & @TAB)
Next
$SaveInstructionData = GUICtrlRead($InstructionBox)
FileWrite(@ScriptDir & "\SB-" & $SaveTitleData & ".txt", $SaveInstructionData)
If FileExists(@ScriptDir & "\SB-" & $SaveTitleData & ".txt") Then
MsgBox(0, "Success!", "Your " & $SaveTitleData & " recipe has been saved.")
RecipeListBoxRefresh()
EndIf
EndFunc
Func RecipeListBoxRefresh()
GUICtrlSetData($RecipeListBox, "")
$FileSearch = FileFindFirstFile("SB-*.*")
While 1
$RecipeFile = FileFindNextFile($FileSearch)
If @Error Then ExitLoop
GUICtrlSetData($RecipeListBox, $RecipeFile & "|")
WEnd
FileClose($FileSearch)
EndFunc
Func LoadFirstRecipe()
GUICtrlSetData($RecipeListBox, "")
$FileSearch = FileFindFirstFile("SB-*.*")
$RecipeFile = FileFindNextFile($FileSearch)
If @Error Then
MsgBox(0, "No recipes!", "You don't have any recipes yet.")
Else
$LoadData=FileRead(@ScriptDir & "\" & $RecipeFile )
$LoadData = StringSplit($LoadData, @TAB)
GUICtrlSetData($TitleInput, $LoadData[1])
For $Number = 1 to 10
$ArrayNumber=3 * $Number - 1
GUICtrlSetData($Ing[$Number], $LoadData[$ArrayNumber])
$ArrayNumber=3 * $Number
GUICtrlSetData($Q[$Number], $LoadData[$ArrayNumber])
$ArrayNumber=3 * $Number + 1
GUICtrlSetData($QT[$Number], $LoadData[$ArrayNumber])
Next
GUICtrlSetData($InstructionBox, $LoadData[32])
EndIf
EndFunc
Func LoadRecipe()
$SaveTitleData = GUICtrlRead($TitleInput)
If FileExists(@ScriptDir & "\SB-" & $SaveTitleData & ".txt") Then
LoadSaveFile()
Else
$ForgotSaveMsgBox = MsgBox(4, "Save?", "Before you go on, do you want to save this " & $SaveTitleData & " recipe?")
If $ForgotSaveMsgBox = 6 then
SaveRecipe()
LoadSaveFile()
Else
LoadSaveFile()
EndIf
EndIf
EndFunc
Func LoadSaveFile()
$RecipePressed = GUICtrlRead($RecipeListBox)
$LoadData=FileRead(@ScriptDir & "\" & $RecipePressed )
$LoadData = StringSplit($LoadData, @TAB)
GUICtrlSetData($TitleInput, $LoadData[1])
For $Number = 1 to 10
$ArrayNumber=3 * $Number - 1
GUICtrlSetData($Ing[$Number], $LoadData[$ArrayNumber])
$ArrayNumber=3 * $Number
GUICtrlSetData($Q[$Number], $LoadData[$ArrayNumber])
$ArrayNumber=3 * $Number + 1
GUICtrlSetData($QT[$Number], $LoadData[$ArrayNumber])
Next
GUICtrlSetData($InstructionBox, $LoadData[32])
EndFunc
Func Discard()
$SaveTitleData = GUICtrlRead($TitleInput)
$DeleteMsgBox = MsgBox(4, "Delete?", "Are you sure you want to delete your " & $SaveTitleData & " recipe?")
If $DeleteMsgBox = 6 Then
ResetInputs()
If FileExists(@ScriptDir & "\SB-" & $SaveTitleData & ".txt") then FileDelete(@ScriptDir & "\SB-" & $SaveTitleData & ".txt")
RecipeListBoxRefresh()
EndIf
EndFunc
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#Include <Array.au3>
$GUI = GUICreate("RECIPES", 800, 500, 0 ,0, $WS_POPUP ) ;CUADRO TOTAL TAMANO CON FRAMELESS
GUICtrlCreateLabel("INGREDIENTES",220,65,80,20);Label INGREDIENTES Top section
GUICtrlSetColor(-1, 0xff0000)
GUISetState(@SW_SHOW)
GUICtrlCreateLabel("PREPARACION",220,235,80,20);Label PREPARACION Top section
GUICtrlSetColor(-1, 0xFF0000)
GUISetState(@SW_SHOW)
$NewRecipeButton = GUICtrlCreateButton("New Recipe", 40, 0, 125, 42, $WS_GROUP) ;TAMANO Y POSICION DEL BOTON DE NEW RECIPE
GUICtrlSetFont(-1, 11, 800, 2, "HandelGotDL") ;TAMANO DE LETRA DEL BOTON DE NEW RECIPE
$RecipeListBox = GUICtrlCreateList("", 10, 45, 200, 450) ;TAMANO Y UBICACION DEL CUADRO DE LIST
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman") ;TAMANO DE LETRA DE LIST
$TitleInput = GUICtrlCreateInput("", 270, 15, 335, 30) ;TAMANO Y UBICACION CUADRO TITULO
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
Dim $Ing[11]
Dim $Q[11]
Dim $QT[11]
$Ing[1] = GUICtrlCreateInput("", 265, 80, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[1] = GUICtrlCreateInput("", 220, 80, 40, 25)
$Ing[2] = GUICtrlCreateInput("", 265, 105, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[2] = GUICtrlCreateInput("", 220, 105, 40, 25)
$Ing[3] = GUICtrlCreateInput("", 265, 130, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[3] = GUICtrlCreateInput("", 220, 130, 40, 25)
$Ing[4] = GUICtrlCreateInput("", 265, 155, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[4] = GUICtrlCreateInput("", 220, 155, 40, 25)
$Ing[5] = GUICtrlCreateInput("", 265, 180, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[5] = GUICtrlCreateInput("", 220, 180, 40, 25)
$Ing[6] = GUICtrlCreateInput("", 500, 80, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[6] = GUICtrlCreateInput("", 455, 80, 40, 25)
$Ing[7] = GUICtrlCreateInput("", 500, 105, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[7] = GUICtrlCreateInput("", 455, 105, 40, 25)
$Ing[8] = GUICtrlCreateInput("", 500, 130, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[8] = GUICtrlCreateInput("", 455, 130, 40, 25)
$Ing[9] = GUICtrlCreateInput("", 500, 155, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[9] = GUICtrlCreateInput("", 455, 155, 40, 25)
$Ing[10] = GUICtrlCreateInput("", 500, 180, 185, 25)
GUICtrlSetFont(-1, 12, 400, 2, "Times New Roman")
$Q[10] = GUICtrlCreateInput("", 455, 180, 40, 25)
$InstructionBox = GUICtrlCreateEdit("", 220, 250, 500, 200, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL)) ; CUADRO DE PREPARAION
GUICtrlSetFont(-1, 13, 400, 2, "Times New Roman")
$SaveButton = GUICtrlCreateButton("Save", 280, 453, 165, 42, $WS_GROUP) ; BOTON DE SAVE
GUICtrlSetFont(-1, 15, 800, 2, "HandelGotDL") ; LETRA DEL BOTON DE SAVE
$DiscardButton = GUICtrlCreateButton("Discard", 495, 453, 165, 42, $WS_GROUP) ; BOTON DE DISCAR
GUICtrlSetFont(-1, 15, 800, 2, "HandelGotDL") ; LETRA DEL BOTON DE DISCAR
LoadFirstRecipe()
RecipeListBoxRefresh()
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $RecipeListBox
LoadRecipe()
Case $NewRecipeButton
NewRecipe()
Case $SaveButton
SaveRecipe()
Case $DiscardButton
Discard()
EndSwitch
WEnd
Func NewRecipe()
$SaveTitleData = GUICtrlRead($TitleInput)
If FileExists(@ScriptDir & "\SB-" & $SaveTitleData & ".txt") Then
ResetInputs()
Else
$ForgotSaveMsgBox = MsgBox(4, "Save?", "Before you go on, do you want to save this " & $SaveTitleData & " recipe?")
If $ForgotSaveMsgBox = 6 then
WriteSaveFile()
ResetInputs()
Else
ResetInputs()
EndIf
EndIf
EndFunc
Func ResetInputs()
GUICtrlSetData($TitleInput, "")
For $Number = 1 to 10
GUICtrlSetData($Ing[$Number], "")
GUICtrlSetData($Q[$Number], "")
Next
GUICtrlSetData($InstructionBox, "")
EndFunc
Func SaveRecipe()
$SaveTitleData = GUICtrlRead($TitleInput)
If FileExists(@ScriptDir & "\SB-" & $SaveTitleData & ".txt") Then
$OverwriteMsgBox = MsgBox(4, "Overwrite?", "Do you want to overwrite your other " & $SaveTitleData & " recipe?")
If $OverwriteMsgBox = 6 then
FileDelete(@ScriptDir & "\PB-" & $SaveTitleData & ".txt")
WriteSaveFile()
EndIf
Else
WriteSaveFile()
EndIf
EndFunc
Func WriteSaveFile()
$SaveTitleData = GUICtrlRead($TitleInput)
FileWrite(@ScriptDir & "\SB-" & $SaveTitleData & ".txt", $SaveTitleData & @TAB)
For $Number = 1 to 10
$SaveIngData = GUICtrlRead($Ing[$Number])
FileWrite(@ScriptDir & "\SB-" & $SaveTitleData & ".txt", $SaveIngData & @TAB)
$SaveQData = GUICtrlRead($Q[$Number])
FileWrite(@ScriptDir & "\SB-" & $SaveTitleData & ".txt", $SaveQData & @TAB)
$SaveQTData = GUICtrlRead($QT[$Number])
FileWrite(@ScriptDir & "\SB-" & $SaveTitleData & ".txt", $SaveQTData & @TAB)
Next
$SaveInstructionData = GUICtrlRead($InstructionBox)
FileWrite(@ScriptDir & "\SB-" & $SaveTitleData & ".txt", $SaveInstructionData)
If FileExists(@ScriptDir & "\SB-" & $SaveTitleData & ".txt") Then
MsgBox(0, "Success!", "Your " & $SaveTitleData & " recipe has been saved.")
RecipeListBoxRefresh()
EndIf
EndFunc
Func RecipeListBoxRefresh()
GUICtrlSetData($RecipeListBox, "")
$FileSearch = FileFindFirstFile("SB-*.*")
While 1
$RecipeFile = FileFindNextFile($FileSearch)
If @Error Then ExitLoop
GUICtrlSetData($RecipeListBox, $RecipeFile & "|")
WEnd
FileClose($FileSearch)
EndFunc
Func LoadFirstRecipe()
GUICtrlSetData($RecipeListBox, "")
$FileSearch = FileFindFirstFile("SB-*.*")
$RecipeFile = FileFindNextFile($FileSearch)
If @Error Then
MsgBox(0, "No recipes!", "You don't have any recipes yet.")
Else
$LoadData=FileRead(@ScriptDir & "\" & $RecipeFile )
$LoadData = StringSplit($LoadData, @TAB)
GUICtrlSetData($TitleInput, $LoadData[1])
For $Number = 1 to 10
$ArrayNumber=3 * $Number - 1
GUICtrlSetData($Ing[$Number], $LoadData[$ArrayNumber])
$ArrayNumber=3 * $Number
GUICtrlSetData($Q[$Number], $LoadData[$ArrayNumber])
$ArrayNumber=3 * $Number + 1
GUICtrlSetData($QT[$Number], $LoadData[$ArrayNumber])
Next
GUICtrlSetData($InstructionBox, $LoadData[32])
EndIf
EndFunc
Func LoadRecipe()
$SaveTitleData = GUICtrlRead($TitleInput)
If FileExists(@ScriptDir & "\SB-" & $SaveTitleData & ".txt") Then
LoadSaveFile()
Else
$ForgotSaveMsgBox = MsgBox(4, "Save?", "Before you go on, do you want to save this " & $SaveTitleData & " recipe?")
If $ForgotSaveMsgBox = 6 then
SaveRecipe()
LoadSaveFile()
Else
LoadSaveFile()
EndIf
EndIf
EndFunc
Func LoadSaveFile()
$RecipePressed = GUICtrlRead($RecipeListBox)
$LoadData=FileRead(@ScriptDir & "\" & $RecipePressed )
$LoadData = StringSplit($LoadData, @TAB)
GUICtrlSetData($TitleInput, $LoadData[1])
For $Number = 1 to 10
$ArrayNumber=3 * $Number - 1
GUICtrlSetData($Ing[$Number], $LoadData[$ArrayNumber])
$ArrayNumber=3 * $Number
GUICtrlSetData($Q[$Number], $LoadData[$ArrayNumber])
$ArrayNumber=3 * $Number + 1
GUICtrlSetData($QT[$Number], $LoadData[$ArrayNumber])
Next
GUICtrlSetData($InstructionBox, $LoadData[32])
EndFunc
Func Discard()
$SaveTitleData = GUICtrlRead($TitleInput)
$DeleteMsgBox = MsgBox(4, "Delete?", "Are you sure you want to delete your " & $SaveTitleData & " recipe?")
If $DeleteMsgBox = 6 Then
ResetInputs()
If FileExists(@ScriptDir & "\SB-" & $SaveTitleData & ".txt") then FileDelete(@ScriptDir & "\SB-" & $SaveTitleData & ".txt")
RecipeListBoxRefresh()
EndIf
EndFunc