Sign in to follow this  
Followers 0
eynstyne

Function within a function

4 posts in this topic

#1 ·  Posted (edited)

How do you create a function within a function? Here's what I'm trying to do...

Func full()

hotkeyset("^c")
hotkeyset("^x")

$Full = GUICreate("Clipboard Full...", 302, 168, 192, 125, $WS_POPUP + $WS_BORDER, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
$face = GUICtrlCreatePic(@scriptdir & "\RESOURCES\CBFILL.bmp", 0, 0, 302, 168, 0)
$Title = GUICtrlCreatePic(@scriptdir & "\RESOURCES\CBTITLEBAR.bmp", 0, 0, 302, 20, -1, $GUI_WS_EX_PARENTDRAG)
$yes = GUICtrlCreatePic("E:\NX\RESOURCES\BUTTONS\yes.bmp", 200, 140, 47, 23, -1)
guictrlsetonevent(-1,"Yes")
$no = GUICtrlCreatePic("E:\NX\RESOURCES\BUTTONS\no.bmp", 250, 140, 47, 23, -1)
guictrlsetonevent(-1,"No")
GUISetState(@SW_SHOW)
While 1
        ;;;;;;;
    WEnd

func Yes()
    guictrlsetimage($yes, "E:\NX\RESOURCES\BUTTONS\yesclick.bmp")
    sleep(100)
    guictrlsetimage($yes, "E:\NX\RESOURCES\BUTTONS\noclick.bmp")
    $write1 = filewrite(@scriptdir & "\CLIP1.STO","")
    guictrlsetimage($pic3, @scriptdir & "\RESOURCES\CBEMPTY.bmp")
$write2 = filewrite(@scriptdir & "\CLIP2.STO","")
guictrlsetimage($pic4, @scriptdir & "\RESOURCES\CBEMPTY.bmp")
$write3 = filewrite(@scriptdir & "\CLIP3.STO","")
guictrlsetimage($pic5, @scriptdir & "\RESOURCES\CBEMPTY.bmp")
$write4 = filewrite(@scriptdir & "\CLIP4.STO","")
guictrlsetimage($pic6, @scriptdir & "\RESOURCES\CBEMPTY.bmp")
$write5 = filewrite(@scriptdir & "\CLIP5.STO","")
guictrlsetimage($pic11, @scriptdir & "\RESOURCES\CBEMPTY.bmp")
$write6 = filewrite(@scriptdir & "\CLIP6.STO","")
guictrlsetimage($pic7, @scriptdir & "\RESOURCES\CBEMPTY.bmp")
$write7 = filewrite(@scriptdir & "\CLIP7.STO","")
guictrlsetimage($pic8, @scriptdir & "\RESOURCES\CBEMPTY.bmp")
$write8 = filewrite(@scriptdir & "\CLIP8.STO","")
guictrlsetimage($pic9, @scriptdir & "\RESOURCES\CBEMPTY.bmp")
$write9 = filewrite(@scriptdir & "\CLIP9.STO","")
guictrlsetimage($pic10, @scriptdir & "\RESOURCES\CBEMPTY.bmp")
$write10 = filewrite(@scriptdir & "\CLIP10.STO","")
guictrlsetimage($pic12, @scriptdir & "\RESOURCES\CBEMPTY.bmp")
EndFunc

func no()
guictrlsetimage($no, "E:\NX\RESOURCES\BUTTONS\noclick.bmp")
sleep(100)
guictrlsetimage($no, "E:\NX\RESOURCES\BUTTONS\no.bmp")
    donothing()
EndFunc
endfunc  ;<---------- I tried putting the endfunc at the end, but it says that yes doesn't have and endfunc
Edited by eynstyne

F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]

Share this post


Link to post
Share on other sites



not tested in run/operation

#include <GuiConstants.au3>

Dim $yes, $no, $pic3, $pic4, $pic5, $pic6, $pic7, $pic8, $pic9, $pic10, $pic11, $pic12

