What's new

AutoHotKey Scripts

WoodWorks

Alibre Super User
Part File Batch EXPORT (STEP...) Script

This is a script that I wrote in AutoHotKey that will prompt the user with a file selection dialog for single or multiple Part files for Export, and will process those file(s).

This script is from JordanCClark's request for a rapid way to output a large number of Alibre Part file to STEP. The nice part is that this script works for any export format. Just manually export a single part file in the desired format, to the desired location, and all subsequent files processed by this script will follow suit with the same format and location.

I have include the AutoHotKey original script (in case users need to change timing to suit their system performance), and a compiled exe version for those that do not want to install the AutoHotKey software on their system.

AutoHotKey is FREE, and very powerful. While I have been (and still am) an advocate for Macro Express, it lacks any sophisticated scripting dialog boxes. AutoHotKey has excellent dialog box capabilities and a SmartGUI creation module, as well as the ability to capture scripts based on user keyboard and mouse actions. You can start a script by capturing a "walkthrough" session, and then using the excellent help file, modify the capture to provide additional capabilities. While similar to VBScript and uses a Visual Basic style of command structure, it is a lot easier to use and very powerful. AutoHotKey and Macro Express are an excellent combination to develop easy to use and power command automation in Alibre.

The key to keystroke programming, is to use the ALT key and the Alibre menu line drop down selections, as well as the TAB, ENTER and ARROW keys to accomplish task automation. Once you get started, you will find more and more tasks that can be done more efficiently with keystroke macros/scripts (Color Properties being my most used macro).
 

Attachments

  • Alibre Part Export.zip
    206.6 KB · Views: 461

WoodWorks

Alibre Super User


A few more AutoHotKey scripts under my belt, and I am back with version 1.1 of Alibre Part Export.

This version allows the user to set the location and export type when processing the first file. The macro pauses at the Export Save dialog for the user to set the save location and export type, and will resume when that dialog box is closed (with the pressing of the Save button).

Subsequent exports will automatically save to the same location and use the same export type. There is also a short pause during subsequent saves, just long enough to verify that the files are going to the same location and type (well almost long enough if you look fast).

Script is commented to make it easier for everyone to follow my logic. As with scripts captured from actual use, they may not be as efficient as possible. For those that do not want to install AutoHotKey, I have included the compiled .exe version.

If you install AutoHotKey, the .ahk scripts will run just as with any executable file, by just double clicking on them (just like VBScript). You can include the AutoHotKey.ahk master file in your startup folder, and create shortcut keys to activate this or any other script, as well as programs or keystroke sequences. When you modify the running AutoHotKey.ahk script via the taskbar icon, remember to also select the "Reload this Script" option for your changes to take effect. I have installed my scripts in C:\\Scripts.
 

Attachments

  • AlibrePartExport 1.1.zip
    206.9 KB · Views: 383

WoodWorks

Alibre Super User
AutoHotKey Scripts

Rather than creating a new Topic for each new AutoHotKey script posted, I will be adding them to this thread. It will keep them together, not clutter the forum, and if enough interest is shown, will keep this topic visible.

I hope these scripts will help others improve their efficiency by automating boring and repetative tasks. I have tried to provide rudimentary documentation via comments at the beginning and throughout the scripts. Feel free to add your own scripts or improvements to mine.

Kirk Kelsey a.k.a. WoodWorks
 

Attachments

  • AlibrePartExport 1.1.zip
    206.9 KB · Views: 477
  • RepositoryFolderPurge 1.0.zip
    207 KB · Views: 523

WoodWorks

Alibre Super User


This is a script to process an Export or Parameter from the Equation Editor (to C:\\Scripts\\Data\\ParameterExport.csv), and extact just the Parameter Name and Equation for use in documentation. The script is written to include all the other fields as well and to be used as a basis for other scripts with a similar use. Output file is C:\\Scripts\\Data\\ParameterExport.txt, and can easily be changed in the script.
 

Attachments

  • ParameterExtract.zip
    206.7 KB · Views: 469

WoodWorks

Alibre Super User


Part ConfigurationLock is my most useful script when working with Configurations. You can (Un)LockALL for multiple configurations at a very rapid pace. There is often a need to lock or unlock configurations while doing advanced modeling using configurations.

Just select the first configuration in the Design Explorer that you would like to process, and then specify the number of configurations to process. By selecting the top most Configuration, and using the default number of configurations to lock (which is the total number of configurations), you can lock or unlock all configurations quite easily and rapidly. Give it a test on a sample file to see how it works.

