Jump to content

I know I'm missing the obvious...


Liderc
 Share

Recommended Posts

Alright, I have been working on this script for the better part of 2 weeks. I need this thing to be finished. :whistle: Anyway, I have used AutoIt to create a calculator for quick computation of material. I almost have it completed, but I'm just getting hung up at one part.

;----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:         A.N.Other <myemail@nowhere.com>
;
; Script Function:
;   Template AutoIt script.
;
; ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <GUIConstants.au3>

; Create the GUI window and controls

GuiCreate("Glastic Weight Calculator", 395, 200)
$Total_button = GuiCtrlCreateButton("Total", 319, 175, 55, 20, $BS_VCENTER)
$Skid = GUICtrlCreateDummy()

;Row 1
;========

GUICtrlCreateLabel("# of Sheets", 20, 5, 35, 30, $ES_CENTER)
GUICtrlCreateLabel("Size", 80, 19, 35, "", $ES_CENTER)
GUICtrlCreateLabel("Thickness", 151, 19, 53)
GUICtrlCreateLabel("Material", 237, 19, 50)
GUICtrlCreateLabel("lbs.", 375, 37, 15)
$Sheets_1 = GuiCtrlCreateInput("", 20, 35, 35, 21, 0x2000)
$Size_1 = GuiCtrlCreateCombo("", 75, 35, 55, 21)
GuiCtrlSetData($Size_1, "3' x 6'|4' x 8'", "3' x 6'")
$Thickness_1 = GuiCtrlCreateCombo("0.031", 150, 35, 55, 21)
GuiCtrlSetData($Thickness_1, "0.063|0.094|0.125|0.188|0.250|0.375|0.500|0.625|0.750|1.000", "0.031")
$Material_1 = GuiCtrlCreateCombo("", 225, 35, 65, 21)
GuiCtrlSetData($Material_1, "GPO-1|GPO-3|SG-200", "GPO-1")
$Total_1 = GuiCtrlCreateLabel("", 320, 37, 50, 18, BitOR($SS_SUNKEN, $ES_CENTER)) ; (Example: $SS_...+$SS_...)
$Volume_1 = GUICtrlCreateDummy()

; Mathematical Function of Script
;   Select 
;       Case GUICtrlRead($Size_1) = "3' x 6'"
;           Select
;               Case GUICtrlRead($Thickness_1) = "0.031" AND GUICtrlRead($Material_1) = "GPO-1"
;                   GUICtrlSendToDummy($Volume_1, 5)
;               Case GUICtrlRead($Thickness_1) = "0.063" AND GUICtrlRead($Material_1) = "GPO-1"
;                   GUICtrlSendToDummy($Volume_1, 10)
;               Case GUICtrlRead($Thickness_1) = "0.094" AND GUICtrlRead($Material_1) = "GPO-1"
;                   GUICtrlSendToDummy($Volume_1, 16)
;           EndSelect
;       GUICtrlSendToDummy($Skid, 68)
;   EndSelect



; Run the GUI until it is closed
GuiSetState()
While 1
If GUICtrlRead($Size_1) = "3' x 6'" Then
    Select
        Case GUICtrlRead($Thickness_1) = "0.031" AND GUICtrlRead($Material_1) = "GPO-1"
            GUICtrlSendToDummy($Volume_1, 5)
        Case GUICtrlRead($Thickness_1) = "0.063" AND GUICtrlRead($Material_1) = "GPO-1"
            GUICtrlSendToDummy($Volume_1, 10)
        Case GUICtrlRead($Thickness_1) = "0.094" AND GUICtrlRead($Material_1) = "GPO-1"
            GUICtrlSendToDummy($Volume_1, 16)
    EndSelect
EndIf
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    ;When button is pressed, label text is changed
    ;to combobox value
    Case $msg = $Total_button
      $data = GUICtrlRead($Volume_1)
      $data2 = GUICtrlRead($Sheets_1)
      $data3 = GUICtrlRead($Skid)
      If GUICtrlRead($Sheets_1) >= 1 Then
          GUICtrlSetData($Total_1, ($data * $data2) + $data3)
      ElseIf GUICtrlRead($Sheets_1) < 1 Then
          MsgBox(4160, "Missing Value", "Please enter a vaild sheet count.")
        EndIf
    EndSelect
