Jump to content

Lipko

Members
  • Content Count

    11
  • Joined

  • Last visited

Community Reputation

0

About Lipko

  • Rank
    Active
  • Birthday 06/13/1985

Profile Information

  • Gender
    Male
  • Location
    Hungary

LabVIEW Information

  • Version
    LabVIEW 2015
  • Since
    2014
  1. It can be solved with a fairly simple macro. Sub ReplaceTextWithImage(findText as string, imagePath As String) If Selection.Find.Execute(FindText:=findText, MatchWholeWord:=True, Forward:=True, Wrap:=wdFindContinue) = True Then Selection.InlineShapes.AddPicture FileName:=imagePath, LinkToFile:=False, SaveWithDocument:=True End If End Sub EDIT: added checking if text found and MatchWholeWord and continue search if out of selection range. Other checks should be added to the labview code (image file exists and findText not empty). Note, that the Selection.Find.Execute will ignore MatchWholeWord if there are special characters in the findText for some reason. I haven't found a reference to what charaters are "special". Special characters I tried and found: &, #, _ So I gueass pretty much every non alphabetical....
  2. Hi all! How do you implement mouse capture for controls? This is more of a philosophical question about your solutions, you did you learn to live without it etc. By mouse capture I mean mouse capture: A control receives mouse events even if the pointer is not above the control. It's useful for dragging among controls, or for a graphical user interface (mousedown>mousemove>mouseup event chain). Without mouse capture if the user accidentally leaves the drawing area during a drag-like operation and mouseup occurs outside, the drawing area gets stuck in dragging mode (mostly). This is a very annoying phenomenon. However, this is usually only needed in 1-2 controls (or 0 in most cases), so obviously not for everything you have on the front panel. Mousecapture in win32 programming is very easy. You call Setcapture(control_handle) on mousedown, and call releasecapture() on mouseup. It does have problems (system releases capture because another window gets on top for whatever reason), but these can be handled. And usually the problems are not that severe, or at least doesn't happen whenever the user moves the mouse too fast… So how to deal with it in Labview? No, calling the winapi with setCapture won't work as it works with windows (win32 treats controls as windows) but in Labview by default there is only one window: the front panel. Somehow replacing drag+drop functions all controls have some sort of? Creating user events for mouse handling and all controls have to handle mouse events and propagate them to the user event? Somehow make the control you want to mousecapture a separate window but mimic it's not? +winapi Some mouseleave/mouseenter hack and checking button states (but how? you shouldn't mix events with polling)? Ditch event structure and go for polling? Or even worse: polling only the mouse in a separate loop and generate user events? Some special control (ActiceX?) that has mousecapture using function that's easy to replace and place it invisibly on to of your control? Confine the cursor to the control (that's the worst one yet…) other... Thanks for any hints and ideas or stories on the topic and sorry for the inaccuracies in technological terms, it was very long ago when I did win32 programming.
  3. Hi all, I'm trying to insert images at specific texts in a Word document with the Report Generation Toolkit. Kind of like search and replace, but with an image as replacement. All I found that inserting a picture can be either done at bookmarks or into table cells. I want to avoid Bookmarks because it's easier to add some hashtags than editing bookmarks if there are dozens of images to be inserted. I didn't find any way to either set the cursor or add bookmarks programmatically. Actually, I don't find any usage of the cursor in the built-in RGT functions… I thought it's a basic thing I want to solve but didn't find appropriate answers. Thanks for any hints in advance!
  4. Hi again! I'm having a hard time to get the position of a found text in a Word file. I'm able to use the Report Generation toolkit to search+replace text, but I want to highlight the replaced text one way or another. Using the "track changes" option of MS Word would be the best, but changing the font of the replacement and leaving the original text too would also suffice. The reason I'm struggling with it is that there are several text to search for and replace and the texts are sometimes contain other search text (so for example I want to replace X01 with Y but X01.01 with Z). This can be solved by sorting the search texts reversed alphabetically. Since I can only search and replace, I have to turn off Track Changes (because the original text will be found again), and replace the found text with a trackable unique dummy text first, than I have to search and replace those with the original+final texts. This means Track Changes will not be effective (or the user would see the horrid dummy texts too). So I would at least apply a different font to the replacements, but I don't know how to set the "Format" parameter of the Document>Range>Find>Execute method. A preferred method would be to get found ranges first, exclude found ranges from the next searches, then delete the ranges+insert the search string in place of them. This way the changes of the document would have a very nice highlight. Thanks for any hints or better approaches in advance!
  5. Thank you, I will look into it.
  6. Hi again! This time I have the following problem: I want to do simple queries on a small .accdb as a part of a simple tool application. Labview's connectivity toolkit method works fine as far as every user is on the same Office bitness (32 vs 64 bit). But in our case, some machines have 64 bit Office and some 32 bit. This results in driver compatibility issues and our IT policies are so strict that in the near future our local admin rights might vanish too, making driver install requests for a simple tool is too tedious. This 32-64 bit transitional state can last for several months and I would prefer to have a general solution than to make 32bit and 64bit builds (as far as I know this would also solve the issue, but I'm on 32 LV at the moment). Since loading the whole database is an option (the whole file is just 2 MB at the moment and it won't grow in the near future when hopefully all collagaues will be on the ame ground), I'm hoping there's a more "platform independent" (office and Windows 7/10 are given) solution to read the contents of .accdb files. My googling yielded solutions for SQL database access. Thank you for any hints in advance!
  7. Thanks for the replies! As usual, I did things wrong. This time it was with the testing. When I started I tried with the actual property names with the illegal characters. But the tested files (which were chosen randomly) were probably all files that was once re-saved with Diadem. Then I tried with the underscores, this time probably on totally different files which were never re-saved in DiAdem. Funny thing is that I tested multiple times with the underscore, seeminly always on non re-saved files... Anyways, Now I look for both the original property and the fixed property. Thanks Antoine for the illegal characters' list. I used it as the search+replace regex search string.
  8. Yes, I meant get properties, and it didn't return those properties. I tried TDMS viewer, some 3rd party labview viewer and those didn't find my properties either Okay, I will try a few things next week (testing with proper property names). If it's successful, I'll rewrite my set properties code. I'll make two versions of the getter to deal with the old files with the illegal property names. Or something...
  9. I did realize earlier that I used "illegal" space character in the property name and I'm aware illegal characters are replaced with underscores in DiAdem. I think I have a theory which I can only try on Monday: set properties does accept the illegal characters "silently" without fixing but read property doesn't find properties with illegal characters (because my first read property try was with spaces and it was not successful. At set properties I don't get errors). I was deceived that set properties was okay because DiAdem and Excel importer do accept spaces but replaces them with underscore. Later I also tried read property with underscore without success. This implies that the illegal character fixing happens in DiAdem and not by set properties as I took it as given. So the question is: is it possible to read property names with illegal characters somehow (so that I can read old files too) in Labview, if it is possible in Diadem? Of course my first try will be to read with spaces, but only on Monday. I was too excited to wait with my posts...
  10. Channel for both. And I checked the written files in diAdem, the property is porperly on the channel level. Also I managed to read "standard" properties from the channel in Labview which are only valid at channel level (displaytype for example) and it works, so there shoudln't be a mistake.
  11. Hi all! I'm new to the forum and I have a strange issue with reading TDMS custom properties with Labview. Creating user properties is working fine using TDMS Set Properties.vi, but I can't read them with TDMS Get Properties.vi. I can read the "standard" properties, and also I do see the properties in DiAdem (dataportal and using script) and also in Excel when I use TDM(s) importer. The property names are not listed when calling TDMS Set Properties.vi without the property name and data type terminals connected. There is no simultaneous file reading or writing. I solved the problem with loading DiAdem and running a script, but that's very slow and also not all target machines have DiAdem installed (and no licence either, obviously). I also tried with property names such as User Properties\Device_ID, User_Properties/Device_ID in whatever combinations (I look for the property "Device_ID") without success. Thank you for any hints in advance!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.