Func full()
    
    HotKeySet("^c"); does not do anthing in autoit see help example - hotkeyset("^c", "yes")
    HotKeySet("^x")
    
    $Full = GUICreate("Clipboard Full...", 302, 168, 192, 125, $WS_POPUP + $WS_BORDER, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
    $face = GUICtrlCreatePic(@ScriptDir & "\RESOURCES\CBFILL.bmp", 0, 0, 302, 168, 0)
    $Title = GUICtrlCreatePic(@ScriptDir & "\RESOURCES\CBTITLEBAR.bmp", 0, 0, 302, 20, -1, $GUI_WS_EX_PARENTDRAG)
    $yes = GUICtrlCreatePic("E:\NX\RESOURCES\BUTTONS\yes.bmp", 200, 140, 47, 23, -1)
    GUICtrlSetOnEvent(-1, "Yes")
    $no = GUICtrlCreatePic("E:\NX\RESOURCES\BUTTONS\no.bmp", 250, 140, 47, 23, -1)
    GUICtrlSetOnEvent(-1, "No")
    GUISetState(@SW_SHOW)
    
    While 1
        Sleep(10)   ;;;;;;;
    WEnd
    
    
EndFunc  ;==>full

Func Yes()
    GUICtrlSetImage($yes, "E:\NX\RESOURCES\BUTTONS\yesclick.bmp")
    Sleep(100)
    GUICtrlSetImage($yes, "E:\NX\RESOURCES\BUTTONS\noclick.bmp")
    $write1 = FileWrite(@ScriptDir & "\CLIP1.STO", "")
    GUICtrlSetImage($pic3, @ScriptDir & "\RESOURCES\CBEMPTY.bmp")
    $write2 = FileWrite(@ScriptDir & "\CLIP2.STO", "")
    GUICtrlSetImage($pic4, @ScriptDir & "\RESOURCES\CBEMPTY.bmp")
    $write3 = FileWrite(@ScriptDir & "\CLIP3.STO", "")
    GUICtrlSetImage($pic5, @ScriptDir & "\RESOURCES\CBEMPTY.bmp")
    $write4 = FileWrite(@ScriptDir & "\CLIP4.STO", "")
    GUICtrlSetImage($pic6, @ScriptDir & "\RESOURCES\CBEMPTY.bmp")
    $write5 = FileWrite(@ScriptDir & "\CLIP5.STO", "")
    GUICtrlSetImage($pic11, @ScriptDir & "\RESOURCES\CBEMPTY.bmp")
    $write6 = FileWrite(@ScriptDir & "\CLIP6.STO", "")
    GUICtrlSetImage($pic7, @ScriptDir & "\RESOURCES\CBEMPTY.bmp")
    $write7 = FileWrite(@ScriptDir & "\CLIP7.STO", "")
    GUICtrlSetImage($pic8, @ScriptDir & "\RESOURCES\CBEMPTY.bmp")
    $write8 = FileWrite(@ScriptDir & "\CLIP8.STO", "")
    GUICtrlSetImage($pic9, @ScriptDir & "\RESOURCES\CBEMPTY.bmp")
    $write9 = FileWrite(@ScriptDir & "\CLIP9.STO", "")
    GUICtrlSetImage($pic10, @ScriptDir & "\RESOURCES\CBEMPTY.bmp")
    $write10 = FileWrite(@ScriptDir & "\CLIP10.STO", "")
    GUICtrlSetImage($pic12, @ScriptDir & "\RESOURCES\CBEMPTY.bmp")
EndFunc  ;==>Yes

Func no()
    GUICtrlSetImage($no, "E:\NX\RESOURCES\BUTTONS\noclick.bmp")
    Sleep(100)
    GUICtrlSetImage($no, "E:\NX\RESOURCES\BUTTONS\no.bmp")
    donothing()
EndFunc  ;==>no

Func donothing()
   ; nada
EndFunc  ;==>donothing

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Never mind, had to put the Dim statement in the beginning of the whole code...

Edited by eynstyne

F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]

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