Sign in to follow this  
Followers 0
CodeTinkerer

Get data from Sharepoint List (XML?) to ListView

10 posts in this topic

#1 ·  Posted (edited)

So, I dont have any experience with XML's and I dont know how to get the information out of them in a form that I am able to have populate a ListView. 

So far I have been using this script: '?do=embed' frameborder='0' data-embedContent>>

In an attempt to pull the information, which it does, into an XML format for variable $x

 

How can I extract the information from $x and use it to poupulate a ListView.

Heres what the script looks like with my information put in for the site:

#include-once
Global $BasicAuthentication = _Base64Encode("")
    ;------------------------------------------------------------------------
    ;Example:
    ; dim $x
    ; $x=_sp_getxml("http://<yoursite>/<your subsite>","<yourlist","")
    ; _SP_DeleteListItems("http://<yoursite>/<your subsite>","<yourlist>",$x)
    ;------------------------------------------------------------------------

Dim $x
$x=_sp_getxml("http://coin/sites/west/CentralDivision/WIFulfillCenter","WFX Tech Time Off Pending",'<Query><OrderBy><FieldRef Name="ows_Modified" Ascending="TRUE"></FieldRef></OrderBy><Where><And><BeginsWith><FieldRef Name="ows_Status"></FieldRef><Value Type="Text">Closure</Value></BeginsWith><IsNotNull><FieldRef Name="Title"></FieldRef></IsNotNull></And></Where></Query>')
;ConsoleWrite($x)
MsgBox(1, "ScrapTest4.au3", $x)

Func _SP_GetXML($url,$list,$CAML)
    ;------------------------------------------------------------------------
    ;Make sure your default view is "AllItems"
    ; $url= URL to your site/subsite
    ; $list= Name of the Sharepointlist to query
    ; $CAMLquery= CAML based query string. Leave empty for the whole list.
    ;Return: XML string from Sharepoint list containing the filtered items
    ;------------------------------------------------------------------------
    Dim $request
    $url = $url & "/_vti_bin/Lists.asmx"
    $request =  "<?xml version='1.0' encoding='utf-8'?>"
    $request =  $request & "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>"
    $request =  $request & "<soap:Body>"
    $request =  $request & "<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>"
    $request =  $request & "              <listName>" & $list & "</listName>"
    $request =  $request & "              <ViewName></ViewName>"
    $request =  $request & '              ' & $CAML
    $request =  $request & "              <ViewFields></ViewFields>"
    $request =  $request & "              <rowLimit>20</rowLimit>"
    ;$request =  $request & "             <queryOptions></queryOptions>"
    $request =  $request & "              <webID></webID>"
    $request =  $request & "</GetListItems>"
    $request =  $request & "</soap:Body>"
    $request =  $request & "</soap:Envelope>"
    ;post it up and look at the response
    $XmlHttp=ObjCreate("Microsoft.XMLHTTP")
    $XmlHttp.open ("Get", $url, False)
    ;Pass username:password as a base64 string ($BasicAuthentication)
    $XmlHttp.SetRequestHeader ("Authorization", "Basic " & $BasicAuthentication)
    $XmlHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8")
    $XmlHttp.SetRequestHeader ("Accept", "text/xml; charset=UTF-8")
    $XmlHttp.send ($request)
    return ($XmlHttp.responsetext)
EndFunc

