Jump to content

All Activity

This stream auto-updates     

  1. Today
  2. @youtuber Create a two-dimension array; in the first column, you store the ControlID of the checkbox, and in the second column you store its label, so when you use GUICtrlRead() in a For...Next loop, you just need to use For $i = 0 To UBound($arrCheckBoxes) - 1 Step 1   If GUICtrlRead($arrCheckBoxes[$i][0]) = $GUI_CHECKED Then ConsoleWrite($arrCheckBoxes[$i][1] & @CRLF)    Next to retrieve the information about the label of the checked checkbox(es)
  3. I want to get extensions from checkbox names #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 195, 125) $Button1 = GUICtrlCreateButton("ok", 86, 64, 75, 34) Dim $Checkbox[3] $Checkbox[0] = GUICtrlCreateCheckbox(".JPG", 14, 32, 49, 17) $Checkbox[1] = GUICtrlCreateCheckbox(".PNG", 68, 32, 49, 17) $Checkbox[2] = GUICtrlCreateCheckbox(".GIF", 127, 32, 49, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 For $i = 0 To UBound($Checkbox) - 1 If GUICtrlRead($Checkbox[$i]) = $GUI_CHECKED Then ConsoleWrite($Checkbox[$i] & @CRLF) Next EndSwitch WEnd
  4. With HotKeySet you can't use parameters in the function call, all parameters are ignored. You shouldn't use HotKeys that are used frequently by other programs like F1, so use something like Ctrl+F1, see example code below: nb: Not sure why but your default "Untitle - Notepad" is "Untitled - Notepad" on my system, so you may need to change it. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> HotKeySet("^{F1}", "_SendDate") Global $g_vCurrentDate GUICreate("Example", 250, 170, 192, 124) Global $g_idDateInput = GUICtrlCreateInput("", 110, 50, 105, 21) GUICtrlSetData(-1, "aaaa-mm-dd", "") GUICtrlSetState($g_idDateInput, $GUI_DISABLE) Global $g_idSendButton = GUICtrlCreateButton("(F1) Send", 90, 90, 75, 24) GUICtrlCreateLabel("Date1", 60, 53, 33, 17) Global $g_idRadio1 = GUICtrlCreateRadio("Auto", 60, 17, 78, 17) GUICtrlSetState(-1, $GUI_CHECKED) Global $g_idRadio2 = GUICtrlCreateRadio("Manual", 140, 17, 113, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $g_idSendButton Select Case GUICtrlRead($g_idRadio2) = 1 $g_vCurrentDate = GUICtrlRead($g_idDateInput) _SendDate () Case GUICtrlRead($g_idRadio1) = 1 $g_vCurrentDate = GUICtrlRead($g_idDateInput) _SendDate () EndSelect Case $g_idRadio1 If GUICtrlRead($g_idRadio1) = $GUI_CHECKED Then GUICtrlSetState($g_idDateInput, $GUI_DISABLE) EndIf Case $g_idRadio2 If GUICtrlRead($g_idRadio2) = $GUI_CHECKED Then GUICtrlSetState($g_idDateInput, $GUI_ENABLE) EndIf EndSwitch WEnd Func _SendDate () If $g_vCurrentDate = "" Then $g_vCurrentDate = "(F1) Send" $g_vCurrentDate = $g_vCurrentDate = "(F1) Send" ? StringRight(@Year, 4) & ("-") & StringFormat("%02u-%02u", @MON, @MDAY) : $g_vCurrentDate WinActivate ("Untitled - Notepad", "") WinWaitActive ("Untitled - Notepad", "", 0) Send ($g_vCurrentDate) Send("{ENTER}") $g_vCurrentDate = "" ;~ Reset the variable to blank EndFunc
  5. ok so, I have this this scrip for my work already finished but I cant find the way to press the button "send " with a key, it's annoying to have to maximize the gui every time I need to use it; hotkeyset and & º are the ways that I found but, they dont work me at all, there is another way to do it? #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> HotKeySet("{F1}", "_SendDate" ) Local $vCurrentDate Local $_vCurrentDate #Region ### START Koda GUI section ### Form= Local $Form1 = GUICreate("Form1", 250, 170, 192, 124) Local $Input1 = GUICtrlCreateInput("", 110, 50, 105, 21) GUICtrlSetData(-1, "aaaa-mm-dd", "") GUICtrlSetState($input1, $GUI_DISABLE) Local $Button2 = GUICtrlCreateButton("(F1) Send", 90, 90, 75, 24) ;; Or ;~ Local $Button2 = GUICtrlCreateButton("$º Send", 90, 120, 75, 24) Local $Label1 = GUICtrlCreateLabel("Date1", 60, 53, 33, 17) Local $Radio1 = GUICtrlCreateRadio("Auto", 60, 17, 78, 17) GUICtrlSetState(-1, $GUI_CHECKED) Local $Radio2 = GUICtrlCreateRadio("Manual", 140, 17, 113, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch Switch $nMsg Case $Button2 Select Case GUICtrlRead($Radio2) = 1 _SendDate (GUICtrlRead($Input1)) Case GUICtrlRead($Radio1) = 1 _SendDate () EndSelect Case $Radio1 if GUICtrlRead($Radio1) = $GUI_CHECKED Then GUICtrlSetState($input1, $GUI_DISABLE) EndIf Case $Radio2 if GUICtrlRead($Radio2) = $GUI_CHECKED Then GUICtrlSetState($input1, $GUI_ENABLE) EndIf EndSwitch WEnd Func _SendDate ($_vCurrentDate = "(F1) Send") Local $vCurrentDate = $_vCurrentDate = "(F1) Send" ? StringRight(@Year, 4) & ("-") & StringFormat("%02u-%02u", @MON, @MDAY) : $_vCurrentDate WinActivate ("Untitle - Notepad", "") WinWaitActive ("Untitle - Notepad", "", 0) Send ($vCurrentDate) Send("{ENTER}") EndFunc
  6. Yesterday
  7. I dont make scripts for people who dont properly sanitize their input, its gross
  8. @iamtheky Not foolproof, see aditional blank In customer Global $A = "Customer Name: John Smith, Address: 1234 Main Street, Chicago, IL, Customer Rec#: 123457, PHone Number#: 555-555-1212" msgbox(0, '' , StringLeft((stringmid($A , StringInStr($A , "Customer Rec#: ") + StringLen("Customer Rec#: ") - 1)) , (StringInStr(stringmid($A , StringInStr($A , "Customer Rec#: ") + StringLen("Customer Rec#: ") - 1) , ",") - 1)),2) ;~ Not foolproof, see aditional blank In customer ---------------------------------v Global $A = "Customer Name: John Smith, Address: 1234 Main Street, Chicago, IL, Cus tomer Rec#: 123457, PHone Number#: 555-555-1212" msgbox(0, '' , StringLeft((stringmid($A , StringInStr($A , "Customer Rec#: ") + StringLen("Customer Rec#: ") - 1)) , (StringInStr(stringmid($A , StringInStr($A , "Customer Rec#: ") + StringLen("Customer Rec#: ") - 1) , ",") - 1)))
  9. moar stringops! Global $A = "Customer Name: John Smith, Address: 1234 Main Street, Chicago, IL, Customer Rec#: 123457, PHone Number#: 555-555-1212" msgbox(0, '' , StringLeft((stringmid($A , StringInStr($A , "Customer Rec#: ") + StringLen("Customer Rec#: ") - 1)) , (StringInStr(stringmid($A , StringInStr($A , "Customer Rec#: ") + StringLen("Customer Rec#: ") - 1) , ",") - 1)))
  10. westernira, Pretty punchy post for a newcomer to the forum, but welcome anyway. I hope your first question gets a more sympathetic response that the one you have just provided. I would however suggest adopting a slightly more emollient tone if you want that to be the case. M23
  11. Seriously? I like to be taken serious so we are done with your questions here, and don't start this in a new thread again. *cick*
  12. Pas la peine de hurler avec un police de cette taille ! https://docs.microsoft.com/fr-fr/sql/relational-databases/databases/use-the-copy-database-wizard?view=sql-server-2017
  13. That is the default behaviour as they normally don't serve any purpose. ... but I can only assume you didn't first open the Helpfile that comes with the full SciTE4AutoIt3 version, as it is documented. Jos
  14. base de données SQL Server
  15. or #include <String.au3> Global $sA = "Customer Name: John Smith, Address: 1234 Main Street, Chicago, IL, Customer Rec#: 123457, PHone Number#: 555-555-1212" Global $aCustomerNumber = _StringBetween($sA, "Customer Rec#: ", ", ") MsgBox(0, "Customer Rec#", (@error?"not found":$aCustomerNumber[0]))
  16. Once again (and for all): which DB engine are you using? Both things are incompatible. Also note that keeping live (being read from/written to) two or more DBs in sync and in real time is either very costly and/or very slow and/or very unreliable or plain impossible in practice. Duplicating a DB at more or less regular intervals is easy and easily automatable, provided you can tell us which engine you use!
  17. I want to make a button, a click on the button and the copy is executed from the main database to the secondary database.
  18. trailing spaces in script - is there a option to keep/delete in SciTE4AutoIt3? It seems I somehow enabled their deletion, but don't know how to make SciTE to keep them back instead...
  19. Isn't really that difficult. Global $A = "Customer Name: John Smith, Address: 1234 Main Street, Chicago, IL, Customer Rec#: 123457, PHone Number#: 555-555-1212" Global $aCustomerNumber = StringRegExp($A, "Customer Rec#: (.*?),",3) If @error Then Exit MsgBox(0, "Error", "String 'Customer Rec#:' not found!") MsgBox(0, "Customer Rec#", $aCustomerNumber[0]) Jos
  20. I'm not very familiar with Regular Expressions so I use multiple StringSplit: #include <StringConstants.au3> Global $A = "Customer Name: John Smith, Address: 1234 Main Street, Chicago, IL, Customer Rec#: 123457, PHone Number#: 555-555-1212" Global $aSplit = StringSplit($A, "Customer Rec#:", $STR_NOCOUNT + $STR_ENTIRESPLIT) If @error Then Exit MsgBox(0, "Error", "String 'Customer Rec#:' not found!") Global $aCustomerNumber = StringSplit($aSplit[1], ",") If @error Then Exit MsgBox(0, "Error", "No Customer Rec# found!") MsgBox(0, "Customer Rec#", $aCustomerNumber[1])
  21. Sure: Open the helpfile and look for StringRegExp(). Jos
  22. Hi, Is there an easier way to search for text data Autoit String with specific parameters. For example, I have a string $A="Customer Name: John Smith, Address: 1234 Main Street, Chicago, IL, Customer Rec#: 123457, PHone Number#: 555-555-1212' I want to be able to grab the customer # by searching the phrase 'Customer Rec #:' and only grabbing the data after that phrase till for example the comma after the #. I know some programming languages offer data extraction through patterns and wasn't sure if there was a similar or easier way in Autoit to extract data this way. Thanks K
  23. Again, what is the relation to AutoIt3? Do you know which commands to use to copy the database, but want Autoit3 to do those commands for you or do you want to know how to copy a database? So start providing some real information!
  1. Load more activity
×
×
  • Create New...