Jump to content
Image
Image

jantograaf

Active Members
  • Posts

    39
  • Joined

  • Last visited

  • Days Won

    1

jantograaf last won the day on April 24 2019

jantograaf had the most liked content!

About jantograaf

  • Birthday 02/03/1984

Profile Information

  • Location
    Belgium

Recent Profile Visitors

567 profile views

jantograaf's Achievements

Seeker

Seeker (1/7)

7

Reputation

  1. Hi all, I'm trying to automate the install of a specific networking device. All goes well, I can install the driver on both Windows 7 & 10, rescan for hardware, set the IP-settings and all, but there's one issue. In Windows 10, I can disable all connection protocols using Powershell, but Windows 7 does not offer this Powershell-Cmdlet. So I programmed a way (two years ago) to let AutoIt open the network-adapter properties and then deselect all checkboxes except for the TCP/IP-V4. I recovered this snippet somewhere in my old files and tried to reintegrate this into my latest script, but it doesn't seem to work. On Windows 10 I get a blank screen for a few seconds and that's it, on Windows 7 it makes explorer crash. I think it's quite safe to test this on your own system as long as you're not using IPv6 to connect to the internet and as long as you return to check all the boxes again (so you don't break your connectivity). If anyone has any idea, I'd be glad to hear from you! Thanks in advance and stay safe in these Corona-ridden times 🙂 Kind regards, Jan There are three functions involved: DisableAllProtocols($AdapterName) This one is the main function that 'should' uncheck all the checkboxes in the adapter's Properties-window. Func DisableAllProtocols($AdapterName) OpenNetConnToAdapter($AdapterName) ;Find the IDs of all relevant controls Local $Handle_Window_Properties = WinWaitActive($Adaptername & " Properties","") Local $Handle_Listview_Protocols = ControlGetHandle($Adaptername & " Properties","","[CLASSNN:SysListView321]") Local $Handle_OK_Button = ControlGetHandle($Adaptername & " Properties","","[CLASSNN:Button6]") Local $List_CMN_ID = ControlListView($Adaptername & " Properties","","[CLASSNN:SysListView321]","FindItem","Client for Microsoft Networks") Local $List_FPSMN_ID = ControlListView($Adaptername & " Properties","","[CLASSNN:SysListView321]","FindItem","File and Printer Sharing for Microsoft Networks") Local $List_QOS_ID = ControlListView($Adaptername & " Properties","","[CLASSNN:SysListView321]","FindItem","QoS Packet Scheduler") Local $List_MNAMP_ID = ControlListView($Adaptername & " Properties","","[CLASSNN:SysListView321]","FindItem","Microsoft Network Adapter Multiplexor Protocol") Local $List_MLLDPPD_ID = ControlListView($Adaptername & " Properties","","[CLASSNN:SysListView321]","FindItem","Microsoft LLDP Protocol Driver") Local $List_IPV6_ID = ControlListView($Adaptername & " Properties","","[CLASSNN:SysListView321]","FindItem","Internet Protocol Version 6 (TCP/IPv6)") Local $List_LLTDR_ID = ControlListView($Adaptername & " Properties","","[CLASSNN:SysListView321]","FindItem","Link-Layer Topology Discovery Responder") Local $List_LLTDMIOD_ID = ControlListView($Adaptername & " Properties","","[CLASSNN:SysListView321]","FindItem","Link-Layer Topology Discovery Mapper I/O Driver") ; Disable All Protocols Except IPV4 SetCheckboxState($Handle_Listview_Protocols,$List_CMN_ID,3) SetCheckboxState($Handle_Listview_Protocols,$List_FPSMN_ID,3) SetCheckboxState($Handle_Listview_Protocols,$List_QOS_ID,3) SetCheckboxState($Handle_Listview_Protocols,$List_MNAMP_ID,3) SetCheckBoxState($Handle_Listview_Protocols,$List_MLLDPPD_ID,3) SetCheckboxState($Handle_Listview_Protocols,$List_IPV6_ID,3) SetCheckboxState($Handle_Listview_Protocols,$List_LLTDR_ID,3) SetCheckboxState($Handle_Listview_Protocols,$List_LLTDMIOD_ID,3) ;Click OK ControlClick($Handle_Window_Properties,"","Button6") Sleep(50) WinClose("Network Connections") EndFunc OpenNetConnToAdapter($AdapterName) This function opens the network adapter's Properties-page Func OpenNetConnToAdapter($AdapterName) ShellExecute("control.exe","ncpa.cpl",@WindowsDir,"",@SW_SHOW) WinWait("Network Connections","") WinActivate("Network Connections","") Local $Handle_Window_NetworkConnections = WinWaitActive("Network Connections","") Send("{F5}") Sleep(250) Local $AdapterNameArray = StringSplit($AdapterName,"") For $i = 1 To $AdapterNameArray[0] Step 1 Send($AdapterNameArray[$i]) Sleep(10) Next Sleep(50) Send("{APPSKEY}") Sleep(50) Send("{R}") Sleep(500) Return EndFunc SetCheckboxState($Handle,$checkbox_id,$wantedstate) This function changes the state of a checkbox Func SetCheckboxState($handle,$checkbox_id,$wantedstate) ;$handle : SysListView32-handle ;$checkbox_id : The ID of the checkbox you want to control ;$wantedstate : The wanted status (2 for checked, 3 for unchecked) Local $currentstate = _GUICtrlListView_GetItemStateImage($handle,$checkbox_id) If $currentstate = $wantedstate Then Return Else _GUICtrlListView_SetItemSelected($handle,$checkbox_id,True,True) Send("{Space}") Sleep(50) Return EndIf EndFunc
  2. So, meanwhile, I've tested it here on multiple PC's, and it seems to work on some and not work on others. All of them are Windows 10 x64 however, and they should be configured basically in the same way. Could it be that it has something to do with usernames/permissions? I'm completely baffled right now, this should work without a problem and it doesn't. 😊
  3. So, seems like I've reached the holy grail of (quite basic) programming on your pc's, but not on mine... SCRIPT WORKS. DUNNO WHY. OK THEN. ðŸĪŠ
  4. Haha, I missed that line, since it came from the other program (where the drop zone does work). But actually that GuiDelete() should be erased there and will be replaced by the call to the function that will process the dropped file. Thanks anyway 😉
  5. Hi @Melba23, Thanks for the quick reply! 🙂 This was the scenario I was afraid of (since my code seemed correct). So, just to be 'complete', I have included all the includes I'm using right now. Overkill, I know, but I included all includes from the other script as the drop zone works in that one... #NoTrayIcon #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=DicomDrop.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_Res_Icon_Add=drag.ico,201 #AutoIt3Wrapper_Res_Icon_Add=close.ico,202 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <MsgBoxConstants.au3> #include <GuiEdit.au3> #include <WinAPIProc.au3> #include <WinAPISys.au3> #include <Array.au3> #include <FontConstants.au3> #include <AutoItConstants.au3> #include <ColorConstants.au3> #include <InetConstants.au3> #include "WinHttp.au3" #include <Network.au3> #include <StringConstants.au3> #include <File.au3> #include <Misc.au3> #include <GuiComboBox.au3> #include <GUIComboBoxEx.au3> #include <FileConstants.au3> #include <GUIListView.au3> #include <GUITab.au3> #include <GUIListBox.au3> #include <GuiButton.au3> #include <XML.au3> #include <SliderConstants.au3> #include <json.au3> Anything obvious missing as far as you can see? Kind regards, Jan
  6. Hi all, I've been looking around the forum and testing different ways of getting a 'drop zone' to work in my script, but I can't seem to get any response from the event listener. Code compiles perfectly. Chaning the control from a label to an input- or edit-field doesn't change its behaviour, still no response when a file is dropped on there... It might just be that I am overlooking a simple detail, so I'm hoping for an extra pair of eyes here or there who can spot why this isn't working as it should. I have another 3500+ lines script where I have basically the same bit of code, and it seems to work in there without problems. So, here it goes: Global $DD_GUI = GUICreate("DicomDrop",200,200,-1,-1,BitOR($WS_SYSMENU,$WS_POPUP),$WS_EX_ACCEPTFILES) GUISetBkColor(0x030303,$DD_GUI) $DD_GUI_DRAGLABEL = GUICtrlCreateLabel("",0,0,32,32,-1, $GUI_WS_EX_PARENTDRAG) $DD_GUI_DRAGIMAGE = GUICtrlCreateIcon(@ScriptFullPath,201,0,0,32,32) $DD_GUI_TITLELABEL = GUICtrlCreateLabel("DicomDrop",50,10,100,20,$SS_CENTER) GUICtrlSetFont($DD_GUI_TITLELABEL,8,$FW_SEMIBOLD,$GUI_FONTNORMAL,"Verdana") GUICtrlSetColor($DD_GUI_TITLELABEL,0xFFFFFF) $DD_GUI_CLOSE = GUICtrlCreateButton("X",174,4,24,24,$BS_FLAT) GUICtrlSetBkColor($DD_GUI_CLOSE,0x030303) GUICtrlSetColor($DD_GUI_CLOSE,0xFFFFFF) Global $DD_GUI_DROPZONE = GUICtrlCreateLabel("",10,42,180,148) GUICtrlSetState(-1,8) GUICtrlSetBkColor($DD_GUI_DROPZONE,0x181818) GUISetState(@SW_SHOW,$DD_GUI) Local $DD_MSG = 0 While 1 $DD_MSG = GUIGetMsg() Select Case $DD_MSG = $GUI_EVENT_CLOSE ConsoleWrite(@CRLF & "Debug -- Closed by GUI_EVENT_CLOSE") DD_EXIT() Case $DD_MSG = $GUI_EVENT_DROPPED If @GUI_DropId = $DD_GUI_DROPZONE Then Local $DroppedFile = @GUI_DragFile GUIDelete() ConsoleWrite(@CRLF & "Debug -- Dropped file : " & $DroppedFile) EndIf Case $DD_MSG = $DD_GUI_CLOSE ConsoleWrite(@CRLF & "Debug -- Closed by DD_GUI_CLOSEIMAGE") DD_EXIT() EndSelect WEnd Func DD_EXIT() GUIDelete($DD_GUI) Exit EndFunc If anyone has any idea whatsoever, please let me know 🙂 Thanks in advance and kind regards, Jan
  7. I'm trying, preferably using AutoIt, to convert RAW pixel data from one format to another. And I need help detecting what formats they actually are, because I'm at the end of my wits here... Brief explanation: I have an XML-file with RAW Pixel Data included therein as an element (sourced from a Dicom-file). The pixeldata looks something like this: <element tag="7fe0,0010" vr="OW" vm="1" len="5898240" name="PixelData" binary="yes">0e07\0dc7\0dfd\0e03\0e2f\0e15\0dfe\0e12\0e0f\0db0\0dc8\0e03\0e4a\0dce\0e4f\0e23\0dd4\0e0a\0dcc\0e19\0e56\0e20\0df8\0dd8\0e29\0de1\0deb\0e23\0e3a\0dce\0e05\0e09\0df1\0e3c\0e31\0df5\0e38\0e88\0e75\0de7\0e1d\0e1e\0e19\0e03\0e03\0e25\0e60\0e26\0e83\0e00\0e14\0e07\0e39\0e17\0e4c\0e67\0e3b\0dab\0e11\0dda\0e39\0dde\0df9\0dd8\0ee4\0e82\0e44\0e17\0e77\0e0f\0e37\0e64\0e36\0e39\0e1c\0e4a\0e5f\0dfb\0e1d\0e11\0e0e\0e48\0e64\0e35\0e65\0e5e\0e00\0e35\0e49\0e5f\0e3a\0dcb\0e23\0e34\0e27\0e1f\0e14\0e1d\0e4a\0e4c\0de6\0df2\0e5b\0e42\0e35\0e5a\0e47\0e43\0dd8\0e09\0e72\0e25\0ddd\0e12\0ec8\0e03\0e6a\0e1b\0e1a\0e27\0e08\0de8\0e0f\0e0f\0e5a\0e16\0de0\0dd3\0e5a\0dfb\0e5a\0e4d\0e1e\0e15\0e16\0e6c\0eb0\0e5b\0e6d\0e2d\0ddb\0e3c\0e6a\0e02\0e64\0e5a\0e12\0ddd\0ea8\0e27\0e5c\0df2\0e1a\0e22\0df1\0e97\0e03\0deb\0e05\0e22\0eb2\0e26\0e57\0e86\0e8e\0e3e\0e88\0e54\0e3b\0e3c\0e4b\0e65\0e12\0e21\0de6\0db9\0e63\0ea4\0e66\0e54\0ea1\0e36\0e39\0e61\0e69\0e35\0e8c\0e65\0e45\0e7d\0e5f\0e67\0e67\0e7c\0ed5\0e46\0e2d\0e24\0dcc\0dfd\0e70\0e36\0e33\0e51\0def\0e36\0e4d\0e3a\0e52\0e5e\0e80\0e2e\0ead\0e95\0ef5\0e6e\0e80\0e66\0e80\0dc5\0e14\0e8d\0e7c\0e4d\0e58\0e29\0e31\0e29\0ea3\0e51\0e9c\0e7b\0e11\0e59\0e05\0e10\0e98\0e13\0e48\0e74\0e53\0e47\0e71\0dfb\0e0c\0e92\0e96\0ed8\0e8b\0e48\0e27\0e28\0e32\0e26\0e5e\0ea7\0ec8\0e4d\0e07\0e37\0e31\0e39\0e3b\0e4b\0e5c\0e36\0e88\0e42\0e91\0eb0\0e64\0e2c\0dc1\0ddf\0e85\0f0c\0ea7\0e44\0e29\0e3b\0e9c\0e95\0eab\0e88\0e47\0dd2\0e41\0e28\0e4f\0e73\0ea1\0e90\0e77 ... </element> I'm trying to replace the RAW Pixel Data by data from another file, but the encoding looks different. I can open this RAW file in ImageJ as a 16Bit Unsigned Little Endian RAW File, but I think I need to reencode this to work inside the XML container (to be able to convert it back to a working DCM-image). The contents of the other raw file show like this: =;4;<;-;=;;;5;5;4;0;3;+;G;.;F;9;@;9;/;:;?;0;>;:;A;@;A;C;8;6;;;/;9;6;5;1;<;4;E;8;8;*;6;9;9;.;>;.;:;.;2;5;?;/;3;6;6;0;2;1;@;1;8;/;7;+;0;.;4;/;4;7;8;*;;;/;1;5;3;*;,;-;3;';6;.;6;1;-;,;8;0;6;/;<;4;8;,;-;';6;-;;;);6;+;/;.;+;7;2;/;1;0;4;-;5;,;2;$;.;-;<;/;.;!;(;";,;*;2;;,;(;$;';&;+;3;#;+;&;3;;$;!;.;#;#;";(;);3;#;:;%;*;*;,;;);!;!;);(;";(;;#;!;2;&;.;!;+;#;*;(;;; ;;#; ;&;;%;;0;;";;;;;;&;;#;;;;;;;;;;;;;;;;;;; Does anyone have any clue how to convert the second format to the first one? I've tried converting every single character to its UTF-16LE equivalent, but to no avail. If anyone has any idea, I'd be glad to hear it 🙂 Thanks in advance! Jan
  8. Okay, so this solved the issue. Nevermind. Just keeping this here for reference so other people can see the solution I thought best 🙂 If $ArrayDepth <= -1 Then ;First we fill an array with all the folders one level up $LevelUpFolderArray = _FileListToArrayRec($DCMFolder,"*",$FLTAR_FOLDERS,$ArrayDepth + 1,$FLTAR_SORT,$FLTAR_FULLPATH) ;If this provides a result (it always should, since this is only run when the $FolderArray contains any lines) If IsArray($LevelUpFolderArray) Then ;Using an DeleteCounter to keep track of the rows where we left off deleting ;Doing this since _BinarySearch did not work for me but the arrays ARE sorted Local $ArrayDeleteCounter = 0 Local $FoundInRow = 0 For $i = 1 To $LevelUpFolderArray[0] ;For each line in $LevelUpFolderArray, delete the corresponding line in $FolderArray $FoundInRow = _ArraySearch($FolderArray,$LevelUpFolderArray[$i],$ArrayDeleteCounter) If $FoundInRow > 0 Then ;Set the position to this found item $ArrayDeleteCounter = $FoundInRow ;Delete the row _ArrayDelete($FolderArray,$FoundInRow) ;Adjust the element count in the FolderArray $FolderArray[0] = $FolderArray[0] - 1 ;Reset the FoundInRow-variable $FoundInRow = 0 EndIf Next EndIf EndIf
  9. Alright, I'm not marking this solved yet, but there might be a solution I just thought of. Maybe I just need to do the first _FileListToArrayRec twice. Once on the level needed, once on a level just above that. And then write a little loop that searches and deletes all the lines of the second array from the first array? 🧐 Just thinking out loud here...
  10. Hi all, I'm trying to make a listing of all files in subdirectories on a specific level in a folder structure. Let me explain, visually, this will help things a lot. I have a folder structure like this: ROOT |--- SUBDIR 1 | |---- SUBDIR 1.1 | |----- SUBDIR 1.1.1 | |---- File1.ext | |----- SUBDIR 1.1.2 | |---- File2.ext | |----- SUBDIR 1.1.3 | |---- File2.ext | |----- SUBDIR 1.1.4 | |---- File2.ext | |----- SUBDIR 1.1.5 | |---- File2.ext | |---- SUBDIR 1.2 | |----- SUBDIR 1.2.1 | ..... | |---- SUBDIR 1.3 .... I use _FileListToArrayRec twice: - once to make an array of the specific directories I should be working at: I need all files on the x.x level, so it will go just until that depth using a negative integer for $iRecur - once again to create an array of all files found under that directory and its subdirectories (level x.x.x\files...) What happens now is that _FileListToArrayRec will always include all levels before the maximum depth is reached. The result would look like this Row 0 15 Row 1 Root\Subdir 1 Row 2 Root\Subdir 2 Row 3 Root\Subdir 3 Row 4 Root\Subdir 1\Subdir 1.1 Row 5 Root\Subdir 1\Subdir 1.2 Row 6 Root\Subdir 1\Subdir 1.3 ... Needless to say that when my second function iterates over this array, it will find all files twice. Once on the x level, once again on the x.x level. There is no way for me not to use the recursive option in the second iteration, since the files are actually in a subdirectory there. Where are the wizards of programming logic here? Since I can't seem to find a comprehensible or easily implementable solution for this issue. Thanks in advance and kind regards, Jan
  11. You're all heroes, truly! Thanks a lot! I got this to work, so I'll build from that example to implement what I need in my code. Thanks, @Danyfirex! And of course, a lot of gratitude as well for @Earthshine and @water and @TheXman for getting this discussion going! 😍
  12. Yeah, I can connect the ApplicationFactory-object as well, without any issues, but this ApplicationFactory-object is mentioned nowhere in RemotePhone's API. So, I contacted them to see what possibilities there are to get this to work. If I find out more, I'll post it here... Greetings!
  13. Alright, this is not going to be easy, that's for sure. I am indeed able to load the library, but after that I'm completely in the dark as well... Local $oCallCenter = _CLR_LoadLibrary("C:\Program Files (x86)\JUstPhone\Callcenter\SDK\bin\RemotePhoneService.dll") MsgBox(0,"Result","$oCallCenter: " & IsObj($oCallCenter) & @CRLF) Local $oApplication = _CLR_CreateObject($oCallCenter,"JustRemotePhone.RemotePhoneService.Application") MsgBox(0,"Result","$oApplication: " & IsObj($oApplication) & @CRLF) The first result is 1, since the library is loaded. The second, however, stays 0, and I've tried a lot of possible variations on that classname...
  14. Let's see, I'm at my PC now so I'll try this UDF and see how far I get. Thanks a lot! I'll keep you guys posted!
  15. Thanks for looking into that. I don't mind 'how' to implement this, the key is that I just want it to work somehow since it would be a great opportunity to build something useful... Right now, me and my 5 colleagues pick up the office support calls by answering the phone through this piece of windows software. But since we all use a cellphone with a virtual phone 'central', which does not offer an option to see who is currently in a call, getting that status through that 'API' would allow me to design a simple status screen which shows who is available and who isn't... That's the main target. P.S.: long explanation, I know, but I always figure it's more useful to explain exactly what I'm trying to achieve so we can find a good - or even alternative, out-of-the-box - solution...
×
×
  • Create New...