Func _Base64Encode($Data, $LineBreak = 76)
    Local $Opcode = "0x5589E5FF7514535657E8410000004142434445464748494A4B4C4D4E4F505152535455565758595A6162636465666768696A6B6C6D6E6F707172737475767778797A303132333435363738392B2F005A8B5D088B7D108B4D0CE98F0000000FB633C1EE0201D68A06880731C083F901760C0FB6430125F0000000C1E8040FB63383E603C1E60409C601D68A0688470183F90176210FB6430225C0000000C1E8060FB6730183E60FC1E60209C601D68A06884702EB04C647023D83F90276100FB6730283E63F01D68A06884703EB04C647033D8D5B038D7F0483E903836DFC04750C8B45148945FC66B80D0A66AB85C90F8F69FFFFFFC607005F5E5BC9C21000"
    Local $CodeBuffer = DllStructCreate("byte[" & BinaryLen($Opcode) & "]")
    DllStructSetData($CodeBuffer, 1, $Opcode)
    $Data = Binary($Data)
    Local $Input = DllStructCreate("byte[" & BinaryLen($Data) & "]")
    DllStructSetData($Input, 1, $Data)
    $LineBreak = Floor($LineBreak / 4) * 4
    Local $OputputSize = Ceiling(BinaryLen($Data) * 4 / 3)
    $OputputSize = $OputputSize + Ceiling($OputputSize / $LineBreak) * 2 + 4
    Local $Ouput = DllStructCreate("char[" & $OputputSize & "]")
    DllCall("user32.dll", "none", "CallWindowProc", "ptr", DllStructGetPtr($CodeBuffer), _
                                                    "ptr", DllStructGetPtr($Input), _
                                                    "int", BinaryLen($Data), _
                                                    "ptr", DllStructGetPtr($Ouput), _
                                                    "uint", $LineBreak)
    Return DllStructGetData($Ouput, 1)
EndFunc

And my output:

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/"><GetListItemsResult><listitems xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
     xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
     xmlns:rs='urn:schemas-microsoft-com:rowset'
     xmlns:z='#RowsetSchema'>