You need to save the ConfigurationCount.exe program and associated Interop.AlibreX.dll to the C:\\Scripts folder in order for this script to work (included in zip file). This is a Visual Basic Alibre API program that provides the count of configurations in the part file (so you do not have to count them all manually). Thanks to Alex Franke for his consol template and sample code that allowed the creation of this VB application.

The Design Explorer and Edit Configurations window "Controls" were not accessible, and I was unable to select the Design Explorer pane or Edit Configurations buttons with normal "control" commands. I had to use a mouse click to focus on the Design Explorer and keystrokes to press the buttons in the Edit Configurations dialog. Just be aware of this kluge when testing and evaluating this script. It should not be noticable to the end user, but leaves this script as a poor example of coding. "Controls" are internal hooks to components of dialog windows and scripts can usually press buttons and specify panes using them. But, not all controls are accessible due to the way some applications are programmed. Let us hope that there is less of this in future versions of Alibre and consideration to such scripts becomes more important.

Please send me an email to the address in the top comments of the script file if you experience any problems. I have only tested the completed AutoHotKey version of this script for one day before posting.
 

Attachments

  • PartConfigurationLock 1.0.zip
    255.8 KB · Views: 491

WoodWorks

Alibre Super User


Updated PartConfigurationLock v1.1 Script with improved use of "Controls". It seems I was just missing a comma in my command to access the Lock/Unlock All controls in the Edit Configuration window, and Design Explorer. My appoligies to Alibre.

However, the script runs faster if I then send an Enter key, rather than using controls to activate the OK button in the Edit Configuration dialog box.

I have replaced the kluge mouse command to focus on the Design Explorer pane. For those trying their hands as writing scripts, the Window Spy will provide the control information. Just make sure to provide both the ClassNN name and Wintext, while allowing that extra comma between for the optional Window title (which will change with part file name and Alibre version).

I have added a Sleep 1000 (1 full second) at the end of the configuration processing loop for allow processing on slower machines. My Athlon XP 3200+ will run reliably with about 650 for this value, and my Athlon64 x2 dual core can use only Sleep 20 (20ms). I have found this version occasionally will skip a configuration in the lock or unlock, so be vigilent for missed configurations. I think more experience with this script will allow me to tweak it for more reliability. The Macro Express version of this script is more reliable, but runs quite a bit slower overall. Those that do not care about the internals of the script, may be just as happy with version 1.0.

I also added a quick check in the beginning to verify that the Design Explorer pane is indeed the focus at the start of the script. While I can not check that a configuration is indeed highlighted just prior to the script, I can check that focus is on the Design Explorer, which would be the case if a configuration is properly selected. Since it is easy to forget to highlight a configuration (which I will occasionally do), a quick check is a nice bit of error detection.
 

Attachments

  • PartConfigurationLock v1.1.zip
    256.2 KB · Views: 443

WoodWorks

Alibre Super User


Since those of us in the "States" still use inches and fractions for our woodworking, I have often found it necessary to change part files to the Fractional format. Even though common practice is to work to the nearest 32nd of an inch, and since Alibre does not have the specialized +/- format available, I do my design work to the nearest 64th.

This is just my quick script to convert those woodworking files I receive in decimal format.

I use CTRL+ALT as my prefix keys for my scripts, as they do not conflict with Alibre's Shortcut keys. I use CTRL+ALT+/ to activate my fraction conversion script.


SHORCUT KEYS and OTHER PROGRAMS:

CTRL+ALT+L for PartConfigurationLock
CTRL+ALT+P for the RepositoryFolderPurge (may conflict with printing shortcuts).
CTRL+ALT+C for my ColorProperties script (forthcoming script)

Macro Express has a feature to allow these key mappings to program specific, and be accepted for my Alibre scripts only when Alibre is actually running and the window of focus. That way, the same keyboard shortcuts can be used with other programs as well. I do see the possibility of creating a similar functionality in AutoHotKey, but have yet to determine how to best accomplish this. Maybe a master hot key script that starts with Alibre, or a modification of the default script. A simple check to see that an Alibre window is indeed the active window would probably be a good first step toward this functionality and to avoid runaway scripts if these scripts are accidentially run with another programs window active.
 

Attachments

  • Fraction64Format 1.0.zip
    206.4 KB · Views: 494

WoodWorks

