Jump to content
Sign in to follow this  
Yata

Continue my loop after results window is closed.

Recommended Posts

Yata

I have made a program to strip URLs from deviantART into their bbcode for thumbnails. Having a limited grasp of how loops work I fail to make my program loop back so that when the results window is closed the program doesn't end entirely, and the main window is still there and functional.

Here is my code:

;(C) Copyright Shawn G.

#NoTrayIcon
#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=icons.ico
#AutoIt3Wrapper_outfile=Thumb Extract.exe
#AutoIt3Wrapper_UseAnsi=y
#AutoIt3Wrapper_Res_Comment=A huge thank you to the AutoIt support forum members for their great help and example code.
#AutoIt3Wrapper_Res_Description=Thumbcode creator.
#AutoIt3Wrapper_Res_Fileversion=0.1.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Cooyright 2008 Shawn G. (Yatagratsu)
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Res_Field=Created by|Shawn G.
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>

Func help()
    MsgBox ( 0, "Thumb Extract Help", "Thumb Extract is a small program by Yatagratsu that takes inputed deviantART Deviation URLs and transforms them into a thumbcode you can use to create thumbnails on various areas of deviantART. You do not have to fill in all the fields, meaning you can create anywhere from 1-5 thumbcodes at any one instance of transforming the field's URLs. This program is ideal for users gathering thumbcode for the dAmn chartroom #Thumbsshare as well. In the incident of the program not running, or if you were to encounter an error or even have a comment about the program in general, you may email zyekye@gmail.com with what you have to say." )
EndFunc

GUICreate("Thumb Extract", 425, 259)
    $text = GUICtrlCreateLabel ( "Enter Deviation URLs:", 10, 5 )
    $input1 = GUICtrlCreateInput ( "", 10, 30, 400 )
    $input2 = GUICtrlCreateInput ( "", 10, 55 )
    $input3 = GUICtrlCreateInput ( "", 10, 80 )
    $input4 = GUICtrlCreateInput ( "", 10, 105 )
    $input5 = GUICtrlCreateInput ( "", 10, 130 )
    $button = GUICtrlCreateButton ( "Gather Thumbcode", 60, 190, 100, 23 )
    $help = GUICtrlCreateButton ( "Need Help?", 240, 190, 100, 23 )
    GUISetState (@SW_SHOW)


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
            
        Case $msg = $help
            Call ( "help" )
            
        Case $msg = $button
            $string = GUICtrlRead($input1)
            $string2 = GUICtrlRead($input2)
            $string3 = GUICtrlRead($input3)
            $string4 = GUICtrlRead($input4)
            $string5 = GUICtrlRead($input5)
            $a = $string
            $a2 = $string2
            $a3 = $string3
            $a4 = $string4
            $a5 = $string5
            Call ( "thumbextract" )
            Call ( "results" )
    EndSelect
Wend

Func thumbextract()
    $a = StringRegExp ( $string,'.+-(\d+)',3 )
    $a2 = StringRegExp ( $string2,'.+-(\d+)',3 )
    $a3 = StringRegExp ( $string3,'.+-(\d+)',3 )
    $a4 = StringRegExp ( $string4,'.+-(\d+)',3 )
    $a5 = StringRegExp ( $string5,'.+-(\d+)',3 )
EndFunc

Func results()
    GUICreate("Thumbs Extracted", 300, 150, -1 )
    $parse=""
        if UBound($a)<>0 then $parse&=":thumb" & $a[0] & ": "
        if UBound($a2)<>0 then $parse&=":thumb" & $a2[0] & ": "
        if UBound($a3)<>0 then $parse&=":thumb" & $a3[0] & ": "
        if UBound($a4)<>0 then $parse&=":thumb" & $a4[0] & ": "
        if UBound($a5)<>0 then $parse&=":thumb" & $a5[0] & ": "
    GUICtrlCreateEdit( $parse, 10, 12, 275, 100, 0x0800)
    GUISetState(@SW_SHOW)
EndFunc

Sorry for the bit of a moronic question, but I'm really struggling with this. Thank you all for all the help you've given me.

Share this post


Link to post
Share on other sites
YellowLab

EDIT:

Delete - Oops. Misread post.

I think you may want to look at some of the window styles such as $WS_POPUPWINDOW and make it a child window to the main window (parent). Also, you will need to reset all your data entry points when the results window is either opened or closed.

Hope this helps.

Bob

Edited by YellowLab

You can't see a rainbow without first experiencing the rain.

Share this post


Link to post
Share on other sites
Yata

I really need example code here.. that's where I'm failing at this.

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  

×