-
Posts
22 -
Joined
-
Last visited
Everything posted by roka
-
ok, so I guess I'll actually modify the XML file before using it.
-
Hi All, I'm trying to process a XML file using the _XMLDOMWrapper UDF which worked very well for me so far. Unfortunately I am struggling with a different XML format now. I don't seem to be able to access any nodes after the root node unless I simplify the root node (what I'd like to avoid). Here's the XML format: <Systems Version="3.00" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-fujitsu-siemens-com:software-preload" xsi:noNamespaceSchemaLocation="HWInfo3.00.xsd"> <System> <SystemIdentification> <SerialNumber>12345XYZ</SerialNumber> <IndividualSoftwareID /> <SystemUUID>{12345XYZ-1234-5678-9123-12345XYZ}</SystemUUID> <CustomerSerialNumber /> <IMEINumber /> <MACAddresses> <MACAddress type="OnBoard">00:12:34:56:78:90</MACAddress> </MACAddresses> </SystemIdentification> <SoftwareModules /> <DeliveryNote> <OrderCode>CUZ:12345XYZ-ABC</OrderCode> <CustomerOrderData>12345XYZ</CustomerOrderData> <EndCustomerOrderNumber>12345XYZ</EndCustomerOrderNumber> <Product>Celsius M470-2</Product> <OrderPosition>123</OrderPosition> <OrderNumber>12345XYZ</OrderNumber> </DeliveryNote> </System> </Systems> AU3 Test: #include <Array.au3> #include <_XMLDomWrapper.au3> Local $inputFile = FileOpenDialog("Select XML", @ScriptDir, "XML (*.xml)", 1) If FileExists($inputFile) Then _XMLFileOpen($inputFile, 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-fujitsu-siemens-com:software-preload" xsi:noNamespaceSchemaLocation="HWInfo3.00.xsd"') If Not @error Then $aTemp = _XMLGetChildNodes("/Systems") _ArrayDisplay($aTemp) Else MsgBox(0,"Error","Error opening File: " & @error) EndIf EndIf I'm pretty sure my error is in the _XMLFileOpen parameter for the namespace. Unfortunately I don't any experience with XML namespaces and their usage. Any help is much appreciated! Thanks!
-
Determing state of checkbox in GUICtrlCreateDate w/ DTS_SHOWNONE
roka replied to roka's topic in AutoIt GUI Help and Support
I'm actually not using the beta yet. I'm still on latest stable release. I think I didn't use the handle for the GUICtrlCreateDate yesterday. I only used the return value from _GUICtrlCreateDate which is just the ControlID. This seems to return @error 0 when checked and @error 1 when unchecked: #include <DateTimeConstants.au3> #include <GuiDateTimePicker.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> Global $iExpiresOn, $hExpiresOn __startGUI() Func __startGUI() $hGUI = GUICreate("GUICtrlCreateDate Test", 200, 100, -1, -1, $GUI_SS_DEFAULT_GUI) ; CreateDate CTRL $iExpiresOn = GUICtrlCreateDate("", 10, 10, 120, 22, $DTS_SHOWNONE) $hExpiresOn = GUICtrlGetHandle($iExpiresOn) _GUICtrlDTP_SetFormat($hExpiresOn, "yyyy/MM/dd") _GUICtrlDTP_SetSystemTimeEx($hExpiresOn, 0, True) GUISetState() ; buttons $bOK = GUICtrlCreateButton("OK", 10, 40, 40, 22, $BS_FLAT) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $bClear = GUICtrlCreateButton("Clear", 60, 40, 40, 22, $BS_FLAT) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $bClear GUICtrlSetState ($iExpiresOn,$GUI_FOCUS) Send("{SPACE}") Case $bOK _doSomething() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc ;==>__startGUI Func _doSomething() $tmp2 = _GUICtrlDTP_GetSystemTimeEx($hExpiresOn) MsgBox(0,"_GUICtrlDTP_GetSystemTimeEx",@Error) ; DEBUG MESSAGE EndFunc This might be even easier than using the struct. I will try to use this in my script and see if it does what I need. Thanks Guiness! I appreciate your time. -
Determing state of checkbox in GUICtrlCreateDate w/ DTS_SHOWNONE
roka replied to roka's topic in AutoIt GUI Help and Support
It works in the terms of I'm getting the selected date and I can also set it to a certain date when loading a date from presets for example. I did try to use GetSystemTimeEx() yesterday, I just forgot to add it in here. Though, the topic you just mentioned is new to me. So I'll give a try with the struct now. I really like this Date Control, that's why I want to get it to work. Thanks! -
Hi there, I am trying to figure out how to determine the state of the checkbox of GUICtrlCreateDate() when using DTS_SHOWNONE. Here's some code for testing purposes: #include <DateTimeConstants.au3> #include <GuiDateTimePicker.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> Global $iExpiresOn, $hExpiresOn __startGUI() Func __startGUI() $hGUI = GUICreate("GUICtrlCreateDate Test", 200, 100, -1, -1, $GUI_SS_DEFAULT_GUI) ; CreateDate CTRL $iExpiresOn = GUICtrlCreateDate("", 10, 10, 120, 22, $DTS_SHOWNONE) $hExpiresOn = GUICtrlGetHandle($iExpiresOn) _GUICtrlDTP_SetFormat($hExpiresOn, "yyyy/MM/dd") _GUICtrlDTP_SetSystemTimeEx($hExpiresOn, 0, True) GUISetState() ; buttons $bOK = GUICtrlCreateButton("OK", 10, 40, 40, 22, $BS_FLAT) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $bClear = GUICtrlCreateButton("Clear", 60, 40, 40, 22, $BS_FLAT) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $bClear GUICtrlSetState ($iExpiresOn,$GUI_FOCUS) Send("{SPACE}") Case $bOK _doSomething() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc ;==>__startGUI Func _doSomething() $expiresOn = GUICtrlRead($iExpiresOn) MsgBox(0,"$expiresOn",$expiresOn) ; DEBUG MESSAGE $tmp = BitAnd(GUICtrlRead($iExpiresOn),$GUI_CHECKED) MsgBox(0,"$tmp",$tmp) ; DEBUG MESSAGE EndFunc The conventional way of retrieving the checkbox state doesn't work. Also I searched the forum and couldn't find anything. I found a way to uncheck the checkbox if needed, but no idea how to test its state. Any help is much appreciated. Thanks!
-
I'm pretty sure that people who run into the same problem will still appreciate it. I would have done so if I could have found a solution to this problem.
-
very cool. I like toast! good job!
-
Hi, just had the same issue - wanted to uncheck the control. After some research and attempts, this is the only way which works for me: ... $hControl= GUICtrlCreateDate("", 10, 10, 120, 22, $DTS_SHOWNONE) ... GUICtrlSetState ($hControl,$GUI_FOCUS) Send("{SPACE}") Basically you are sending a space bar key stroke to the CTRL do uncheck it. Works for me so far. Hope this helps Best roka
-
_Service_UDF v4 : Build your own service with autoit code
roka replied to arcker's topic in AutoIt Example Scripts
I do have the same question. I used _StopService(@ComputerName, $sServiceName) but this occassionally ended in an windows error. So I'm also looking for the proper way of how to end a service from within. My service is actually triggering a second script. I guess I could call _StopService in the second script. But preferably I would like to end the service from within itself. -
So... NVAPI provides a nvapi.lib DllCall of nvapi.dll doesn't do anything. Therefore NVAPI only gives C++ programmers the chance to do something with the API. Very frustrating.
-
http://developer.nvidia.com/nvapi There's a link to a developer package (http://developer.nvidia.com/sites/default/files/akamai/tools/files/NVAPI_Dec2010.zip) which contains the nvapi.h All available functions are explained in it. Thanks for trying to help. I sure appreciate it!
-
Hi, I'm trying to use the NVidia NVAPI and control a NVidia Quadro driver with it. Did anybody try this before? Not sure if calling nvapi.dll already gives access to all NVAPI functions or not. I'm afraid my lack of C#/C++ knowledge is a problem here That's my testing code so far: #include <Array.au3> ;DLLs Global $hNvAPIDLL = DllOpen("nvapi.dll") ; NVAPI DLL MsgBox(0,"DEBUG1",$hNvAPIDLL) ; DEBUG MESSAGE $tmp = DllCall($hNvAPIDLL, "str", "NvAPI_Initialize") If NOT @error Then MsgBox(0,"DEBUG2","success") ; DEBUG MESSAGE Else MsgBox(0,"DEBUG2","error") ; DEBUG MESSAGE EndIf $tmp = DllCall($hNvAPIDLL, "int", "NvAPI_GetDisplayDriverVersion") If NOT @error Then If IsArray($tmp) Then _ArrayDisplay($tmp) MsgBox(0,"DEBUG3","debug") ; DEBUG MESSAGE EndIf Else MsgBox(0,"DEBUG3","error") ; DEBUG MESSAGE EndIf DllClose($hNvAPIDLL)
-
anyone?
-
no, I'm saying it because I mean it. I talked with the guys from TeamViewer. Unfortunately their TeamViewer Host app doesn't provide the dynamically generated passwords as the QuickSupport app does. And I like the feature - a new password will be generated upon every start of TeamViewer_QS.exe I also do have a corporate license. So anybody ever tried to hide the window?
-
Hi All, I need to hide the TeamViewer Quicksupport (http://www.teamviewer.com/download/TeamViewerQS.exe) for legitimate reasons. This is my code: Local $hTeamViewer = WinGetHandle("TeamViewer", "") If @error Then If FileExists($TVQSExe) Then _WriteLog("_startTVQS, starting TV QS @ " & $TVQSExe) Run($TVQSExe, "", @SW_HIDE) Local $hTVwindow = WinWait("TeamViewer", "", 120) If $hTVwindow <> 0 Then ; WinSetState("[CLASS:#32770; TITLE:TeamViewer]", "", @SW_HIDE) WinSetState("TeamViewer", "", @SW_HIDE) _WriteLog("_startTVQS, successfully put TV window in background.") Else _WriteLog("_startTVQS, TV window not found after 120 seconds timeout limit.") EndIf Else _WriteLog("_startTVQS, TV QS not found @ " & $TVQSExe) EndIf Else _WriteLog("_startTVQS, there is an instance of TV already running.") EndIf The TeamViewerQS.exe actually extracts a TeamViewer.exe to the user's temp directory and then starts it. So starting the TVQS.exe with @SW_HIDE doesn't do anything. And also WinSetState fails to hide the window. WinGetState returns 21. Any ideas? Not even SW_MINIMIZE works. Thanks roka
-
Hi Melba23, Unfortunately I'm not talking about regular Edit Boxes. I'm using the RTF Controller box which is different. Check my code and you'll see. thx though
-
Hi folks, I just came to the point where I have to include a License Agreement in one of my scripts. So I want to load/embed a RTF file in my script, show it, and ask the user to accept it. I did some research in the forum. Apparently using the RichtextController is someone's best shot. So here's my code so far: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Func _startLicenseGUI() #Region ### START Koda GUI section ### Form=D:\...\License Agreement.kxf $Form1_1 = GUICreate("License Agreement", 606, 571, 427, 252, -1, BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE)) $Label2 = GUICtrlCreateLabel("License Agreement", 40, 24, 137, 20, 0) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) $Graphic1 = GUICtrlCreateGraphic(-8, 0, 611, 81) GUICtrlSetBkColor(-1, 0xFFFFFF) $Label1 = GUICtrlCreateLabel("Please read the following important information before continuing.", 48, 48, 310, 17, 0) GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) $oRP = ObjCreate("RICHTEXT.RichtextCtrl.1") $GUIActiveX = GUICtrlCreateObj($oRP, 48, 152, 513, 289, BitOR($ES_AUTOVSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_VSCROLL, $WS_OVERLAPPED)) GUICtrlSetPos($GUIActiveX, 48, 152, 513, 289) With $oRP; Object tag pool .FileName = @ScriptDir & '\License_EN.rtf' .Locked = True .ScrollBars () .MultiLine () .HideSelection = False EndWith GUISetState();Show GUI $Edit2 = GUICtrlCreateEdit("", 48, 104, 513, 25, BitOR($ES_READONLY,$ES_WANTRETURN), 0) GUICtrlSetData(-1, "Please read the following License Agreement. You must accept the terms of this agreement before continuing with the system activation.") $Radio1 = GUICtrlCreateRadio("I accept the agreement", 64, 456, 145, 25) $Radio2 = GUICtrlCreateRadio("I do not accept the agreement", 64, 480, 177, 33) $Button1 = GUICtrlCreateButton("Continue >>", 480, 534, 81, 25) $Button2 = GUICtrlCreateButton("Cancel", 376, 534, 81, 25) $Graphic2 = GUICtrlCreateGraphic(2, 520, 603, 2, BitOR($GUI_SS_DEFAULT_GRAPHIC,$SS_ETCHEDHORZ)) $Graphic3 = GUICtrlCreateGraphic(2, 82, 603, 2, BitOR($GUI_SS_DEFAULT_GRAPHIC,$SS_ETCHEDHORZ)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc _startLicenseGUI() It works out so far. The license text is shown in the window. Only problem left is the scrollbars of the Richtext Controller. I just can't get them to work. It seems like the apperance properties from the Richtext Editor are not completely integrated? Here's a link with all possible properties: Richtext Control Box Properties Maybe anybody of you ran into this once too and figured out how to get solved. It's bothering me. Also I'd rather embed the RTF file in the script somehow. Does anybody have experience with that? Thanks a lot Ronny
-
Hi, I got the same problem - POST isn't working for me ether. It's annoying, the HTTP POST doesn't seem to be that difficult but I still can't get it to work. Does anybody have a working solution for this? I don't want to use IE.au3 though. Thanks Ronny
-
Here's my addition: #include <GDIPlus.au3> #include <File.au3> #include <Array.au3> ; Declare array Dim $Images[1] ; Gets all JPG files in the current directory (@ScriptDir). Local $search = FileFindFirstFile("*.jpg") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No JPG files could be found.") Exit EndIf ; Resize array While 1 If IsArray($Images) Then Local $Bound = UBound($Images) ReDim $Images[$Bound+1] EndIf $Images[$Bound] = FileFindNextFile($search) If @error Then ExitLoop WEnd ; Close the search handle FileClose($search) ; Create directory "resized" if not there yet If NOT FileExists(@ScriptDir & "\resized\") Then DirCreate(@ScriptDir & "\resized\") EndIf ; Loop for JPGs - gets dimension of JPG and calls resize function to resize to 50% width and 50% height For $i = 1 to Ubound($Images)-1 If $Images[$i] <> "" AND FileExists(@ScriptDir & "\" & $Images[$i]) Then Local $ImagePath = @ScriptDir & "\" & $Images[$i] _GDIPlus_Startup() Local $hImage = _GDIPlus_ImageLoadFromFile($ImagePath) Local $ImageWidth = _GDIPlus_ImageGetWidth($hImage) Local $ImageHeight = _GDIPlus_ImageGetHeight($hImage) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() ;MsgBox(0,"DEBUG", $ImageWidth & " x " & $ImageHeight) Local $NewImageWidth = ($ImageWidth / 100) * 50 Local $NewImageHeight = ($ImageHeight / 100) * 50 ;MsgBox(0,"DEBUG: " & $i,$Images[$i]) _ImageResize(@ScriptDir & "\" & $Images[$i], @ScriptDir & "\resized\" & $Images[$i], $NewImageWidth, $NewImageHeight) EndIf Next ; Resize function Func _ImageResize($sInImage, $sOutImage, $iW, $iH) Local $hWnd, $hDC, $hBMP, $hImage1, $hImage2, $hGraphic, $CLSID, $i = 0 ;OutFile path, to use later on. Local $sOP = StringLeft($sOutImage, StringInStr($sOutImage, "\", 0, -1)) ;OutFile name, to use later on. Local $sOF = StringMid($sOutImage, StringInStr($sOutImage, "\", 0, -1) + 1) ;OutFile extension , to use for the encoder later on. Local $Ext = StringUpper(StringMid($sOutImage, StringInStr($sOutImage, ".", 0, -1) + 1)) ; Win api to create blank bitmap at the width and height to put your resized image on. $hWnd = _WinAPI_GetDesktopWindow() $hDC = _WinAPI_GetDC($hWnd) $hBMP = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) _WinAPI_ReleaseDC($hWnd, $hDC) ;Start GDIPlus _GDIPlus_Startup() ;Get the handle of blank bitmap you created above as an image $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP ($hBMP) ;Load the image you want to resize. $hImage2 = _GDIPlus_ImageLoadFromFile($sInImage) ;Get the graphic context of the blank bitmap $hGraphic = _GDIPlus_ImageGetGraphicsContext ($hImage1) ;Draw the loaded image onto the blank bitmap at the size you want _GDIPLus_GraphicsDrawImageRect($hGraphic, $hImage2, 0, 0, $iW, $iH) ;Get the encoder of to save the resized image in the format you want. $CLSID = _GDIPlus_EncodersGetCLSID($Ext) ;Generate a number for out file that doesn't already exist, so you don't overwrite an existing image. Do $i += 1 Until (Not FileExists($sOP & $i & "_" & $sOF)) ;Prefix the number to the begining of the output filename $sOutImage = $sOP & $i & "_" & $sOF ;Save the new resized image. _GDIPlus_ImageSaveToFileEx($hImage1, $sOutImage, $CLSID) ;Clean up and shutdown GDIPlus. _GDIPlus_ImageDispose($hImage1) _GDIPlus_ImageDispose($hImage2) _GDIPlus_GraphicsDispose ($hGraphic) _WinAPI_DeleteObject($hBMP) _GDIPlus_Shutdown() EndFunc Explanation - see comments! best Ronny
-
RegWrite HKLM64 with different results
roka replied to roka's topic in AutoIt General Help and Support
ok, I figured out that the script which writes in wow6432Node is executed by SYSTEM since it's a service which starts the executable. The other script is executed by ADMINISTRATOR and works fine with HKLM64. Even if a user of POWER USERS is executing the script, it writes to the correct registry. I'll check what's happening when I start the first script by Administrator instead of SYSTEM.... keep u posted. cheers -
Hi folks, 64 Bit XP Systems are a lot of fun. what would the world be like without it... Whatever - I am trying to write a registry value to HKLM64\SOFTWARE\SOMEDIR\ It is a normal string key. I have two different script EXEs. One of them is writing to the correct registry path at HKEY_LOCAL_MACHINE\SOFTWARE\SOMEDIR\dealercode The other one should write a reg key to HKEY_LOCAL_MACHINE\SOFTWARE\SOMEDIR\url But the key ends up in HKEY_LOCAL_MACHINE\SOFTWARE\wow6432node\SOMEDIR\url Does anybody had similar problems yet? This code is working: Global $gPosRegRoot = "HKLM64\SOFTWARE\SOMEDIR\" ... If StringRegExp($gDealerCode,'\A(\d\d\d\d\d)\z',0) Then If RegWrite($gPosRegRoot, "dealercode", "REG_SZ", $gDealerCode) Then _WriteLog("Successfully wrote value to registry. Dealer code: " & $gDealerCode) ElseIf @error <> 0 Then msgbox(262192, "Error", "Error writing values to the registry. Dealer code: " & $gDealerCode) _WriteLog("Error writing value to registry. Dealer code: " & $gDealerCode) Global $error = 1 EndIf Else msgbox(262192, "Error", "The dealer code does not meet the defined format." & @CRLF & "Please ensure the dealer code is correct and re-check it." & @CRLF & @CRLF & "The code should be 5 digits long (e.g. 01234)") Global $error = 1 EndIf If StringRegExp($gLocalMarket,'\A([:alpha:][:alpha:])-([:alpha:][:alpha:])\z',0) Then If RegWrite($gPosRegRoot, "localmarket", "REG_SZ", $gLocalMarket) Then _WriteLog("Successfully wrote value to registry. Local market: " & $gLocalMarket) ElseIf @error <> 0 Then msgbox(262192, "Error", "Error writing value to the registry. Local market: " & $gLocalMarket) _WriteLog("Error writing value to registry. Local market: " & $gLocalMarket) Global $error = 1 EndIf Else msgbox(262192, "Error", "The local market does not meet the defined format.") Global $error = 1 EndIf This code is not working (respectively, pointing to the wrong reg path): Global $REG_ROOT = "HKLM64\SOFTWARE\SOMEDIR\" ... ; Read the value "URL" from the registry key $REGURL = RegRead($REG_ROOT, "URL") If @error <> 0 Then _WriteLog("Maintenance, _DownloadFile, Error reading registry value from: " & $REG_ROOT & ", setting URL to default 'www.myurl.com/pos/" & $BrandName & "/maintenance/update' and writing Registry value.") $REGURL = "www.myurl.com/pos/" & $BrandName & "/maintenance/update" RegWrite($REG_ROOT, "URL", "REG_SZ", $REGURL) If @error <> 0 Then _WriteLog("Maintenance, _DownloadFile, Error writing registry value to: " & $REG_ROOT & "/" & $REGURL) EndIf EndIf