Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/20/2017 in all areas

  1. Hello. I am not dead! I suggest that everyone that uses this UDF in production, updates to this version. Version 1.5.0 (This update DOES NOT break scripts) Added AutoIt like docs under Docs\. The docs are generated so its a 1 to 1 reflection of the UDF headers. Print of documentation Added a production ready server example. Added a new method: _Io_DevDebug which will display useful information when debugging. Added a new method: _Io_SetMaxRecvPackageSize which defaults to whatever _Io_setRecvPackageSize is set to. Added a new method: _Io_setOnPrefix which defaults to _On_ Added a new default client & server event called flood. Flood occurs when exceeding the $__g_io_nMaxPacketSize. $__g_io_nMaxPacketSize is set by _Io_SetMaxRecvPackageSize Fixed the 16 parameter limit when sending data with _Io_Emit, _Io_Broadcast, _Io_BroadcastToAll and _Io_BroadcastToRoom. This works on the same premise that AutoIt's Call Does Fixed a TRUNCATION problem when receiving packages which could cause crashes! Fixed a programming error which caused $__g_ionPacketSize to reset to default 4096 if _Io_Connect or _Io_listenwere called after _Io_setRecvPackageSize Fixed _Io_setEventPreScript and _Io_setEventPostScript They didnt work. Lol. Changed how events are fired so the client cannot crash the server by sending the wrong number of parameters (This also allows for optional parameters on callbacks) Changed _Io_On. The second parameter $fCallback can now be set to null. Doing this, the function assumes that the callback is: _On_<eventName>.
    1 point
  2. You can put this in the first line of your script to check if it's running or not: If _Singleton(@ScriptName,1)=0 Then Exit MsgBox(262144+16,"Error!",@ScriptName&" is already running!")
    1 point
  3. Look up _Singelton in the help file.
    1 point
  4. I don't think that was ever in question. I asked what app it is, because 99% of the time pixelsearch is not the way to go. There is almost always a better way to do it.
    1 point
  5. Np...good luck....you know where we are...
    1 point
  6. Benners, When we get some clearer direction from the op we can present some reasonable alteratives....good idea externalizing the data... Perhaps the op has enough to go on now.. Kylomas
    1 point
  7. Here's an example of reading the codes from a file. That way if the codes change you don't need to keep altering the main script #include <Array.au3> #include <File.au3> #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> ; read the codes from the file. Saves hard coding into the script Global $as_ClientCodes = FileReadToArray(@ScriptDir & '\ClientCodes.txt') ; check for an array before using and exit if issues If Not IsArray($as_ClientCodes) Then Exit (MsgBox($MB_ICONERROR, 'Error', 'Unable to read the client codes')) SelectClientCode() Func SelectClientCode() ; Create a GUI with various controls. Local $hGUI = GUICreate("Client Codes", 250, 50) ; Create a combobox control. Local $idComboBox = GUICtrlCreateCombo('', 10, 15, 185, 20) GUICtrlSetData(-1, _ArrayToString($as_ClientCodes)) ; add the client codes _GUICtrlComboBox_SetCurSel($idComboBox, 0) ; set the first item Local $i_Index = 0 ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idClose ExitLoop Case $idComboBox ; get the index of the currently selected item (starts at 0) $i_Index = _GUICtrlComboBox_GetCurSel($idComboBox) If Not $i_Index Then ContinueLoop ; ignore 'Select Client Code' string (index 0) ; activate the firefox window and check for errors activating If Not WinActivate("SecureSync - Mozilla Firefox") Then _ ContinueLoop (MsgBox($MB_ICONERROR, 'Error', 'Unable to activate SecureSync window')) ; wait until the window is active and check for timeout If Not WinWaitActive("SecureSync - Mozilla Firefox", '', 5) Then _ ContinueLoop (MsgBox($MB_ICONERROR, 'Error', 'Timed out waiting for SecureSync window')) ; Selects the client Send("{SPACE}") Sleep(1500) Send("{DOWN " & $i_Index & "}") Sleep(1500) Send("{ENTER}") Sleep(1500) Send("{ENTER}") ExitLoop EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>SelectClientCode ClientCodes.txt
    1 point
  8. Using a mutex would be a more appropriate approach, see here and here.
    1 point
  9. There's no need to use _ArraySearch in this case. If you make sure that the codes in the array match the position in the combo you can do it this way #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Global $cCode = "5155|7065|7071|B304|B344|B380|B390|B415|B416|B423|B471|B486|B518|B524|B525|B531|B580|B618|B619|B620|B635|B636|B642|B644|B645|B656|B657|B688|B689|B693|B714|B715|B749|B755|B756|B790|B793|B797|B805|B808|B819|B833|B845|B846|I432|I433|W006|W034" ; The string in data will be split into an array everywhere | is encountered Global $arr = StringSplit($cCode, "|") SelectClientCode() Func SelectClientCode() ;~ ; Create a GUI with various controls. Local $hGUI = GUICreate("Client Codes", 250, 50) ;~ ; Create a combobox control. Local $idComboBox = GUICtrlCreateCombo("Select Client Code", 10, 15, 185, 20) ; Add additional items to the combobox. GUICtrlSetData($idComboBox, $cCode) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) Local $i_Index = 0 ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idClose ExitLoop Case $idComboBox ; get the index of the currently selected item (starts at 0) $i_Index = _GUICtrlComboBox_GetCurSel($idComboBox) MsgBox(0, 'array position: ' & $i_Index, 'Array Value: ' & $arr[$i_Index]) EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>SelectClientCode #Region SelectClientCode In Send("{DOWN 1}"), if the number in red increments by one, you could also use try using $i_Index for the number. (untested) #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Global $cCode = "5155|7065|7071|B304|B344|B380|B390|B415|B416|B423|B471|B486|B518|B524|B525|B531|B580|B618|B619|B620|B635|B636|B642|B644|B645|B656|B657|B688|B689|B693|B714|B715|B749|B755|B756|B790|B793|B797|B805|B808|B819|B833|B845|B846|I432|I433|W006|W034" ; The string in data will be split into an array everywhere | is encountered Global $arr = StringSplit($cCode, "|") SelectClientCode() Func SelectClientCode() ;~ ; Create a GUI with various controls. Local $hGUI = GUICreate("Client Codes", 250, 50) ;~ ; Create a combobox control. Local $idComboBox = GUICtrlCreateCombo("Select Client Code", 10, 15, 185, 20) ; Add additional items to the combobox. GUICtrlSetData($idComboBox, $cCode) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) Local $i_Index = 0 ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idClose ExitLoop Case $idComboBox ; get the index of the currently selected item (starts at 0) $i_Index = _GUICtrlComboBox_GetCurSel($idComboBox) MsgBox(0, 'array position: ' & $i_Index, 'Array Value: ' & $arr[$i_Index]) WinActivate("SecureSync - Mozilla Firefox") Sleep(5000) ;Selects the client Send("{SPACE}") Sleep(1500) Send("{DOWN " & $i_Index & "}") ; untested Sleep(1500) Send("{ENTER}") Sleep(1500) Send("{ENTER}") GUIDelete($hGUI) Exit EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>SelectClientCode #Region SelectClientCode
    1 point
  10. benners

    FMS_GETFILESEL

    From $aResult[1] onwards they are just the values passed as parameters, $hControl and $FM_GETFILESEL. They should be the same values that you passed, unless they were modified by the SendMessageW function. And that's my DLL knowledge exhausted
    1 point
  11. haha its indeed the L"left" it just after compiling the file, i need to run the .exe as admin. if not window wont allow it to move the program
    1 point
  12. Welcome to AutoIt and the forum! The Excel part can easily be done using the Excel UDF that comes with AutoIt. Please check the help file for _Excel_RangeRead and _Excel_RangeWrite functions including example scripts. The web part depends on the browser you are running. AutoIt comes with functions for IE. Automating FF, Chrome is a bit more complex. But the most important part is a good design of your application. How should your script handle situations when the address couldn't be found or more than one hit was returned? Etc, etc ... If you have any questions we will do our best to assist!
    1 point
  13. mrmacro, Why do you do send('{down 1}')? kylomas edit: if it helps, you can read the entire combo box list...if you can explain what you want there is a better way than a bunch of case stmt's...I read your other thread and still don't get your goal... edit2: this is from your previous thread... not sure what you are trying to do... edit3: An example of using an array with a combo box... #include <array.au3> #include <GuiConstants.au3> Local $aClientCodes[50] = ['5155', '7065', '7071', 'B304', 'B344', 'B380', 'B390', 'B415', 'B416', 'B423', 'B471', 'B486', _ 'B518', 'B524', 'B525', 'B531', 'B580', 'B618', 'B619', 'B620', 'B635', 'B636', 'B642', 'B644', 'B645', 'B656', 'B657', 'B688', _ 'B689', 'B693', 'B714', 'B715', 'B749', 'B755', 'B756', 'B790', 'B793', 'B797', 'B805', 'B808', 'B819', 'B833', 'B845', 'B846', 'I432', 'I433', 'W006', 'W034'] SelectClientCode() Func SelectClientCode() ;~ ; Create a GUI with various controls. Local $hGUI = GUICreate("Client Codes", 250, 50) ;~ ; Create a combobox control. Local $idComboBox = GUICtrlCreateCombo("Select Client Code", 10, 15, 185, 20) ; ; populate the combo control with the contents of the client array...default delimiter must be "|" (it is unless you change it) ; Third parameter sets the initial value for the edit portion of the combo control ; GUICtrlSetData($idComboBox, _ArrayToString($aClientCodes), $aClientCodes[0]) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ;Local $sComboRead = "" ; this is created in local scope as the return from function GuiCtrlRead ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idClose ExitLoop Case $idComboBox $sComboRead = GUICtrlRead($idComboBox) Switch $sComboRead Case "5155" ;~ WinWaitActive("SecureSync - Mozilla Firefox") ; ; this is where you lose me...you are sending a space, down 1 and two enters to a web site, or whatever the currently active window is... ; WinActivate("SecureSync - Mozilla Firefox") Sleep(5000) ;Selects the client Send("{SPACE}") Sleep(1500) Send("{DOWN 1}") Sleep(1500) Send("{ENTER}") Sleep(1500) Send("{ENTER}") GUIDelete($hGUI) Exit EndSwitch EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>SelectClientCode #Region SelectClientCode One last thing, think of a 1d array as a list. You access the list using the variable name ($aClientCodes) and an index starting at 0 in brackets. So to get the third entry of your array you can do local $MyThirdEntry = $aClientList[2]
    1 point
  14. @mrmacro That is the exact reason we suggest new folks look at the help file. You could take your 37 lines, and boil it down to a simple: #include <Date.au3> FileWrite(@DesktopDir & "\Output.txt", _Now())
    1 point
  15. ConsoleWrite(_GetDrivePartitionStyle() & @CRLF) ConsoleWrite(_WinAPI_GetFirmwareEnvironmentVariable() & @CRLF) Func _GetDrivePartitionStyle($sDrive = "C") Local $tDriveLayout = DllStructCreate('dword PartitionStyle;' & _ 'dword PartitionCount;' & _ 'byte union[40];' & _ 'byte PartitionEntry[8192]') Local $hDrive = DllCall("kernel32.dll", "handle", "CreateFileW", _ "wstr", "\\.\" & $sDrive & ":", _ "dword", 0, _ "dword", 0, _ "ptr", 0, _ "dword", 3, _ ; OPEN_EXISTING "dword", 0, _ "ptr", 0) If @error Or $hDrive[0] = Ptr(-1) Then Return SetError(@error, @extended, 0) ; INVALID_HANDLE_VALUE DllCall("kernel32.dll", "int", "DeviceIoControl", _ "hwnd", $hDrive[0], _ "dword", 0x00070050, _ "ptr", 0, _ "dword", 0, _ "ptr", DllStructGetPtr($tDriveLayout), _ "dword", DllStructGetSize($tDriveLayout), _ "dword*", 0, _ "ptr", 0) DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hDrive[0]) Switch DllStructGetData($tDriveLayout, "PartitionStyle") Case 0 Return "MBR" Case 1 Return "GPT" Case 2 Return "RAW" Case Else Return "UNKNOWN" EndSwitch EndFunc ;==>_GetDrivePartitionStyle Func _WinAPI_GetFirmwareEnvironmentVariable() DllCall("kernel32.dll", "dword", _ "GetFirmwareEnvironmentVariableW", "wstr", "", _ "wstr", "{00000000-0000-0000-0000-000000000000}", "wstr", "", "dword", 4096) Local $iError = DllCall("kernel32.dll", "dword", "GetLastError") Switch $iError[0] Case 1 Return "LEGACY" Case 998 Return "UEFI" Case Else Return "UNKNOWN" EndSwitch EndFunc ;==>_WinAPI_GetFirmwareEnvironmentVariable
    1 point
×
×
  • Create New...