<rs:data ItemCount="9">
   <z:row ows_Sup_x0020_Name='Tad Peak' ows_Tech_x0020_ID_x0020_Number='0267' ows_LinkTitle='Zach Washa' ows_Start_x0020_Date='2015-05-15 08:00:00' ows_End_x0020_Date='2015-05-15 12:00:00' ows_Tech_x0020_Time_x0020_Off_x0020_='Vacation' ows_NOTES='Kindergarten graduation for Corinne' ows_Author='19945;#Washa, Zach P' ows_Created='2015-03-28 14:42:17' ows_days='float;#47.7206365740785' ows__ModerationStatus='0' ows__Level='1' ows_UniqueId='70898;#{7610386C-0B9D-49B4-870B-0CE3C89D8A9E}' ows_FSObjType='70898;#0' ows_Created_x0020_Date='70898;#2015-03-28 14:42:17' ows_Modified='2015-03-28 14:42:17' ows_MetaInfo='70898;#' ows_ID='70898' ows_owshiddenversion='1' ows_Title='Zach Washa' ows_FileLeafRef='70898;#70898_.000' ows_PermMask='0x1b03c4312ef' ows_FileRef='70898;#sites/west/CentralDivision/WIFulfillCenter/Lists/WFX Tech Time Off Form/70898_.000' />
   <z:row ows_Entered_x0020_In_x0020_WFX='No' ows_Sup_x0020_Name='Eric Grose' ows_Tech_x0020_ID_x0020_Number='114' ows_LinkTitle='Marissa Cozza' ows_Start_x0020_Date='2015-04-01 10:00:00' ows_End_x0020_Date='2015-04-01 14:00:00' ows_Type_x0020_of_x0020_Exception='Special Project' ows_NOTES='&lt;div&gt;Truck in for maint&lt;/div&gt;' ows_Author='27401;#Grose, Eric' ows_Created='2015-03-28 12:40:10' ows_Same_x0020_Day_x0020_Request_x00='Yes' ows_Is_x0020_This_x0020_A_x0020_CB_x='No' ows_Is_x0020_this_x0020_a_x0020_Syst='No' ows_days='float;#3.88877314814454' ows__ModerationStatus='0' ows__Level='1' ows_UniqueId='70887;#{7D2ADDC2-546E-471C-ADD5-9875F04B7311}' ows_FSObjType='70887;#0' ows_Created_x0020_Date='70887;#2015-03-28 12:40:10' ows_Modified='2015-03-28 12:40:10' ows_MetaInfo='70887;#' ows_ID='70887' ows_owshiddenversion='1' ows_Title='Marissa Cozza' ows_FileLeafRef='70887;#70887_.000' ows_PermMask='0x1b03c4312ef' ows_FileRef='70887;#sites/west/CentralDivision/WIFulfillCenter/Lists/WFX Tech Time Off Form/70887_.000' />
   <z:row ows_Entered_x0020_In_x0020_WFX='No' ows_Sup_x0020_Name='Josh Eichelt' ows_Tech_x0020_ID_x0020_Number='0161' ows_LinkTitle='Matt Rapraeger' ows_Start_x0020_Date='2015-04-01 08:00:00' ows_End_x0020_Date='2015-04-01 09:30:00' ows_Type_x0020_of_x0020_Exception='Meeting' ows_NOTES='&lt;div&gt;Reconcile and meeting as matt will be out Mon and Tue for a funeral&lt;/div&gt;' ows_Author='671;#Eichelt, Joshua A' ows_Created='2015-03-27 20:16:35' ows_Same_x0020_Day_x0020_Request_x00='No' ows_Is_x0020_This_x0020_A_x0020_CB_x='No' ows_Is_x0020_this_x0020_a_x0020_Syst='No' ows_days='float;#4.48848379629635' ows__ModerationStatus='0' ows__Level='1' ows_UniqueId='70830;#{8D86AF87-B770-41D9-9CDA-BDC0F0DB743A}' ows_FSObjType='70830;#0' ows_Created_x0020_Date='70830;#2015-03-27 20:16:35' ows_Modified='2015-03-27 20:16:35' ows_MetaInfo='70830;#' ows_ID='70830' ows_owshiddenversion='1' ows_Title='Matt Rapraeger' ows_FileLeafRef='70830;#70830_.000' ows_PermMask='0x1b03c4312ef' ows_FileRef='70830;#sites/west/CentralDivision/WIFulfillCenter/Lists/WFX Tech Time Off Form/70830_.000' />
   <z:row ows_Sup_x0020_Name='Alan Zarecki' ows_Tech_x0020_ID_x0020_Number='0358' ows_LinkTitle='Brandon Lindgren' ows_Start_x0020_Date='2015-04-10 10:00:00' ows_End_x0020_Date='2015-04-10 21:00:00' ows_Tech_x0020_Time_x0020_Off_x0020_='Vacation' ows_NOTES='Family Birthday Celebration' ows_Author='26841;#Lindgren, Brandon P' ows_Created='2015-03-27 20:07:55' ows_days='float;#13.5778356481460' ows__ModerationStatus='0' ows__Level='1' ows_UniqueId='70828;#{ACB69DE2-1F40-4A7D-B45E-094D79A5788B}' ows_FSObjType='70828;#0' ows_Created_x0020_Date='70828;#2015-03-27 20:07:55' ows_Modified='2015-03-27 20:07:55' ows_MetaInfo='70828;#' ows_ID='70828' ows_owshiddenversion='1' ows_Title='Brandon Lindgren' ows_FileLeafRef='70828;#70828_.000' ows_PermMask='0x1b03c4312ef' ows_FileRef='70828;#sites/west/CentralDivision/WIFulfillCenter/Lists/WFX Tech Time Off Form/70828_.000' />
   <z:row ows_Entered_x0020_In_x0020_WFX='No' ows_Sup_x0020_Name='John Hicks' ows_Tech_x0020_ID_x0020_Number='239' ows_LinkTitle='Alex Sulkowski' ows_Start_x0020_Date='2015-03-30 18:00:00' ows_End_x0020_Date='2015-03-30 19:00:00' ows_Type_x0020_of_x0020_Exception='Meeting' ows_NOTES='&lt;div&gt;Review&lt;/div&gt;' ows_Author='747;#Hicks, John' ows_Created='2015-03-27 20:06:33' ows_Same_x0020_Day_x0020_Request_x00='No' ows_Is_x0020_This_x0020_A_x0020_CB_x='No' ows_Is_x0020_this_x0020_a_x0020_Syst='No' ows_days='float;#2.91211805555213' ows__ModerationStatus='0' ows__Level='1' ows_UniqueId='70827;#{24222BE3-C5EE-419F-BB0E-5BB30C8A4C5B}' ows_FSObjType='70827;#0' ows_Created_x0020_Date='70827;#2015-03-27 20:06:33' ows_Modified='2015-03-27 20:06:33' ows_MetaInfo='70827;#' ows_ID='70827' ows_owshiddenversion='1' ows_Title='Alex Sulkowski' ows_FileLeafRef='70827;#70827_.000' ows_PermMask='0x1b03c4312ef' ows_FileRef='70827;#sites/west/CentralDivision/WIFulfillCenter/Lists/WFX Tech Time Off Form/70827_.000' />
   <z:row ows_Entered_x0020_In_x0020_WFX='No' ows_Sup_x0020_Name='Christopher Gribble' ows_Tech_x0020_ID_x0020_Number='474' ows_LinkTitle='Zac CAves' ows_Start_x0020_Date='2015-03-31 08:00:00' ows_End_x0020_Date='2015-03-31 09:00:00' ows_Type_x0020_of_x0020_Exception='Meeting' ows_NOTES='&lt;div&gt;&lt;/div&gt;' ows_Author='3079;#Gribble, Christopher R' ows_Created='2015-03-27 19:25:01' ows_Same_x0020_Day_x0020_Request_x00='No' ows_Is_x0020_This_x0020_A_x0020_CB_x='No' ows_Is_x0020_this_x0020_a_x0020_Syst='No' ows_days='float;#3.52429398148524' ows__ModerationStatus='0' ows__Level='1' ows_UniqueId='70825;#{F60BF74A-739F-450B-B1F3-990BB1EFD5FA}' ows_FSObjType='70825;#0' ows_Created_x0020_Date='70825;#2015-03-27 19:25:01' ows_Modified='2015-03-27 19:25:01' ows_MetaInfo='70825;#' ows_ID='70825' ows_owshiddenversion='1' ows_Title='Zac CAves' ows_FileLeafRef='70825;#70825_.000' ows_PermMask='0x1b03c4312ef' ows_FileRef='70825;#sites/west/CentralDivision/WIFulfillCenter/Lists/WFX Tech Time Off Form/70825_.000' />
   <z:row ows_Sup_x0020_Name='Jim Banta' ows_Tech_x0020_ID_x0020_Number='0118' ows_LinkTitle='John Gessner' ows_Start_x0020_Date='2015-07-12 08:00:00' ows_End_x0020_Date='2015-07-12 19:00:00' ows_Tech_x0020_Time_x0020_Off_x0020_='Floating Holiday' ows_Author='35724;#Gessner, John' ows_Created='2015-03-27 09:15:51' ows_days='float;#106.947326388894' ows__ModerationStatus='0' ows__Level='1' ows_UniqueId='70765;#{E3EA6319-E1D4-4581-A7C3-778B60B0A3F1}' ows_FSObjType='70765;#0' ows_Created_x0020_Date='70765;#2015-03-27 09:15:51' ows_Modified='2015-03-27 09:15:51' ows_MetaInfo='70765;#' ows_ID='70765' ows_owshiddenversion='1' ows_Title='John Gessner' ows_FileLeafRef='70765;#70765_.000' ows_PermMask='0x1b03c4312ef' ows_FileRef='70765;#sites/west/CentralDivision/WIFulfillCenter/Lists/WFX Tech Time Off Form/70765_.000' />
   <z:row ows_Sup_x0020_Name='Doug Kurschner' ows_Tech_x0020_ID_x0020_Number='6514' ows_LinkTitle='Eric Hagman' ows_Start_x0020_Date='2015-05-17 08:00:00' ows_End_x0020_Date='2015-05-24 19:00:00' ows_Tech_x0020_Time_x0020_Off_x0020_='Vacation' ows_NOTES='&lt;div&gt;&lt;/div&gt;' ows_Author='3141;#Hagman, Eric C' ows_Created='2015-03-26 20:04:58' ows_days='float;#51.4965509259273' ows__ModerationStatus='0' ows__Level='1' ows_UniqueId='70696;#{D89C9455-9BA7-4937-A7C5-87AB9EDF41F0}' ows_FSObjType='70696;#0' ows_Created_x0020_Date='70696;#2015-03-26 20:04:58' ows_Modified='2015-03-26 20:04:58' ows_MetaInfo='70696;#' ows_ID='70696' ows_owshiddenversion='1' ows_Title='Eric Hagman' ows_FileLeafRef='70696;#70696_.000' ows_PermMask='0x1b03c4312ef' ows_FileRef='70696;#sites/west/CentralDivision/WIFulfillCenter/Lists/WFX Tech Time Off Form/70696_.000' />
   <z:row ows_Sup_x0020_Name='Doug Kurschner' ows_Tech_x0020_ID_x0020_Number='6514' ows_LinkTitle='Eric Hagman' ows_Start_x0020_Date='2015-04-06 13:00:00' ows_End_x0020_Date='2015-04-06 17:00:00' ows_Tech_x0020_Time_x0020_Off_x0020_='Vacation' ows_NOTES='&lt;div&gt;&lt;/div&gt;' ows_Author='3141;#Hagman, Eric C' ows_Created='2015-03-26 19:58:34' ows_days='float;#10.7093287036987' ows__ModerationStatus='0' ows__Level='1' ows_UniqueId='70695;#{DA4A402B-16AD-4965-96DE-4563E442AA76}' ows_FSObjType='70695;#0' ows_Created_x0020_Date='70695;#2015-03-26 19:58:34' ows_Modified='2015-03-26 19:58:34' ows_MetaInfo='70695;#' ows_ID='70695' ows_owshiddenversion='1' ows_Title='Eric Hagman' ows_FileLeafRef='70695;#70695_.000' ows_PermMask='0x1b03c4312ef' ows_FileRef='70695;#sites/west/CentralDivision/WIFulfillCenter/Lists/WFX Tech Time Off Form/70695_.000' />