Alibre Super User


TIMECLOCK v1.0

While not strictly and Alibre script, I developed this script for tracking my time while working with Alibre, and to assist in billing.

There are some excellent and affordable timesheet applications out there, but I was unable to find any that included start and stop times in the billing statements. I prefer to provide the customer with a detailed break down of time worked on a project, and I think the time clock history provides a better justification and support for time billing.

I mapped the TimeClock script to CTRL+ALT+T, and I only need to press this key combination as I start work, and again when I finish. Supported is Employee name, Customer, Project, and Description. There is a nice little clock that displays at the top of the screen along with the current project being worked. You do not need to fill update the information when starting the clock, as you will get a chance to update the information before it is written to the TimeClock log file. So, you can start the clock quickly if there is a phone call, and you can update the information when the call is complete.

After the TimeClock is stopped, you will need to press the hot key to start it again. I may deal with this later, but for now it is not too much trouble to start the clock again.

There are a few options to deal with circumstances where you press Start again when the clock is running, and some for pressing Stop when the clock is not started. Play with the TimeClock and get a feel for how it works. I am open to suggestions for enhancement, and feel free to enhance it yourself (but please post those enhancements).

The TimeClock data is stored in a .CSV file broken up automatically by week and the TimeSheet script will do a report with customer and project summaries, and independent customer timesheets (excluding OH=Overhead). I use 2 or 3 letters for customers, and the Customers.ini file stores a longer Customer name. The Projects.ini file stores the hourly rate, and you will be prompted to provide the rate when first using a new project. The other irritating thing about time clock programs I tested was that you had to stop and create a new project before being able to bill to it. This script does that on the fly.

*(Update 3/29/2007) The timeclock.ini file stores the start time, so that if the computer crashes or has to be restarted, the start time is not lost. You can keep tracking your time and pick up where you left off.*

You will need to manually edit the TimeClock.csv file to correct any entry errors or make changes to already entered start and stop times.