WEnd
ExitoÝ÷ Øý¯x-®ì"¶az«¨´Séêºlµ«^éí®(!µ§íz»az«¨µ§B.إجrZ,yÚ®¢Ø^i׫#f¶¶Ø^ Táz{h²êi¢»mà±ë-jצz{ljZ'­©è¶«n! +k'§u:ºi²þ/Û²Ö­zg§µ*¶¸vØb±«­¢+Ø)%U%
ÑɱI ÀÌØíM¥é|ĤôÅÕ½ÐìÌÌäìàØÌäìÅÕ½ÐìQ¡¸(%M±Ð($%
ÍU%
ÑɱI ÀÌØíQ¡¥­¹ÍÍ|ĤôÅÕ½ÐìÀ¸ÀÌÄÅÕ½Ðì9U%
ÑɱI ÀÌØí5ÑÉ¥±|ĤôÅÕ½ÐíA

However, this locks up the script and no value is displayed in the label AND the script won't close normally. I have to manually kill the process for the script. I'm sure that I'm just missing the blatantly obvious, so don't be too harsh with the help. ;)

Link to comment
Share on other sites

maybe...

;----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:         A.N.Other <myemail@nowhere.com>
;
; Script Function:
;   Template AutoIt script.
;
; ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <GUIConstants.au3>

; Create the GUI window and controls

Dim $Volume_1

GuiCreate("Glastic Weight Calculator", 395, 200)
$Total_button = GuiCtrlCreateButton("Total", 319, 175, 55, 20, $BS_VCENTER)
$Skid = GUICtrlCreateDummy()

;Row 1
;========

GUICtrlCreateLabel("# of Sheets", 20, 5, 35, 30, $ES_CENTER)
GUICtrlCreateLabel("Size", 80, 19, 35, "", $ES_CENTER)
GUICtrlCreateLabel("Thickness", 151, 19, 53)
GUICtrlCreateLabel("Material", 237, 19, 50)
GUICtrlCreateLabel("lbs.", 375, 37, 15)
$Sheets_1 = GuiCtrlCreateInput("", 20, 35, 35, 21, 0x2000)
$Size_1 = GuiCtrlCreateCombo("", 75, 35, 55, 21)
GuiCtrlSetData($Size_1, "3' x 6'|4' x 8'", "3' x 6'")
$Thickness_1 = GuiCtrlCreateCombo("0.031", 150, 35, 55, 21)
GuiCtrlSetData($Thickness_1, "0.063|0.094|0.125|0.188|0.250|0.375|0.500|0.625|0.750|1.000", "0.031")
$Material_1 = GuiCtrlCreateCombo("", 225, 35, 65, 21)
GuiCtrlSetData($Material_1, "GPO-1|GPO-3|SG-200", "GPO-1")
$Total_1 = GuiCtrlCreateLabel("", 320, 37, 50, 18, BitOR($SS_SUNKEN, $ES_CENTER)) ; (Example: $SS_...+$SS_...)
;$Volume_1 = GUICtrlCreateDummy()

; Run the GUI until it is closed
GuiSetState()
While 1
If GUICtrlRead($Size_1) = "3' x 6'" Then
    Select
        Case GUICtrlRead($Thickness_1) = "0.031" AND GUICtrlRead($Material_1) = "GPO-1"
            ;GUICtrlSendToDummy($Volume_1, 5)
            $Volume_1 = 5
        Case GUICtrlRead($Thickness_1) = "0.063" AND GUICtrlRead($Material_1) = "GPO-1"
            ;GUICtrlSendToDummy($Volume_1, 10)
            $Volume_1 = 10
        Case GUICtrlRead($Thickness_1) = "0.094" AND GUICtrlRead($Material_1) = "GPO-1"
            ;GUICtrlSendToDummy($Volume_1, 16)
            $Volume_1 = 16
    EndSelect
EndIf
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    ;When button is pressed, label text is changed
    ;to combobox value
    Case $msg = $Total_button
      ;$data = GUICtrlRead($Volume_1)
      $data = $Volume_1
      $data2 = GUICtrlRead($Sheets_1)
      $data3 = GUICtrlRead($Skid)
      If GUICtrlRead($Sheets_1) >= 1 Then
          GUICtrlSetData($Total_1, ($data * $data2) + $data3)
      ElseIf GUICtrlRead($Sheets_1) < 1 Then
          MsgBox(4160, "Missing Value", "Please enter a vaild sheet count.")
        EndIf
    EndSelect
WEnd
Exit

8)

NEWHeader1.png

Link to comment
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
 Share

  • Recently Browsing   0 members

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