Jump to content

ChrisL

Active Members
  • Posts

    1,763
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by ChrisL

  1. Figured i out, you have to send a 301 with the new location back to the browser If StringInStr(FileGetAttrib($sRootDir & $sRequest),"D") then If StringRight($sRequest,1) <> "/" then $sRequest &= "/" _HTTP_SendLocationHeader($aSocket[$x], $sRequest) EndIf EndIf Func _HTTP_SendLocationHeader($hSocket,$sFileLoc, $sMimeType = "text/html", $sReply = "301 Moved Permanently") $sPacket = Binary("HTTP/1.1 " & $sReply & @CRLF & _ "Location: " & $sFileLoc & @CRLF & _ @CRLF) TCPSend($hSocket, $sPacket) ; Send start of packet EndFunc
  2. I know this is an old thread but I've been playing with this and it's pretty cool. However there is a small bug, If you host a website inside a subfolder WWW/src and you type 127.0.0.1/src into the browser the main index.html loads but any imags, css, js files etcwill have an incorrect path. If you type 127.0.0.1/src/ (note the slash at the end) then the page loads correctly and all parts of the page load. If you use (say) apache webserver and type the URL without the closing slash then apache sends a message back to the browser to tell it to update the url with a forward slash (you can see this happen in the browser window the url is automatically appended) With the Autoit webserver the forward slash is not automatically appended in the browser window, which leaves me to believe there must be a command sent back to the browser window to tell it to update the url. I've not found anything about this so I'm hoping someone here might have some experience with it. It isn't just a case of adding a slash in the code this still doesn't work, you have to tell the browser to update the url with the forward slash. Thanks
  3. Yeah I've definitely had some error in the temp directory. Can the path be set/configured anywhere, so maybe I can use a folder outside of the user directory?
  4. Hi I did a search but maybe I didn't have the right search terms. Can you change the directory that Autoit uses to compile scripts, by default it's the 'user' temp directory and then it gets moved to the script directory (or wherever you have it set in Scite) However Defender is always blocking the files during compile, so rather than setting an exclude directory of my 'temp' directory I wondered if it's possible to change the directory Autoit uses as its temporary compile location? Thanks Chris
  5. Thank you I will give that a try
  6. No I can't do that because sometimes it maybe a completely different string, which is why I included the albums/ as part of the search term, sometimes it has shared- and sometimes it doesn't. So basically if it doesn't contain /albums then leave it, if it contains album/shared-xxxxxxx then trim it, if it contains albums/xxxxxxx then trim it
  7. I was getting rid of the "random number" or "shared-random number"
  8. Typical as soon as I click post I get it... $regEx = "albums/(?:shared-)?(\d+$)" missing a ? after :shared-)?
  9. $Str1 = "/photo-selection/my-albums/1104042" $Str2 = "/photo-selection/my-albums/shared-982502" $regEx = "albums/(?:shared-)(\d+$)" MsgBox(0,"",StringRegExpReplace($Str1,$RegEx,"albums/")) MsgBox(0,"",StringRegExpReplace($Str2,$RegEx,"albums/")) Can someone help with this, I need 1 RegEx to work with both strings, sometimes it contains "shared-" and sometimes not, I know there are other ways to do it but I think it should be possible to do with just StringRegExp Thanks
  10. Has anyone figured out whats going on with x64, I tried the 3.3.15.3 beta an that still crashes for me and I don't really want to use #AutoIt3Wrapper_UseX64 = no if possible Thanks
  11. #include <GUIConstantsEx.au3> #include <GuiTreeView.au3> #include <WindowsConstants.au3> #include <GuiMenu.au3> Global $g_hTreeView Global Enum $e_idOpen = 1000, $e_idSave, $e_idInfo Example() Func Example() Local $hGUI, $hItem Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES) $hGUI = GUICreate("(UDF Created) TreeView Create", 400, 300) $g_hTreeView = _GUICtrlTreeView_Create($hGUI, 2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU") GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") _GUICtrlTreeView_BeginUpdate($g_hTreeView) For $x = 1 To Random(2, 10, 1) $hItem = _GUICtrlTreeView_Add($g_hTreeView, 0, StringFormat("[%02d] New Item", $x)) For $y = 1 To Random(2, 10, 1) _GUICtrlTreeView_AddChild($g_hTreeView, $hItem, StringFormat("[%02d] New Child", $y)) Next Next _GUICtrlTreeView_EndUpdate($g_hTreeView) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Func WM_CONTEXTMENU($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam ;ConsoleWrite($GUI_RUNDEFMSG & @CRLF) ;Switch $wParam ; Case $hTreeView Local $hMenu $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $e_idOpen) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $e_idSave) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $e_idInfo) _GUICtrlMenu_TrackPopupMenu($hMenu, $wParam) _GUICtrlMenu_DestroyMenu($hMenu) Return True ;EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_CONTEXTMENU Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Switch $wParam Case $e_idOpen _DebugPrint("WM_COMMAND " & $wParam & " Open") Case $e_idSave _DebugPrint("WM_COMMAND " & $wParam & " Save") Case $e_idInfo _DebugPrint("WM_COMMAND " & $wParam & " Info") EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview $hWndTreeview = $g_hTreeView If Not IsHWnd($g_hTreeView) Then $hWndTreeview = GUICtrlGetHandle($g_hTreeView) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndTreeview Switch $iCode Case $NM_CLICK ; The user has clicked the left mouse button within the control _DebugPrint("$NM_CLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; Return 1 ; nonzero to not allow the default processing Return 0 ; zero to allow the default processing Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control _DebugPrint("$NM_DBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; Return 1 ; nonzero to not allow the default processing Return 0 ; zero to allow the default processing EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @CRLF & _ "+======================================================" & @CRLF & _ "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _ "+======================================================" & @CRLF) EndFunc ;==>_DebugPrint In the example code I have a treeview and a context/popup menu, I can't use a conventional context menu because I need to use the treeview UDF functions. The WM_COMMAND never fires from the context/popup menu selection while there is a treeview using _GuiCtrlTreeview_Create If you comment out _GuiCtrlTreeview_Create line you will then see the right click selection works as expected and the debug is written to the console on selection. Autoit Ver 3.3.14.2 Any ideas why this combination won't work together? Thanks
  12. OK, great thanks, I'll try it out
  13. I don't understand why I can't read some XML, the example below shows the problem. _Test() the XML contains xmlns="http://ns.adobe.com/air/framework/update/description/2.5" and will not read the versionNumber _TestNoNameSpace() has the namespace removed and works fine. Anyone know why or how I can get this working please? #include "_XMLDomWrapper.au3" MsgBox(0,"",_Test()) MsgBox(0,"",_TestNoNamespace()) Func _Test() Local $Str = '<update xmlns="http://ns.adobe.com/air/framework/update/description/2.5"><versionNumber>7.0.215</versionNumber></update>' _XMLLoadXML($str) $ret = _XMLGetFirstValue("/update/versionNumber") Return $ret EndFunc Func _TestNoNamespace() Local $Str = '<update><versionNumber>7.0.215</versionNumber></update>' _XMLLoadXML($str) $ret = _XMLGetFirstValue("/update/versionNumber") Return $ret EndFunc Func _XMLGetFirstValue($node) Local $ret_val $ret_val = _XMLGetValue($node) If IsArray($ret_val) Then Return ($ret_val[1]) Else Return SetError(1,3,0) EndIf EndFunc
  14. Thanks, not sure that will work as it's another application is stopping and starting the service and I have an event listener on the WIA service, if another application stops and starts the service the event listener no longer works. So the service isn't actually failing.
  15. I need to know if a service is still running or not I can use ServiceControl.au3 and _ServiceRunning(@computername,"stisvc") but is there a way of getting an event notification that a service is starting or stopping without keep manually checking? Thanks
  16. Thanks for the reply and suggestion!
  17. Is it possible with Autoit to have buttons as listview items like the attached image?
  18. Ahh I miss-read that! I have now done this and it does solve the issue, I shouldn't really have to do this, I would expect the memory to be released.
  19. I do delete the object and recreate and that is where the memory leak happens, even if there is a long delay there is always memory taken up when you create a flash object delete it and create another several times.
  20. It's a real problem in a huge script, the one I posted above is a simplified script to show the problem
  21. I have a memory leak caused by an object ShockwaveFlash. The below script will delete the the control and the object and recreate it, if you watch the memory in Task Manager it keeps going up every time you delete and recreate the control. Any ideas? Thanks Opt("GuiOnEventMode",1) #include <GUIConstantsEx.au3> Global $hGui, $flashControl, $SWFObj _Gui() While 1 Sleep(250) WEnd Func _Gui() $hGui = GUICreate("ShockwaveFlash.ShockwaveFlash",280,280) GuiSetState() GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit") $flashControl = _CreateSWF(@scriptDir & "\loading9.swf", 40,40, 200,200) Local $button = GUICtrlCreateButton("Delete and Renew",10,10) GUICtrlSetOnEvent($button,"_DeleteFlashControlAndCreateANewOne") EndFunc Func _DeleteFlashControlAndCreateANewOne() GUICtrlDelete($flashControl) ConsoleWrite("$SWFObj is object = " & IsObj($SWFObj) & @CRLF) $SWFObj = 0 ConsoleWrite("$SWFObj is object = " & IsObj($SWFObj) & " so why don't I get my memory back?" & @CRLF) Sleep(250) $flashControl = _CreateSWF(@scriptDir & "\loading9.swf", 40,40, 200,200) EndFunc Func _CreateSWF($SWFPath, $SWFL, $SWFT, $SWFW, $SWFH, $SWFBGColor = "#000000") If NOT FileExists($SWFPath) then Return $SWFObj = ObjCreate("ShockwaveFlash.ShockwaveFlash") Local $SWFActiveX = GUICtrlCreateObj($SWFObj, $SWFL, $SWFT, $SWFW, $SWFH) With $SWFObj .Movie = $SWFPath .ScaleMode = 1 .bgcolor = $SWFBGColor .Loop = True .allowScriptAccess = "Always" .Quality = 1 .Playing = 1 .Menu = 1 EndWith Return $SWFActiveX EndFunc Func _Exit() Exit EndFunc loading9.zip
  22. Thank you, much more complicated than I thought but it works great on the test image!
  23. I was meant too! Must have clicked the wrong button. Sorry
×
×
  • Create New...