Just unzip this zip file to the C:\\Scripts folder, and the two scripts and two data folders will be restored. I created a TimeClock and TimeSheet folder to keep the input data separate from the Output data, as there may be cases where output is deleted while doing different reports (and wanted to prevent accidentally deleting the TimeClock data.

-Kirk
 

Attachments

  • TimeClock v1.0.zip
    417.8 KB · Views: 543

WoodWorks

Alibre Super User
Reverse Scroll Wheel

REVERSE SCROLL WHEEL DIRECTION IN ALIBRE

All of us wanting to have the direction of the scroll wheel Reversed in Alibre will finally be happy.

I have created a short script to remap the direction of the scroll wheel, and only while in an Alibre Window (I hope). Left me know if any other programs have the same windows class and result in conflicts. I can switch the active window test to include part of the Alibre Window name.

Add this to a running AutoHotKey script, and preferably the AutoHotKey.ahk that is the master default script which should be started with windows. You could create a special script and just start it with Alibre.

Here is the script:

#IfWinActive ahk_class WFC.Window.8 ; Alibre Design Windows Only
WheelUp::WheelDown ; Reverse direction of Scroll Wheel only in Alibre Design
WheelDown::WheelUp
#IfWinActive ; puts subequent remapping and hotkeys in effect for all windows


Remember to RELOAD the master AutoHotKey.ahk script after you make the changes to the script. Otherwise you will be wondering why this just does not work.

UPDATE 4/14/7 - 20:12 Found that this also reverses the scroll wheel operation when working with a BOM and scrolling through the list. Something I can live with for the scroll wheel functionality in parts and assemblies. Now I have gotten so used to the Alibre wheel direction that I am having to unlearn 2 years of habit.
 

kineoptics

Senior Member


Hi, Thanks for looking into this. I would hope Alibre notices all of this talk and makes zoom direction selectable.

But regarding this fix, where exactly does one install this?

Joe
 

WoodWorks

Alibre Super User


You have to download and install the free scripting tool, AutoHotKey from http://www.autohotkey.com

Then after installing shortcut to the AutoHotKey.ahk script in your startup folder, you add the above script code to that file.

AutoHotKey allows remapping of keys and mouse buttons, in addition to the ability to write keystroke based scripts to automate tasks. It is a very useful software tool. I tried to learn Python, and VB Script to automate daily tasks, but AutoHotKey has been much easier to learn and use.

I now use AutoHot key to read and manipulate text files, to extract and re-order .csv files (Equation Editor and BOM Export). I even use it as a macro language for Alibre. You can automate tasks by just recording the keystrokes to accomplish a task, and you have the base for a new script.

I took a bit of looking through the command list at first, but now I just steal sections of code from my earlier work. And a bit more of looking up commands and syntax. Look through what I have already posted for hints, and then take a look at the large collection of scripts available through the AutoHotKey Help for inspiration.
 

WoodWorks

Alibre Super User


PART CONFIGURATION LOCK v1.2

I changed the location of the Sleep command and finally got a more reliable Configuration Lock script. Adjust the Sleep 400 on line 119 if necessary to suit your computers processor speed. It needs enough time for Alibre to process the locking of the configuration before moving on.
 

Attachments

  • PartConfigurationLock v1.2.zip
    50.3 KB · Views: 420

fitzbond

Senior Member


Thanks for the time clock, I've been looking fo something like this and juts in time new contract starts today :D
 

WoodWorks

Alibre Super User


PART CONFIGURATION LOCK V1.3

I think I finally have a reliable routine to lock and unlock configurations in AutoHotKey. It has taken a bit of work to adapt my MacroExpress script and get it to work without skipping configurations. Please PM or post if you are still experiencing the script missing any configurations in processing.

I had to remove the "controls" that press buttons and revert back to tab'ing and sending keystrokes with pauses to get reliable operation. See comments in file.
 

Attachments

  • PartConfigurationLock v1.3.zip
    50.4 KB · Views: 461

WoodWorks

Alibre Super User


NOTE COPY v1.0 (5/1/2007)

This script allows the user to select a note to copy, and will automatically create a new note and fill it with the contents of the selected note.

The user can then modify the contents, and pick a location for the note on the drawing. When the Note dialog window is closed, the script will then loop back and wait for the user to pick another note to copy.

To quit, press and hold the Escape key, and click the left mouse button. This is done at the note selection stage where the user normally selectes the original note to copy. You can also just right click on the AutoHotKey icon for this script (name pops up when you hover over the Green square with white H), and choose exit.

I wrote this because one users pet peeve was the lack of ability to Copy and Paste Notes in an Alibre Drawing.
 

Attachments

  • NoteCopy v1.0.zip
    206.7 KB · Views: 396

WoodWorks

Alibre Super User


DIMENSION PROPERTIES v1.0 5/13/2007

This is a looping script similar to the NoteCopy script, that allows users to make the same type of modification rapidly to drawing dimensions.

Select the TAB in the Dimension Properties dialog when you start the script, and from then on the script will loop to allow you to make changes to the selected dimensions. Just left click on the desired dimension to modify, and the Dimension Properties box will open to the correct tab, and you can make the modifications. When the dialog box is closed, the script will wait for you to select another dimension.

To exit, hold down the Escape key when you left click the mouse (anywhere), or right click on the AutoHotKey icon for this script and choose Exit.

I use the script to quickly add descriptive text to dimensions, or suppress leader lines. I first add my dimensions, and then I go back with this script to do a similar type of modification to selected dimensions.

The script will remember the last Dimension Properties tab selected and provide that selection as the default.

Just restore this zip to C:\\Scripts. I use CTRL+ALT+D to activate this script.
 

Attachments

  • Dimension Properties v1.0.zip
    206.9 KB · Views: 436

WoodWorks

Alibre Super User


SHEET LAYOUT & CUTLIST PLUS BOM EXPORT processing v1.0 6/1/2007

Rather than modifying the Part Data of our cabinet models for each job, we currently use a script that maps standard information to user specified values.

We start by selecting fields in the Part Data to store our Bill of Material information. Rather than using fields with similar names, we soon learned it was easier to maintain if we kept the data together. Included in the zip file is a PDF document showing all the possible Part Data fields and those that we use for both Sheet Layout and CutList Plus. By using a unified layout, we are able to output to either program based on user preferences (and we do not have to remember two different schemes). We also use this scheme to output to MasterCAM for CNC, and it could be used for any other sheet optimization program as well.

We now fill the fields with generic data for the Material Type and Material Name, and use a script to map that data to user specified material. For cabinet case parts we use MTCASE/MNCASE for Material Type and Name. Similarly MTDOOR, MTDBOX, MTDBOTTOM for Door, Drawer box, and Drawer Bottom Material Type.

Next, we use the "BOM Export" Bill of Material template and create a Bill of Material with the values provided. You can use a system similar to ours, or just fill in the desired values for output. When you have the Bill of Material, export it to the file system with as a .csv file for further processing by the attached script. I have included our working copy and the template that has a second Part Number column for those users that want to use that field instead of Item Number to specify the part number. Just delete the column you do not want to use (as the script expects only one).

A "Material.ini" file is used to specify desired material with the key names used in the Part Data. The key names are entered, followed by the actual names you want in the .csv file for you sheet optimization software. The included sample is a good start. There is the [default] section, and then you can add another section per cabinet/assembly name to make custom specifications by assembly. The script that uses this data will first look for a matching assembly name, and if not found it will look to default to see is any default value is specified, and finally will ask the user, if no matching entry is found. The user can specify a value or skip the entry. Skipping an entry is good for such things as the Site or Walls, and furnishings such as a Sofa model. You can also specify OMIT for the second entry and such entries matching will be omitted from output. Handy for that SITE entry as well.

Run the appropriate AutoHotKey script for your software; select the BOM EXPORT.CSV file, the Material.ini file, and voila you will have the correctly formatted file necessary to import into your sheet optimization software. For Sheet Layout, the Material Thickness is automatically included with the Material name in a format that will import without any further modifications. The script currently places the material thickness in the front, but it is a simple modification to move the material thickness to the end of the material name using your favorite text editor. I like AutoHotKey because of the relatively straight forward syntax and ability to process data.

We also like to user LTBR top specify edge banding, which stands for Left, Top, Bottom, Right. Left and Right edge banding are on their respective ends which is easy to visualize. That is using the convention where the sheet of material is oriented with the grain along the X axis (going left to right) which is length, and cross grain along the Y axis which is Width. Parts cut in this manner have the Bottom toward you, and Top away. You could call them Front and Back as CutList Plus does, but I prefer Top and Bottom. The script will convert this convention to Cutlist Plus’s 4 digit 0 and 1 edge banding codes and Front, Back, Left, Right standard.

Post in this thread if you need help.
 

Attachments

  • Sheet Layout v1.0.zip
    31.8 KB · Views: 493
  • CutListPlus v1.0.zip
    31.8 KB · Views: 446

WoodWorks

Alibre Super User


START ALIBRE AND AUTOMATICALLY GO ONLINE

I created this script when my addled brain finally figured out that another post in the forum was attempting to start Alibre and not have to wait at that annoying OK before going online. (Me, I start offline and go online as necessary because it starts faster). I sure hope that was what they were trying to do. Either way, here is the script that starts Alibre and goes online automatically.

I posted it here because the straight text posted in the other thread trashed all my carefully indented code and made it hard to read.
 

Attachments

  • StartAlibreOnline.zip
    466 bytes · Views: 351

WoodWorks

Alibre Super User


ALIBRE PDF PUBLISH v1.0 (6/13/2007)

This script will take a user specified Drawing and Assembly file and publish them together in a single PDF file, with the 3D PDF as the last page in a Landscape mode Letter Size PDF file.

I created this as part of a larger project to take some user specified information about a cabinet model (provided via a web page), update a standard model, and "output a Drawing and 3D PDF of the result" to be emailed back to the person filling out the web page. An automatic response to an online review of a 3D PDF sample of a cabinet, with the ability for the user to provide their dimensions for this style of cabinet, and be able to get a drawing and 3D interactive model of the cabinet with their own dimensions. This would hopefully lead to an order for this standard style of cabinet, constructed with dimensions to suit their needs.

In the mean time, I found this portion of the project handy to document designs I have been working on for customers. It provides a nice concise output, that can easily be emailed to the customer.

This script date and time stamps the ouput, as part of the automatic web processing. The source of the script is provided so you can remove this, or modify the script to suit your purposes.
 

Attachments

  • AlibrePDFPublish v1.0.zip
    207.5 KB · Views: 373

WoodWorks

Alibre Super User


START ALIBRE AND GO ONLINE WITH IN-USE OVERRIDE

Working offline most of the time, I forgot about the possibility of the account being in use when Alibre terminates unexpectedly. I modified the code to take that possibility into account and terminate the in use session, and continue to go online.

This script takes that possibility into account and terminates the other session when encountered. My apologies to Alibre for two simultaneous logins while debugging this script (only way to reliable have another session to terminate).
 

Attachments

  • StartAlibreOnline v2.0.zip
    545 bytes · Views: 339
Top