</rs:data>
</listitems></GetListItemsResult></GetListItemsResponse></soap:Body></soap:Envelope>

The information I need IS there! but the easiest way I was able to figure out was to safe $x to a file, Re-open the file and filter out the information a piece at a time as the file is read.

Any Ideas would help!

Edited by CodeTinkerer

Share this post


Link to post
Share on other sites



StringLen, StringLeft, StringRight, StringSplit, StrInginStr, etc. You dont need to save it to an external file if it is already a variable in autoit.


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Or StringRegExp using a pattern built according to the desired results

Edit

e.g.

#Include <Array.au3>

$txt = FileRead("1.txt")
; example : get the 4 first data from the concerned rows
$a = StringRegExp($txt, "(?m)^(?:.*WFX='([^']+))?.*Name='([^']+).*Number='([^']+).*LinkTitle='([^']+).*$", 4)
Local $res[UBound($a)][4]
  For $i = 0 to UBound($res)-1
   For $j = 1 to 4
      $res[$i][$j-1] = ($a[$i])[$j]
   Next
Next
 _ArrayDisplay($res, "results", "", 0, "|", "WFX|Name|Number|LinkTitle")
Edited by mikell

Share this post


Link to post
Share on other sites

"PARSING" is what I was looking for eh? Awesome, thanks for the help! I will take what I have learned here and apply it, be back with the results!

