Jump to content

ramin92003

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by ramin92003

  1. Thanks. Can you help me to create a custom input box for the following script by changing the Cancel button to Quit Button? While 1 $operation = InputBox("Title", "Choose one of the operations:" & @CRLF & "Addition (+)" & @CRLF & "Subtraction (-)" & @CRLF & "Multiple (*)" & @CRLF & "Division (/)") If $operation = "+" Or $operation = "-" Or $operation = "*" Or $operation = "/" Then MsgBox(0, "Basic Mathematics", "You Selected this Operation: " & $operation) ExitLoop ElseIf @error = 1 Then Exit ElseIf $operation <> "+" Or $operation <> "-" Or $operation <> "*" Or $operation <> "/" Or $operation = "" Then MsgBox(16, "Error", "The Operation Is Incorrect. Please Enter It Again.") ContinueLoop EndIf WEnd
  2. Sorry, The problem is when running the code nothing appears on the screen. I mean the window doesn't come up. This script should show the math operations when selecting one of them from the list.
  3. Hi, Can you help me to fix this scripts? Thanks! #include <Misc.au3> ; include statements to handdel basic input functions #include <MsgBoxConstants.au3> ; include statement to use message box object #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 254, 233, 516, 270) $List1 = GUICtrlCreateList("", 16, 8, 217, 149, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL)) ; BitOR style taken from help file $sItems = "+|-|*|/" GUICtrlSetData($List1, $sItems) _GUICtrlListBox_SetSel($List1, 1) ; Set position 1 (which is the 2nd in list) as default $Button1 = GUICtrlCreateButton("Select", 80, 176, 75, 25) GUISetState(@SW_SHOW) Local $aaa $aaa = $Button1 $selItems = _GUICtrlListBox_GetSelItemsText($sItems) While 1 Switch $aaa = GUIGetMsg() Case $aaa = $GUI_EVENT_CLOSE ExitLoop Case $selItems = "+" MsgBox(0, "You choose:"," +") Case $selItems = "-" MsgBox(0, "You choose:", "-" ) Case $selItems = "*" MsgBox(0, "You choose", "*") Case $selItems = "/" MsgBox(0, "You choose", "/" ) EndSwitch WEnd
  4. Hi, Is there any possibility to change the cancel button text to quit in the Inputbox?
  5. Thanks, @BrewManNH . How can I display sorted numbers in a message box instead of _ArrayDisplay ?
  6. Hi, How can I get the largest number to be the first number in a calculation? I did the below code but the largest number doesn't store in the $ aExtract variable. I need always a positive number from the calculation (the largest number be the first in the calculation). Can you help me with that? Thank you. $N1 = 33 $N2 = 45 Local $numberSort [2] = [$N1 , $N2] _ArraySort($numberSort, 1) _ArrayDisplay($numberSort, "Sort Descending", Default, 1) Local $aExtract = _ArrayExtract($numberSort, 0, 0, 0) _ArrayDisplay($aExtract, "Row 1 cols 1") $minus = $N1 - $N2
  7. Thank you so much @mLipok and @TheDcoder for your help. I have completely converted my code from Python to Autoit.
  8. But I can't still receive INVALID DEGREE PROGRAM message when I enter an invalid degree acronym. Can you please help me to fix this? Thank you.
  9. Thank you for your quick response. I have fixed the If...ElseIf...EndIf statements based on @mLipok and @TheDcoder posts, but when I enter a wrong degree acronym, it doesn't show the INVALID DEGREE PROGRAM message. Do I need to use while loop for this section? #include <Misc.au3> #include <MsgBoxConstants.au3> Local $hDLL = DllOpen("user32.dll") ; set local variable to capture user pressing ESC key $degree = InputBox("Enter the degree ","Enter the degree acronym: ","") Local $name = "" $maxEnrollment = 80 Dim $year1, $year2, $year3, $year4, $year5, $year6 If $degree = "BA" or $degree = "BSC" or $degree = "BIS" or $degree = "BBA" Then If $degree = "BA" Then $name = MsgBox (0,"Info", "Department of Bachelor of Arts") ElseIf $degree = "BSC" Then $name = MsgBox(0, "Info","Department of Bachelor of Science") ElseIf $degree = "BIS" Then $name = MsgBox(0,"Info","Department of Information Systems") ElseIf $degree = "BBA" Then $name = MsgBox(0, "Info", "Department of Bachelor of Administration") Else MsgBox(5, "Info", "INVALID DEGREE PROGRAM - PLEASE ENTER A NEW DEGREE PROGRAM") EndIf EndIf $year1 = InputBox("year 1 Students ","The # of students in Year 1: ","") If $year1 > $maxEnrollment Then MsgBox(5, "Warning", "Exceeds the limit") EndIf $year2 = InputBox("year 2 Students ","The # of students in Year 2: ","") If $year1 > $maxEnrollment Then MsgBox(5, "Warning", "Exceeds the limit") EndIf $year3 = InputBox("year 3 Students ","The # of students in Year 3: ","") If $year1 > $maxEnrollment Then MsgBox(5, "Warning", "Exceeds the limit") EndIf $year4 = InputBox("year 4 Students ","The # of students in Year 4: ","") If $year1 > $maxEnrollment Then MsgBox(5, "Warning", "Exceeds the limit") EndIf $year5 = InputBox("year 5 Students ","The # of students in Year 5: ","") If $year1 > $maxEnrollment Then MsgBox(5, "Warning", "Exceeds the limit") EndIf $year6 = InputBox("year 6 Students ","The # of students in Year 6: ","") If $year1 > $maxEnrollment Then MsgBox(5, "Warning", "Exceeds the limit") EndIf $total = $year1 + $year2 + $year3 + $year4 + $year5 + $year6 ; Display Results $sMessage = "This is a report" $title = "Student Enrollment" SplashTextOn($title, $sMessage, -1, -1, -1, -1, 4, "") ControlSetText($title, "", "Static1", "The Total Number of Students: " & $total& @CRLF) ; Wait until ESC key is released. While 1 If _IsPressed("1B", $hDLL) Then MsgBox($MB_SYSTEMMODAL, "_IsPressed", "The Esc Key was pressed, therefore we will close the application.") Sleep(500) ExitLoop EndIf WEnd
  10. Thank you so much for your help. I have rewritten my code with AutoIt script but the problem is, I can't connect my first part of my code to the second part. For example, when I enter a correct degree acronym and click on the OK button the code doesn't go to the next part to get the number of students from year 1 to 6. How can I connect these two part with the OK button? #include <Misc.au3> #include <MsgBoxConstants.au3> Local $hDLL = DllOpen("user32.dll") $degree = InputBox("Enter the degree ","Enter the degree acronym: ","") $maxEnrollment = 80 Dim $year1, $year2, $year3, $year4, $year5, $year6 If $degree = "BA" Then MsgBox (0, "Info","Department of Bachelor of Arts") ElseIf $degree <> "BA" Then MsgBox(5, "Info", "INVALID DEGREE PROGRAM - PLEASE ENTER A NEW DEGREE PROGRAM.") Exit (1) EndIf If $degree = "BSC" Then MsgBox (0, "Info","Department of Bachelor of Science") ElseIf $degree <> "BSC" Then MsgBox(5, "Info", "INVALID DEGREE PROGRAM - PLEASE ENTER A NEW DEGREE PROGRAM") Exit (1) EndIf If $degree = "BIS" Then MsgBox (0, "Info","Department of Information Systems") ElseIf $degree <> "BIS" Then MsgBox(5, "Info", "INVALID DEGREE PROGRAM - PLEASE ENTER A NEW DEGREE PROGRAM") Exit (1) EndIf If $degree = "BBA" Then MsgBox (0, "Info","Department of Bachelor of Administration") ElseIf $degree <> "BBA" Then MsgBox(5, "Info", "INVALID DEGREE PROGRAM - PLEASE ENTER A NEW DEGREE PROGRAM") Exit (1) EndIf $year1 = InputBox("year 1 Students ","The # of students in Year 1: ","") If $year1 > $maxEnrollment Then MsgBox(5, "Warning", "Exceeds the limit") EndIf $year2 = InputBox("year 2 Students ","The # of students in Year 2: ","") If $year1 > $maxEnrollment Then MsgBox(5, "Warning", "Exceeds the limit") EndIf $year3 = InputBox("year 3 Students ","The # of students in Year 3: ","") If $year1 > $maxEnrollment Then MsgBox(5, "Warning", "Exceeds the limit") EndIf $year4 = InputBox("year 4 Students ","The # of students in Year 4: ","") If $year1 > $maxEnrollment Then MsgBox(5, "Warning", "Exceeds the limit") EndIf $year5 = InputBox("year 5 Students ","The # of students in Year 5: ","") If $year1 > $maxEnrollment Then MsgBox(5, "Warning", "Exceeds the limit") EndIf $year6 = InputBox("year 6 Students ","The # of students in Year 6: ","") If $year1 > $maxEnrollment Then MsgBox(5, "Warning", "Exceeds the limit") EndIf $total = $year1 + $year2 + $year3 + $year4 + $year5 + $year6 ; Display Results $sMessage = "This is a report" $title = "Student Enrollment" SplashTextOn($title, $sMessage, -1, -1, -1, -1, 4, "") ControlSetText($title, "", "Static1", "The Total Number of Students: " & $total& @CRLF) While 1 If _IsPressed("1B", $hDLL) Then MsgBox($MB_SYSTEMMODAL, "_IsPressed", "The Esc Key was pressed, therefore we will close the application.") Sleep(500) ExitLoop EndIf WEnd
  11. Hello, How can I convert my code from Python to Autoit? Because I'm not familiar with Autoit. For example, how can I convert this part of my code: import sys degree = input("Enter the degree [BA / BSC / BIS / BBA] :") name = "" maxEnrollment = 80 if degree == "BA" or degree == "BSC" or degree == "BIS" or degree == "BBA": if degree == "BA": name = "Department of Bachelor of Arts" elif degree == "BSC": name = "Department of Bachelor of Science" elif degree == "BIS": name = "Department of Information Systems" elif degree == "BBA": name = "Department of Bachelor of Administration" else: print("\nINVALID DEGREE PROGRAM - PLEASE ENTER A NEW DEGREE PROGRAM") sys.exit() main.py
×
×
  • Create New...