My example is this:
Sub A01set() ' 060618 - Set Level 1 with all selections 1, Testing' Send a keyin that can be a command string ' CHANGE BELOW STATMENT TO COMMENT, was opening the key-in command ' CadInputQueue.SendKeyin "DIALOG CMDBROWSE"
CadInputQueue.SendKeyin "lv=1" CadInputQueue.SendKeyin "co=1" CadInputQueue.SendKeyin "lc=0" CadInputQueue.SendKeyin "wt=1"
CadInputQueue.SendKeyin "m,ms 060618"
The above works fine, but hard to change on the fly. Meaning if a drawing comes in and Level 1 is color 3 I have scripts that contain current file settings and I touch a button and the key-in command runs the script. I have had times the script files are not working ?? but if I go to manual key-in commands
Example: lv=1;co=3;lc=0;wt=1 it will work when the same script file failed
Active Level Level 1lc=0wt=1' active symbology bylevelco=bylevel
So I was wondering if I used VBA to read the script and send the commands it would clearup the occasional failure ?
you can see the number keys, they set the level and the other attributes the lower row key is a pulldown of the script files and gives me direct access to the files and once per .dgn I may have to change color, or linestyle or weight . so I speed up the process by matching the script files to each .dgn not often changes but a time saver an only 1 change per drawing. I wondered if I used the VBA reading my scripts if it would avoid the few times the key-in seems to fail? I create on my time to improve my productivity or preformance.
I am not a programmer, I have tried the record but it will not seem to record some things. Jon I read some of your comments and if this has been discussed, please point me in the right direction.
I am not sure whether I understand what do you want to achieve. Maybe a simple description "I want a buttton. When I press the button, this and that will happen...". To mix script, key-ins, picture and VBA in a discussion including "occasional failure" is a bit confusing.
In my opinion to set MicroStation active paramaters (attributes like level, color... or settings specific to a particular element type like text style or hatching angle) Element Templates should be used as much as possible. They are standard tool, well supported and can be integrate with other customization tools or activated using key-ins.
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Thank you Sir, sorry for the confusion
Version: MicroStation V8i SS 10
RJB Phillips III (Richard) Praise the Lord for His Mercy and grace in Christ Jesus
Jon, is is possible to use an existing Script File and run it via VBA ? There is a reason for the question
I have the button. I have the Script. I can duplicate the script via VBA with different commands
but would like to have been able to read the Scripts I already made and run them.
Hope this is a little less confusing
Richard Phillips said: if I used VBA to read the script
Your VBA macro is doing nothing more than to send key-in commands to MicroStation. You could just as well write an @script with those same key-ins. In other words, VBA is providing no benefit.
Regards, Jon Summers LA Solutions
Thank you, hard to believe but sometimes the scripts fail from the script files, work when direct key-in or have found if I do the VBA the same commands work when they failed from script file and worked direct. perhaps the next time a script file fails will just reload Micro-station and see if that works also. Never have been able to figure out why the scripts fail at times. Appreciate your taking time to answer. I even moved my Scripts to C:\Scripts thinking the longer paths were messing me up at times. World of computers and strange things at times.
Richard Phillips said:Never have been able to figure out why the scripts fail at times
Next time, rather than get tangled up with VBA, post your @script with a related question to the MicroStation Forum.
Richard Phillips said:I even moved my Scripts to C:\Scripts thinking the longer paths were messing me up
Don't the @scripts work if you put them in the same folder as MicroStation? Then you don't have to provide the full path — just the file name.
I should know, but could you be more explicit on the same folder as Micro station
seems to me there are a number of folders tied to Micro Station ? I know my questions are Ned in the first grade, sorry for ignorance. I am all for making things easier, faster or similar ..... Thanks Jon for even taking time to respond
Thank God for His Mercy and Grace in Christ Jesus. Your help on VBA and other things has been so valuable.
Richard Phillips said:could you be more explicit on the same folder as Micro station
Sorry, I should have written 'in the same folder as your MicroStation DGN files'. That's where I think that MicroStation looks for @scripts.
Again, that's a MicroStation question rather than a programming question, and a better place for it is the MicroStation Forum.
Ok, sorry I was in the wrong place. I am going to try one before I move all my scripts. I was using @the whole long path to the folder (c;