Share this post


Link to post
Share on other sites

Ok so ive gotten pretty far with this since the initial start of the project.

My new issue: 

Im not able to get the string for a specific piece of data, not sure if its because the string has symbols in it or what, need a fresh pair of eyes to take a look and make sure im not over thinking this.

_UpdateTechTicketFeed(_GetTechTickets($x), $TechTicketFeed)

Func _UpdateTechTicketFeed($TechTicketData, $LstId)
   Local $RowString[UBound($TechTicketData, 1)]
   Local $zTime = @Year & "-" & @Mon & "-" & @MDay
   _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($LstId))
   For $a = 0 to Ubound($TechTicketData, 1) - 1
         $RowString[$a] = ($TechTicketData[$a][0] & "|" & $TechTicketData[$a][1] & "|" & $TechTicketData[$a][2] & "|" & $TechTicketData[$a][3] & "|" & $TechTicketData[$a][4])
         If StringInStr($TechTicketData[$a][5], $zTime) Then
            GuiCtrlCreateListViewItem($RowString[$a], $LstId)
         EndIf
   Next
   ;Return
EndFunc


Func _GetTechTickets($XMLData)
   local $a = StringRegExp($XMLData, "(?m)^(?:.*x005c_='([^']+))?(?:.*Name='([^']+))?.*Number='([^']+).*LinkTitle='([^']+)(?:.*Area='([^']+))?.*Start_x0020_Date='([^']+)(.*$)", 4)
   Local $res[UBound($a)][6]
   For $i = 0 to UBound($res)-1
      For $j = 1 to 6
         $res[$i][$j-1] = ($a[$i])[$j]
      Next
   Next
   MsgBox(0, "TEST", $Res[0][4])
   Return $res
