Jump to content

ChrisL

Active Members
  • Posts

    1,763
  • Joined

  • Last visited

  • Days Won

    1

ChrisL last won the day on October 25 2011

ChrisL had the most liked content!

About ChrisL

  • Birthday 01/21/1975

Profile Information

  • Member Title
    Mass Spanner!
  • Location
    Peterborough
  • WWW
    http://www.2inept.co.uk

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

ChrisL's Achievements

Universalist

Universalist (7/7)

15

Reputation

  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. 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
  6. I was getting rid of the "random number" or "shared-random number"
  7. Typical as soon as I click post I get it... $regEx = "albums/(?:shared-)?(\d+$)" missing a ? after :shared-)?
  8. $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
  9. 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
  10. #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
  11. 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
×
×
  • Create New...