
lavascript
Active Members-
Posts
51 -
Joined
-
Last visited
Content Type
Forums
Downloads
Forum Articles
Events
Everything posted by lavascript
-
_Word_DocTableRead, modify, Write back
lavascript replied to lavascript's topic in AutoIt General Help and Support
Awesome, thanks! I'll give it a shot. Edit: Works perfectly! -
_Word_DocTableRead, modify, Write back
lavascript replied to lavascript's topic in AutoIt General Help and Support
There are color, font, and table width settings that I would like to keep. Would I just be better off rebuilding the table from scratch and setting these things after the fact? -
I have a Word document containing a 9-column table where row 1 is the column headers. My goal is to read the table into a 2d array, remove some rows, update some fields, and add a few rows to the end. The resulting array will likely be a different length. Next, I want to write the data back into the table. If it's easier, I can write the data to a new document from a template containing the same table header with a blank 2nd row. Here's my early attempt: Local $oWord = _Word_Create() Local $oDoc = _Word_DocOpen($oWord, $sFile) Local $aData = _Word_DocTableRead($oDoc, 1) $aData[3][5] = "Something else" Local $oRange = _Word_DocRangeSet($oDoc, 0) $oRange = _Word_DocRangeSet($oDoc, $oRange, $wdCell, 9) _Word_DocTableWrite($oRange,$aData) This, unfortunately, writes the entire array into the first cell of row 2. What am I doing wrong?
-
(For the record, I had removed the GUICtrlSetData from the script during testing and typo'd when I typed it back into the forum) And THANK YOU. I had copied that code from a script I wrote last year that I KNEW was working. Missed a daggum comma.
-
#include <Constants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Dim $hWin = GUICreate("Ping",400,200) Dim $hEdit = GUICtrlCreateEdit("",5,5,390,190);,$GUI_SS_DEFAULT_EDIT - $WS_HSCROLL + $ES_READONLY) GUISetOnEvent($GUI_EVENT_CLOSE, "_Die") GUISetState(@SW_SHOW) _Ping("10.120.9.79") While True Sleep(1000) WEnd Func _Ping($Target) Local $hWndCmd = Run(@ComSpec & " /c ping " & $Target, @SW_HIDE, $STDIN_CHILD + $STDERR_MERGED) Local $sCmdOutput While True $sCmdOutput &= StdoutRead($hWndCmd) If @error Then ExitLoop GUICtrlSet($hEdit,$sCmdOutput,1) WEnd MsgBox(0,Default,$sCmdOutput) EndFunc Func _Die() GUIDelete($hWin) Exit EndFunc I want to use this functionality elsewhere, but for now I'm testing with PING. Why won't this work? I just want to run a CLI command and display the output in an edit control. Thoughts?
-
Context menu on Pic element?
lavascript replied to lavascript's topic in AutoIt GUI Help and Support
I'm sorry, I was asking the wrong question. Funkey, while your example works, it didn't really help with the issue I was having. (And a bit complex for a simple menu, eh?) I hadn't tried it, but Context menus were working fine if I attached them to my main background image ($hImgMain). After a little further reading in the help file, I realized that a background image needs to be disabled, so I just needed to add GUICtrlSetState($hImgMain,$GUI_DISABLE) Thanks!- 2 replies
-
- pic
- context menu
-
(and 2 more)
Tagged with:
-
Screenshot attached! I have a background image where all the buildings are black. When the distribution switches in the buildings respond to a ping, the buildings turn green. Dim $hImgMain = GUICtrlCreatePic("img\fullmap-nologo.gif",0,0,768,635) Dim $hImgAud = GUICtrlCreatePic("",263,287,36,27) Dim $hImgBus = GUICtrlCreatePic("",181,321,97,28) Dim $hImgCtr = GUICtrlCreatePic("",181,239,97,82) ... If ping($sIpAud) Then GUICtrlSetImage($hImgAud,"img\Green-Aud.gif") I'd like each building to have a context menu: $hMenuAud = GUICtrlCreateContextMenu($hImgAud) $hMenuAud1 = GUICtrlCreateMenu("Switch1",$hMenuAud) $hMenuAud1Tel = GUICtrlCreateMenuItem("Telnet",$hMenuAud1) $hMenuAud1Web = GUICtrlCreateMenuItem("Web",$hMenuAud1) $hMenuAud2 = GUICtrlCreateMenu("Switch2",$hMenuAud) $hMenuAud2Tel = GUICtrlCreateMenuItem("Telnet",$hMenuAud2) $hMenuAud2Web = GUICtrlCreateMenuItem("Web",$hMenuAud2) but the menus don't show up. Neither do tooltips. I'm sure this is something simple, but I've never really done anything like this before. Thanks!
- 2 replies
-
- pic
- context menu
-
(and 2 more)
Tagged with:
-
Export data as .xls or .xlsx
lavascript replied to lavascript's topic in AutoIt General Help and Support
That's great! Thanks! -
Export data as .xls or .xlsx
lavascript replied to lavascript's topic in AutoIt General Help and Support
Well, obviously I looked into the Excel UDF, but I didn't want to actually open Excel in order to generate the file. But the more I think about it, it's really not a bad solution. Thanks. -
I have a script that grabs data, processes it, and exports the results as a CSV. Cuz CSV is EASY. But it's only a 4-column CSV, and by default, Excel displays really narrow columns that need to be resized to see all the data. Bottom line, I'd really prefer to export this data as something more robust than CSV. Now, as far as I'm aware, there's no spreadsheet equivalent to RTF, is there? How feasible would it be to actually get this data into a formatted Excel file? I'm aware that .xlsx is basically a bunch of zipped XML files, so I'm currently trying some reverse engineering there, I just didn't know if I might just be spinning my wheels. Thanks.
-
Correct way to populate this 2-dimensional array?
lavascript replied to lavascript's topic in AutoIt General Help and Support
Thanks! I knew I could do it with nested For loops, that just didn't seem like the "right" way. -
So... this doesn't work. #include <Array.au3> Local $aTest1[3] = ["Thing1 Thing2 Thing3","Thing4 Thing5 Thing6","Thing7 Thing8 Thing9"] Local $aTest2[3][3] For $i = 0 to UBound($aTest1) $aTest2[$i] = StringSplit($aTest1[$i]," ") Next _ArrayDisplay($aTest2) It seems that a 2-dimensional array is completely different from an array in which every element is an array. The result I'm hoping for is: $aTest2[0][0] = "Thing1" $aTest2[0][1] = "Thing2" $aTest2[0][2] = "Thing3" $aTest2[1][0] = "Thing4" $aTest2[1][1] = "Thing5" $aTest2[1][2] = "Thing6" $aTest2[2][0] = "Thing7" $aTest2[2][1] = "Thing8" $aTest2[2][2] = "Thing9"
-
Parsing strings: spaces/quotes
lavascript replied to lavascript's topic in AutoIt General Help and Support
Sure enough! Man, my foot's just gonna stay in my mouth all day. -
Parsing strings: spaces/quotes
lavascript replied to lavascript's topic in AutoIt General Help and Support
Guinness, you seem offended... I'm sorry. But Wayfarer had already provided a solution by the time I saw your clarification request. For what it's worth, all the strings are similarly-formatted. -
Parsing strings: spaces/quotes
lavascript replied to lavascript's topic in AutoIt General Help and Support
That does the trick, my good man! Thank you! -
Parsing strings: spaces/quotes
lavascript replied to lavascript's topic in AutoIt General Help and Support
I'm sorry! Based on the example string: Dhcp Server servername Scope 10.0.0.0 Add reservedip 10.0.0.93 00deadbeef00 "HOSTNAME.local" "This is a comment" "BOTH" I would like an array as follows: 0: Dhcp 1: Server 2: servername 3: Scope 4: 10.0.0.0 5: Add 6: reservedip 7: 10.0.0.93 8: 00deadbeef00 9: "HOSTNAME.local" 10: "This is a comment" 11: "BOTH" Although if the quotes were stripped, that'd be fine. -
Parsing strings: spaces/quotes
lavascript replied to lavascript's topic in AutoIt General Help and Support
Well, shoot. I'm screwing things up by not providing true data. Some of my elements are IPs, hence dots. Hence w doesn't count them. I tried changing w to H, but that started counting my quotes again. Here's a "real" string (output from netsh dhcp server dump): Dhcp Server servername Scope 10.0.0.0 Add reservedip 10.0.0.93 00deadbeef00 "HOSTNAME.local" "This is a comment" "BOTH" Thanks! -
Parsing strings: spaces/quotes
lavascript replied to lavascript's topic in AutoIt General Help and Support
Thanks! I was hoping for some RegEx suggestions.I really need to hunker down and learn RegEx. I had a feeling that was where I'd find my answer, I just couldn't pinpoint it. -
Parsing strings: spaces/quotes
lavascript replied to lavascript's topic in AutoIt General Help and Support
Ok... perhaps I should have mentioned that I have a list of strings, and they have varying numbers of words between the quotes. -
Split text and put every line in array
lavascript replied to EmptySpace's topic in AutoIt General Help and Support
Sorry... I was just copying from the Help file, I've never actually used ByRef. But thanks! Now I see what it's for! -
Say I have the following string: $string = 'ABC DEF "And some text"' I'd like to parse it into a 3-element array, with "And some text" being the third element. My mind wants to do StringSplit($string," "), but that's obviously not going to work. So how do I go about it?
-
Split text and put every line in array
lavascript replied to EmptySpace's topic in AutoIt General Help and Support
I'm not fully understanding what you're trying to do, but if you need to read a file and have each line from the file as an array element, try: #include <File.au3> _FileReadToArray("location", ByRef $hash) -
OutlookEX UDF - Help & Support (II)
lavascript replied to water's topic in AutoIt General Help and Support
Well... that didn't work actually. But I did get it working! Here's what I did for anyone searching. To open a new, BLANK HTML message in Outlook with one attachment: #include <OutlookEX.au3> Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook.") Local $aFolder = _OL_FolderAccess($oOutlook, "", $olFolderOutbox) Local $oItem = _OL_ItemCreate($oOutlook, $olMailItem, $aFolder[1], "", "BodyFormat=" & $olFormatHTML) _OL_ItemAttachmentAdd($oOutlook, $oItem, Default, "C:\FullPath\To\Attachment.zip") _OL_ItemDisplay($oOutlook, $oItem) _OL_Close($oOutlook) -
OutlookEX UDF - Help & Support (II)
lavascript replied to water's topic in AutoIt General Help and Support
Thanks! -
OutlookEX UDF - Help & Support (II)
lavascript replied to water's topic in AutoIt General Help and Support
That works, but I'd really prefer if it could simply display a message instead of actually sending it. What I really want is to replicate the functionality of choosing Send To > Mail Recipient from the Explorer context menu, but I haven't figured out a way to do that.