Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/08/2014 in all areas

  1. Do you want quantity or quality?
    1 point
  2. Or get rid of the unnecessary Do loop entirely and try it this way. #include <Misc.au3> #include <Constants.au3> #include <String.au3> #include <GUIConstantsEx.au3> Local $hDLL = DllOpen("user32.dll") GUICreate("Crew Control", 500, 300) GUISetState(@SW_SHOW) GUICtrlCreateLabel("Use the number pad to select the page you wish to send from list below", 10, 30) GUICtrlCreateLabel("Press Numeric keypad 1 key for task 1", 10, 60) GUICtrlCreateLabel("Press Numeric keypad 2 key for task 2", 10, 90) ; line and next cell GUICtrlCreateLabel("Press Numeric keypad 3 key for task 3", 10, 120) ; While GUIGetMsg() <> $GUI_EVENT_CLOSE If _IsPressed("31", $hDLL) or _IsPressed("61", $hDLL) Then MsgBox(0, "", "Task 1") ElseIf _IsPressed("32", $hDLL) or _IsPressed("62", $hDLL) Then MsgBox(0, "", "Task 2") ElseIf _IsPressed("33", $hDLL) or _IsPressed("63", $hDLL) Then MsgBox(0, "", "Task 3") EndIf If _IsPressed("1B", $hDLL) Then MsgBox(0, "_IsPressed", "The Esc Key was pressed, therefore we will close the application.") Exit EndIf WEnd This allows either the numpad number or the normal top row number to initiate a task.
    1 point
  3. The helpfile says : "Declaring the same variable name again will erase all array values and reset the dimensions to the new definition." As this is not mentioned as "not recommended" let's assume that such a way is correct
    1 point
  4. Simple For loops will work $url = "http://www.testwebsite.com/start=" $txt = "" For $i = 1 to 9 $urltogo = $url & $i & "0" $txt &= $urltogo & @crlf Next For $i = 1 to 10 $urltogo = $url & $i & "00" $txt &= $urltogo & @crlf Next Msgbox(0,"", $txt) Edit or Local $url = "http://www.testwebsite.com/start=", $txt = "" For $i = 1 to 19 $urltogo = $url & (($i<10) ? $i : (Mod($i, 10)+1)*10)*10 $txt &= $urltogo & @crlf Next Msgbox(0,"", $txt)
    1 point
  5. Mat

    Conflicting Design Choices

    The answer is: those details should be hidden, and the data should be accessed by a function (or several functions). As a general rule with complex data structures, or even simple data structures, the user (you) should not know how the data is stored in memory exactly. It helps to have some idea, but you don't need to know the exact implementation details. This is actually a very common problem, particularly in graphics (think of drawing a graph in a GUI, the y axis is based on the bottom left corner, but coordinates for GUIs are done on the top right). Here's a Matrix class I wrote for someone this morning who wanted to know about template classes and static_assert: template<int R, int C> class Matrix { static_assert( R > 0 && C > 0, "Matrix dimensions must be positive and non-zero." ); private: int* data; public: Matrix( ) { this->data = new int[R * C]; } ~Matrix() { delete this->data; } int& at( int r, int c ) { if ( r >= R || c >= C ) { // The given index is too big for the matrix! throw std::out_of_range( "Index out of matrix bounds" ); } return ( this->data[r * C + c] ); } }; The user does not need to know that I'm actually storing the matrix as a single array, all they know is that each element is an int in memory, and they can get a reference to it using the at() method. I could have stored it as a 2d jagged array, but this wouldn't have made sense from a programming perspective. The same goes for AutoIt, and languages where you don't get classes and structures to help you with this. Look at the "memory" functions I made >here, they are simple, and could easily be done without the wrapping functions, but with the code as it is I left my options open, and could now go back and write a garbage collector or something without changing much of the current code at all. Even something as simple as reading a memory address I made a wrapping function for.
    1 point
  6. Ignore what this guy said, <snip>, this has nothing to do with multithreading. What you could do is compile as CUI and add first two lines to your script: DllCall("kernel32", "bool", "FreeConsole") DllCall("kernel32", "bool", "AttachConsole", "dword", -1) ; ...The rest of your code... That way you have "waiting" effect if run from cmd, and no console if run by double-click. However, you'll have initial console flash in latter case, so if that doesn't satisfy you seek alternatives.
    1 point
  7. JohnOne

    Possible or Impossible?

    Impossible.
    1 point
  8. Valik

    Timestamp

    Most things are simple if you know what you're doing.
    1 point
×
×
  • Create New...