EndFunc

For "Area=" it leaves the dim in the array blank. The XML has the value: ows_Current_x0020_Area='A: S Door ST Bay 12'

Whats am I missing? All the other values populate the array perfectly!

Share this post


Link to post
Share on other sites

Nevermind! That part of the XML Data should have been tested AFTER "Start_x0020_Date=". moved the test to the back and it works perfectly!

Share this post


Link to post
Share on other sites

You could use this 'classical' approach too  :)

#Include <Array.au3>

$txt = FileRead("1.txt")
$txt = StringRegExpReplace(StringRegExpReplace($txt, "_x([[:xdigit:]]*)_?|'", ""), "(ows_+)", "|")

$lines = StringRegExp($txt, "<z:row\h\|(.*?)/>", 3)
For $i = 0 to UBound($lines)-1
   $res = StringSplit($lines[$i], "|")
   Local $2d[UBound($res)-1][2]
        For $k = 1 to UBound($res)-1
            $tmp = StringSplit($res[$k], "=")
            $2d[$k-1][0] = $tmp[1]
            $2d[$k-1][1] = $tmp[2]
        Next
   _ArrayDisplay($2d)
Next
1 person likes this

Share this post


Link to post
Share on other sites

 

You could use this 'classical' approach too  :)

#Include <Array.au3>

$txt = FileRead("1.txt")
$txt = StringRegExpReplace(StringRegExpReplace($txt, "_x([[:xdigit:]]*)_?|'", ""), "(ows_+)", "|")

$lines = StringRegExp($txt, "<z:row\h\|(.*?)/>", 3)
For $i = 0 to UBound($lines)-1
   $res = StringSplit($lines[$i], "|")
   Local $2d[UBound($res)-1][2]
        For $k = 1 to UBound($res)-1
            $tmp = StringSplit($res[$k], "=")
            $2d[$k-1][0] = $tmp[1]
            $2d[$k-1][1] = $tmp[2]
        Next
   _ArrayDisplay($2d)
Next

Oh My gosh lol, I had a hard enough time interpreting the first presented expression LOL. I need a good rundown on StringRegExp expressions and how they work together. I managed, but with little knowlege :P

Still working on this project and its coming along nice thanks to the help that I greatly appreciate!

Now im trying to figure out how to submit data from a custom GUI form to Sharepoint database like the Sharepoint forms do. otherwise im stuck opening an explorer window via direct URL with a button, which is less... classy :P.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Ok, so new issue:

Im finding on different machines this part of my function here is either Slower, or a bit faster than on the machine I script it on. is there a way to be sure the transitional effect stays the same regardless of the CPU processing?

;Start the fade-in of the pop-up window
$n = 0
$way = 0
   WinSetTrans($Main_Gui,"",0)
