Jump to content

Strydr

Active Members
  • Posts

    37
  • Joined

  • Last visited

Recent Profile Visitors

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

Strydr's Achievements

Seeker

Seeker (1/7)

2

Reputation

  1. In coding, the "right way" vs the "wrong way" is often a matter of opinion and is frequently a matter of intense "debate". I'm calling this the "correct way" for two reasons. One, if you go to the "Hlep Libraries" and look up "GUICtrlCreateListView", it will tell you: "To add items to a ListView control use GUICtrlCreateListViewItem()", it does NOT say to use "_GUICtrlListView_AddSubItem", which seems to be the "common way". Second, a forum member did some testing, and determined that the "native way" (what I'm calling the "correct way"), is substantially faster than the "common way": https://www.autoitscript.com/forum/topic/67829-_guictrllistview_additem-much-slower-than-guictrlcreatelistviewitem/ The issue: I've built and populated my Listviews in the same ways used in all of the examples that I've found. And, for most things, it works great! But when I begin to explore some of the finer points of ListView manipulation, like color, things don't work quite the way that it seems they should. I've been pulling my hair out trying to figure out why not. This is what I have pieced together... Background: I use multi column Listviews with a small icon for each entry at the left. I'm populating my lists from files. In general, the sequence goes like this: 1) Create the listview. This is where the problems start. Most working examples, with icons, will have you create the Listview like this: However, the "correct" way to do this is like this: Notice the extra spaces in Column2 and notice the SetColumnWidth command: use whitespaces in the creation if you can, but I have one field that is much longer than the rest so I set that width separately. 2) Initialize an imagelist: $hImage_Temp = _GUIImageList_Create(32, 32) 3) Populate your variables. I scan for data for each row, so this will be looped. Define your image for the row: $ImageList_Icon = $Dir\image1.bmp Read data: $Column1 = IniRead($File, "Section", "key", "") $Column2... etc 4) Populate your Listview. And here is the rest of the confusion. All of the examples that I have come across have you populating your list like this: The "correct" way to do this, is as follows: 5) Loop 6) Connect your imagelist file to your Listview: _GUICtrlListView_SetImageList($ListView, $hImage_Temp, 1) 7) Set State: GUISetState() Done the original way, putting "GUICtrlSetColor(-1, $COLOR_RED)" in the loop will make the entire Listview the same color, no matter what. Done the "correct way", I can put in a conditional and, using the same command, choose WHICH line gets which color. In other words, I now seem to have "complete" control over my Listview. I hope that this helps someone, lord knows I could have used this information a long time ago! It'll be interesting to see what else works now! Note that the Styles chosen can have a rather dramatic affect on your listviews, so make sure that you play with them to see what they do...
  2. Wow! Ok, I'm just a lazy asshole. Thank you for your help. I was hoping to find someone who knows enough about using listviews to be able to tell me the practical difference in the two commands. There's obviously a difference in how and when each command should be used but I can't find any documentation that discusses the differences. Has anyone mentioned that a lot of the people on this forum are just mean? I'm obviously asking for help in the wrong place, thank you anyways.
  3. I've got a project that I've been working on for a while and I've been creating Listviews and imagelists just fine. Now I'm attempting to "update" my code and things aren't working as I'd expect. I've been creating the Listview with GUICtrlCreateListView and then populating it using _GUICtrlListView_AddSubItem. Now I'm attempting to use GUICtrlCreateListViewItem to populate it and while the commands work, my icons no longer show up and I can't figure out why. Any ideas? The program is way too long to post, but I'll list what I'm using that works and what I'm attempting to use that doesn't. And I'll probably forget to add the info needed to help me. I'm good at that... The spacing seems the same, including the first field, but the icons simply no longer show up! Hep? Thanks!
  4. Working with that now. Atm, I'm having an issue with the fact that it uses variable width formatting. In other words, different letters take up different amounts of space. So if you have 2 different sentences with the same number of characters, they will actually be different lengths. Makes formatting anything afterwords... challenging. I'm open for ideas if anyone has one. In particular, I'd love to be able to turn that off so that each character takes the same amount of space. Any thoughts? Thank you! Edit: well, one way to fix it is to change the font to 'Fixedsys'. Edit2: but that won't print properly. Interesting.
  5. Crepes! Thank you! That really needs to be commented into the udf or posted somewhere! I never came across anything stating that! -I came across the idea that it would work without having Word installed by searching for "autoit format documents". The only references I'm coming across for formatting documents all end at the Word udf. I can't find any formatting info that doesn't involve it. And NONE of the references mention the need to actually have Word installed. Edit: I came across a reference to using Excel for this but I knew that the user would need to buy and install it, but it never occurred to me that the same thing might be the case for Word. Doh! This is driving me nuts! I just want to add basic formatting to a document: the type of document isn't even important, it can be anything that will take formatting! And print from there of course. But the assumption has to be that the user just has Windows, no extra programs. O well, back to the drawing board. At least I can stop chasing this particular tail!
  6. I'm trying to figure out how to work with the word.au3 udf but it's not working. Every example I attempt to run errors out with "Error creating a new Word application object. @error = 1, @extended=-2147221005" Running Windows10 and the latest version of Autoit. I had the impression that this would work on Windows with Wordpad documents, and that MS Word does not need to be installed. Do I actually need to buy and install MS Word? A LOT of people don't buy MS Office or MS Word, so I'm hoping that this is not the case. Thanks!
  7. The image would be different (same location, tho) each loop, with the possibility of different sizes. Interesting! Sounds as if it would be safer to clean up. Any idea if there are there any appreciable performance hits or other issues by cleaning up after each loop? (I would imagine that this is a stupid question, but I have to ask)
  8. I would assume that the screen capture would not catch the contents of the Listview that weren't shown? -as in the list is longer than the window. Interesting command, thanks!
  9. Where I'm trying to get to is that I'm trying to print out the contents of a Listview including the icon used at the front of each row. Another approach that could give me similar results would be to be to print a html page, as these pages have already been created with the data, but I can't get printhtml.exe to work. So, my approach is to take the data, create a temporary file from it and print it. I've been playing around with this for a little bit now and, at this point, I'm not sure which direction I should be chasing: any suggestions? The format of the temporary file is only relevant to me in that it should be simple to print something useful from it and it needs to be "behind the scenes". Although having the standard print dialog window pop up could work, too. -I need to start by saying that I'm having trouble getting the word udf to work properly. When I attempt to add an image, I ALWAYS get the error that $oDoc is not an object. At least that's how I'm interpreting the error: the error message from the example provided for _Word_DocPictureAdd = 1 with the extended error = -2147221005. I also didn't see a way to add a line of text at a time, although I'm sure that there is a way. I've played around with Filewriteline but as far as I can tell, that's to write text, not images. I've come across _GUICtrlRichEdit_Create, but that's for a GUI. Should I use this and just have it "hidden"? I haven't been able to get "printhtml.exe" working. This could be useful if I could: is it still valid? Doesn't seem to have been updated in years and is definitely pre-Windows10. Should I be asking questions on what my problem with it is? I came across this, should I go this route: FileWrite() & _GUICtrlListView_GetItemText() in a Loop, you can find the number of rows by using _GUICtrlListView_GetItemCount() (thankyou guinness) Would this write the icons, too? (even tho there doesn't seem to be a FileWriteImage command?) I've come up with using shellexecute with notepad for printing, we'll see if that will work. I believe that the temporary file format will dictate which program I use for printing it. One issue is that I don't expect the user to have excel, so that eliminates another solution that I found. A lot of what I'm coming across has been superceded but the stuff that has superceded it doesn't seem to work and it's old as well, so I'm not sure where I should be poking my nose, at this point. Help? I'm not looking for the actual code: that's half the fun! But I feel like I'm chasing my tail here, and I don't know which way to run. What am I missing? Thanks! ps: what did I forget to include this time?
  10. I would like to make sure that I'm understanding some basic usage and not creating memory problems (or any other type of problems) Usage scenario would be to do a quick gdi+ operation and then loop again. The specific operation shouldn't be important for this, as far as I know. So, as I understand things, the usage would go somewhat like this: Startup gdi+ go into loop perform operations return once loop is completed, dispose/delete temp images used. shutdown gdi+ The 2 specific things that I'd like to confirm are: 1)start gdi+ before loop and close it after loop, as opposed to starting and stopping it in each loop session. 2)delete and dispose of temp images used in operations AFTER loop is exited. The theory being that the memory used is overwritten each loop, as opposed to written sequentially, which could eat a lot of memory. Thank you for your help! ps: I'm really good at NOT including the basics that you need to answer my questions: sorry if I missed something again.
  11. OMG! That one keeps tripping me up!!! Thank you!!!!!
  12. I thought I understood this but a simple script isn't working. What am I missing? Yes, I'm expecting to feel very stupid, but thanks for the help! I was working on learning arrays and all of a sudden realized that I seem to have forgotten some basics! What am I missing? Why won't the button activate the function "_TestFunc" "OnEvent"? Thank you!
  13. !! I didn't know that I could do that! I will test and edit my post accordingly, thank you!!! Sounds as if anybody attempting to use it just needs to know how to use the 'set user agent' properly. Do you have any idea which method is fastest? My ignorant guess would be that the InetRead command would be fastest because I'm not taking the extra step to make an object? Thank you, again, for your help!!! -I'm already getting old, I'm gonna be a freakin' fossil by the time I have any idea wth I'm doing! So much to learn, so little time...
  14. @Melba23 This is generally my policy as well. It doesn't do me any good to copy someone's script if I don't understand it. However, I believe that there is a need in the VR community and I thought that someone might feel helpful in general. As I mentioned, my thought was to fulfill the needs of others, not myself. As I also mentioned, making this as a software product for general consumption is beyond my current skill levels. @FrancescoDiMuro "copy any highlighted text" is where I expect the rub to be. And, no, I do not know that this is not a valid question. Your comment does give me a hint on how to proceed but it also hints that what I optimally want may not be possible. There are some scary serious programmers in the VR community: if it was easy, I'd expect someone to have done it already. Thank you, anyway. I do appreciate the fact that I can bring my "examples" to you guys for help!!! This was just a shower thought. If anyone wants to help the VR community tackle this, I do NOT need to be involved: just post where the exe's can be found on the VR Reddits. Heck, you can even market it on Steam, there's that much of a need! Out of curiosity, is anyone in this community involved in VR, yet? Edit: the real need is to be able to copy and paste in the Overlay!
  15. Ok, this is what I've come up with. First, try not to use any INet commands in general. (Edit: as Trancexx points out, you can use the HttpSetUserAgent to set Autoit to NOT use IE. Tested just fine in my program! Thank you, Trancexx!) Apparently, what's happening is that INet commands use IE explorer security settings . It seems that your OS will arbitrarily decide that the security certificate for that site is invalid. So, in effect, what will happen, is that any program that you have that uses it, will randomly stop working on that page. No scraping, no copying, no working with that page at all. Once it stops, it won't restart, your program is done without compromising the IE security settings of the user's computer. So a program that works, may stop working. A program that works on one computer may not work on another. Not a very comforting situation, hence my recommendation against using INet commands in general. Instead, make an object out of the site (example scripts to follow) and add a heading that tells Autoit NOT to use IE, but to emulate Mozilla. Another way is to use the http protocols included with the <WinHttp.au3> but I suspect that this actually takes longer due to opening and closing winsocks(?). This example is courtesy of Danp2: This also works, but you need to go to the Github page to download and install the latest WinHttp.au3 file, it does NOT come with Autoit. All three of these methods work. My guessing says that the fastest would be the Inet command, then the object creation method, and the slowest would be the http method, but I wouldn't put money on it. When I'm a little further in my project, I will test as I've got enough entries in my main program that any speed differences should show up. Hope this helps someone!
×
×
  • Create New...