Jump to content

Recommended Posts

Posted

Hi,

I'm trying to create a simple autoit GUI. There will be two steps, one to obtain the pc IP, then to have the user start the data backup and to show a progress bar. I would like to know if is a good idea or how to use functions when the selection is made and check for errorlevels. I appreciate any help anyone can give me. I will continue to read through the help files.

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

GuiCreate("MyGUI", 559, 256,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$IP_1 = GuiCtrlCreateButton("Get_IP", 50, 70, 190, 50)
$Input_2 = GuiCtrlCreateInput("", 260, 80, 280, 30)
$Data_3 = GuiCtrlCreateButton("Backup Data", 50, 130, 190, 50)
$Progress_4 = GuiCtrlCreateProgress(260, 140, 270, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $IP_1
    ;????   
    Case $msg = $Data_3
    ;???
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---


;;:::Fuction Here ??
Posted

Is this the correct way of calling a function? How do I set for errorlevels. I'm also trying to make the progress to run when select. How can I link it to run from Progress_4 section?

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

GuiCreate("MyGUI", 559, 256,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$IP_1 = GuiCtrlCreateButton("Get_IP", 50, 70, 190, 50)
;$Input_IpAddress = GuiCtrlCreateInput("" & @IPAddress1, 180, 250, 280, 20)
$Input_2 = GuiCtrlCreateInput("", 260, 80, 280, 30)
$Data_3 = GuiCtrlCreateButton("Backup Data", 50, 130, 190, 50)
$Progress_4 = GuiCtrlCreateProgress(260, 140, 270, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $IP_1
        IP()
    Case $msg = $Data_3
        Progress ()
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---


;;:::Fuction Here ??
Func IP()
    GuiCtrlSetData($Input_2, @IPAddress1)
EndFunc ;==>Set_Exit

Func Progress()
    ProgressOn("Progress...", "Backup in Progress", "0 percent" & $Progress_4)
    For $i = 10 to 100 step 10
    sleep(1000)
    ProgressSet( $i, $i & " percent")
    Next
    ProgressSet(100 , "Done", "Complete")
    sleep(500)
    ProgressOff()
EndFunc ;==>Set_Exit

make a little effort... look for _GetIP() in help

8)

Posted

I been trying to get the function with error codes to work, but I'm stuck. When I have the correct path define it launches the setup, but I change it, the error msgbox does not appear. Any better way to do this, or what Am I missing?

Func AOLSetup()
    SetError (1)
    Run("V:\AOL\Setup.exe") 
    If @error = 1 Then
        MsgBox(0x10,"Error", "Executable Not Found!")
    Else
    EndIf
EndFunc ;==>Set_Exit

Search in forum and in HelpFile for keywords: func,progress,@error and so on ...

Posted

I been trying to get the function with error codes to work, but I'm stuck. When I have the correct path define it launches the setup, but I change it, the error msgbox does not appear. Any better way to do this, or what Am I missing?

Func AOLSetup()
    SetError (1)
    Run("V:\AOL\Setup.exe") 
    If @error = 1 Then
        MsgBox(0x10,"Error", "Executable Not Found!")
    Else
    EndIf
EndFunc;==>Set_Exit
first solution: at your script use AutoItSetOption - RunErrorsFatal

second solution:

Func AOLSetup()
    If FileExists("V:\AOL\Setup.exe") Then
        Run("V:\AOL\Setup.exe") 
    Else
        SetError (1)
        MsgBox(0x10,"Error", "Executable Not Found!")
    EndIf
EndFunc
Posted

Thanks, I will try it and let you know.

first solution: at your script use AutoItSetOption - RunErrorsFatal

second solution:

Func AOLSetup()
    If FileExists("V:\AOL\Setup.exe") Then
        Run("V:\AOL\Setup.exe") 
    Else
        SetError (1)
        MsgBox(0x10,"Error", "Executable Not Found!")
    EndIf
EndFunc
Posted

One Last question.

When I compile the script, how can I set an setup icon or change the default autoit icon with something else? for example: See between the +

$Title = GuiCreate(++ Icon here++ "AOL Software Installation", 700, 440,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

Thanks, I will try it and let you know.

Posted

I do not wish the use the icons in the Autoexe, instead I would like to add a customize icon. Something that represents what the application is. It's silly, but I would like to know how to do it.

When you compile the script by running AutToExe, you can select an icon in the GUI.

Posted

You'd use PhotoShop. Check out this icon I made...

P.S. - It looks much better in Explorer then on the desktop.

B.ico

Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
Posted

And another... This looks better, I thought of adding 'progress bars' to simulate the ones in your GUI.

P.S. - Again, this looks better in explorer then on the desktop.

B2.ico

Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
Posted

Cool, the only problem is that I don't have Photoshop. Maybe I can buy one later. But I like it. Is it possible to convert an DLL Control ID # 162 to an icon? Let me know.

And another... This looks better, I thought of adding 'progress bars' to simulate the ones in your GUI.

P.S. - Again, this looks better in explorer then on the desktop.

Posted

Finish.

Thanks everyone for all the help. I am finally done with my silly project. My friend will be really happy (I hope). I was able to create an Icon from the Shell32.dll file. There is software call "MicroAngelo" that is capable of either creating a new icon or find an icon. When the DVD is created, there's an autorun that launches the autoit executable with the Setup Icon as well. This may not be useful for most of you, but I'd thought I share this information anyway. Attached is a picture of the autorun.

Cool, the only problem is that I don't have Photoshop. Maybe I can buy one later. But I like it. Is it possible to convert an DLL Control ID # 162 to an icon? Let me know.

Finish.bmp

Posted

Or, instead of normal compiling, choose "Compile with options"

Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
Posted

or...

#Compiler_Icon = C:\path\to\where\I\keep\my\icons\my-icon.icooÝ÷ Øò¢ébëhç©jYr¢êârìz'zZqã§¶¬¹¸ÞrÚÊ'°È®'éh«yéíç(¢W¬¶'(çb¶ß¢¹,j»éÞjÛax"¶¬Ëaz«¨¶X­ªâjz®¢Ð,Áéejǧi¹b¨ºÚ­¨"rì®(!¶­¡÷eƧuì^rëZnW¬¦ëm«[i¼¢*.­Ê'µìméî~ÞÅçâë7Þ+ZZ0³*.¶½ë(ëaxjY^v«¨¶'(X­ªâzÊ®¢×âë¢{Zx§©òézºÊ'±8^±èZ½æ§ªê-Éjº^Æ×§²*'nër¢ç欩àzØZ¶Ú*º]Z®¢Öµêðj·ljwn±èî²Ùb쨺h Û¬zÈ^]övYM£¨¹Æ§iDzËaz'(Æò¶¢®)Ý{§v붦h¢¼¨º¶©¦Xjبlv.éí±»­~â¶Æî¶Ú'°ezW¦z{lz׵Ʈ¶­sduT7G&Å6WDÖvRb33c¶×ö'WGFöâÂgV÷C¶×ö6öç2æFÆÂgV÷C²Âb33c¶6öåöæFW

Technically, there's no real limit to the dimensions of icons stored in there, so you can use it for GUI images, too. And being icons, they keep thier transparencies; very handy for buttons.

I find all this very useful, you might, too.

-mu

Posted

Thank you for the advise. I will play with it more. It's a cool software once you know how to use it.

Take care.

or...

#Compiler_Icon = C:\path\to\where\I\keep\my\icons\my-icon.icooÝ÷ Øò¢ébëhç©jYr¢êârìz'zZqã§¶¬¹¸ÞrÚÊ'°È®'éh«yéíç(¢W¬¶'(çb¶ß¢¹,j»éÞjÛax"¶¬Ëaz«¨¶X­ªâjz®¢Ð,Áéejǧi¹b¨ºÚ­¨"rì®(!¶­¡÷eƧuì^rëZnW¬¦ëm«[i¼¢*.­Ê'µìméî~ÞÅçâë7Þ+ZZ0³*.¶½ë(ëaxjY^v«¨¶'(X­ªâzÊ®¢×âë¢{Zx§©òézºÊ'±8^±èZ½æ§ªê-Éjº^Æ×§²*'nër¢ç欩àzØZ¶Ú*º]Z®¢Öµêðj·ljwn±èî²Ùb쨺h Û¬zÈ^]övYM£¨¹Æ§iDzËaz'(Æò¶¢®)Ý{§v붦h¢¼¨º¶©¦Xjبlv.éí±»­~â¶Æî¶Ú'°ezW¦z{lz׵Ʈ¶­sduT7G&Å6WDÖvRb33c¶×ö'WGFöâÂgV÷C¶×ö6öç2æFÆÂgV÷C²Âb33c¶6öåöæFW

Technically, there's no real limit to the dimensions of icons stored in there, so you can use it for GUI images, too. And being icons, they keep thier transparencies; very handy for buttons.

I find all this very useful, you might, too.

-mu

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...