While $oIE.LocationURL = ("http://www.google.com/")
        WinSetTrans("Install Cancel Req Forms","",$n)
        if $n <= 35 then
            $n = $n + .05
        ElseIf $n > 35 And $n < 75 Then
            $n = $n + .1
        ElseIf $n > 75  And $n < 120 Then
            $n = $n + .2
        ElseIf $n > 120 And $n < 195 Then
            $n = $n + .3
         ElseIf $n > 195 AND $Way = 0 And $n < 250 Then
            $Way = 2
            _ShowBrowser($Way)
         EndIf
WEnd

More of my script if you need a demo (not tested working for this snip)

Func PopCanForms()
global $BG = GUICreate("Install Cancel Req Forms", 1440, 900, -1, -1, BitOR($WS_SYSMENU,$WS_POPUP), BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
global $G = GUICtrlCreateLabel("Press ESC to Close", 1140, 12, 288, 36, $SS_CENTER)
GUICtrlSetFont(-$G, 15, 800, 0, "BankGothic Md BT")
global $Main_Gui = GUICreate("", 1440, 900, -1, -1, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
local $oIE = ObjCreate("Shell.Explorer.2")
HotKeySet("{ESC}", "QuitPop")
global $GUIActiveX = GUICtrlCreateObj ($oIE, 35, 75, 1360, 768)

$oIE.navigate("http://www.google.com/")


While not $oIE.LocationURL = ("http://www.google.com/")
    Sleep(100)
 WEnd

   $wp = WinGetPos(WinGetHandle("Untitled"))
   WinSetTrans("Install Cancel Req Forms","",0)
   GUISetState(@SW_SHOW,$BG)
   GUISetState(@SW_Disable, $BG) ;Disabled otherwise causes the pop-up window to become inactive other than pressing esc because of hotkey exit.
   GUISwitch($BG)
;Start the fade-in of the pop-up window
$n = 0
$way = 0
   WinSetTrans($Main_Gui,"",0)
While $oIE.LocationURL = ("http://www.google.com/")
        WinSetTrans("Install Cancel Req Forms","",$n)
        if $n <= 35 then
            $n = $n + .05
        ElseIf $n > 35 And $n < 75 Then
            $n = $n + .1
        ElseIf $n > 75  And $n < 120 Then
            $n = $n + .2
        ElseIf $n > 120 And $n < 195 Then
            $n = $n + .3
         ElseIf $n > 195 AND $Way = 0 And $n < 250 Then
            $Way = 2
            _ShowBrowser($Way)
         EndIf
WEnd


QuitPop() ;when the url changes, start the fade-out of the popup window
EndFunc


Func _ShowBrowser($oNF)
   GUISetControlsVisible($Main_Gui)
   GUISetState(@SW_SHOW,$Main_Gui)
   If $oNF = 2 Then
   Local $z = 0
   While 1
        WinSetTrans($Main_Gui,"",$z)
        if $z <= 35 then
            $z = $z + .4
        ElseIf $z > 35 And $z < 75 Then
            $z = $z + 1
        ElseIf $z > 75  And $z < 120 Then
            $z = $z + 2
        ElseIf $z > 120 And $z < 195 Then
            $z = $z + 3
         ElseIf $z > 195 and $z < 250 Then
            WinSetTrans($Main_Gui,"",255)
            ExitLoop
        EndIf
     WEnd
    EndIf
EndFunc



Func QuitPop()
   $n = 196


   While 1;fade the popup window out
      if $n <=  1 then
         $n = $n - .3
         exitloop
      ElseIf $n < 75 Then
         $n = $n - .1
      ElseIf $n < 300 and $n > 75 Then
         $n = $n - .05
      EndIf
      WinSetTrans($Main_Gui,"",$n)
      WinSetTrans($BG,"",$n)
WEnd

;kill all pop up gui's and controls.
   HotKeySet("{ESC}")
   GUIDelete( $GUIActiveX )
   GUIDelete( $Main_Gui )
   GUIDelete( $BG )
EndFunc
Edited by CodeTinkerer

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0