Patrick Winkler Posted June 30, 2017 Share Posted June 30, 2017 Hello, I could not find a way to get the handle of a workssheet cell. Maybe you have an idea. regards Quote Link to comment
Marionette Maven Marissa Farrell Posted June 30, 2017 Marionette Maven Share Posted June 30, 2017 Hi Patrick, It looks like you're trying to select a database row, I would suggest looking at functions that start with GetWSSubrowCell. Let me know if that's not the direction you're going in and I'll take another look. Quote Link to comment
Patrick Winkler Posted June 30, 2017 Author Share Posted June 30, 2017 Hi Marissa, sorry I could have mentioned that I tried reading the yellow marked cell with GetWSSubrowCell but it returns me nothing. My goal is to get the handle to the door-row from the worksheet so that I can read data from the ws in write it in a record of the door. regards Quote Link to comment
Pat Stanford Posted July 3, 2017 Share Posted July 3, 2017 You could possibly use a =RunScript function with a short Vectorscript or Python Script. You can use the WSScript_GetObject command to get the handle to the object that the subrow is referencing. I don't think you can get an image out of a cell. The subrow functions only appear to allow you to GET stings or values. The function that I am wishing for is a way to get the cell a RunScript function is in when the script is activated so I can do relative cell references. Let us know if you need more help. 1 Quote Link to comment
Patrick Winkler Posted July 7, 2017 Author Share Posted July 7, 2017 Thanks pat. I needed some attempts to get back from the str to the vs.Handle. The cells get filled with this code: h = vs.WSScript_GetObject() h_str = str(h) vs.WSScript_SetResStr(h_str) Then another script iterates trough all objects and compares the handle strings: def get_handle_from_str (h_str): h_dict = {} # key: handle_str val: handle def collect_handles(h): nonlocal h_dict h_dict[str(h)] = h vs.ForEachObject (collect_handles, 'All') try: h = h_dict [h_str] except KeyError: print ('Handle could not be found.') h = None print (h_dict) return h # EXAMPLE h = get_handle_from_str ('AEC62080') vs.SetSelect (h) It's kind of unpracticle and carries the risk if inconsistency but it works. ws_test.vwx.zip Quote Link to comment
Pat Stanford Posted July 7, 2017 Share Posted July 7, 2017 Patrick, I would be careful with what you are doing. It looks dangerous to me. Also, I think the string you are returning is not the full handle. When I use VectorScript to get the handle as string, I get a different value even after accounting for Python returning the value in Hex and VS in decimal. It appears that Python is leaving off the top 4 hex digits. But let's step back from there. What data do you have in the database row that needs to be written to a record? Since all the data is coming from records already, why do you want to put a copy (with potentially obsolete values) into a record? There is probably a reason, but if you tell us what you are really trying to do and why you think you need to do it we might have a better solution. Quote Link to comment
markiflamer Posted January 25, 2021 Share Posted January 25, 2021 @Pat Stanford Did you ever find a way to do this? "The function that I am wishing for is a way to get the cell a RunScript function is in when the script is activated so I can do relative cell references." Thanks. Quote Link to comment
Pat Stanford Posted January 25, 2021 Share Posted January 25, 2021 @markiflamer Nope, as far as I know, there is still no way to do relative references in a Worksheet Script. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.