Jump to content
Macro Express Forums

Easy List Box?


Cory
 Share

Recommended Posts

Reader’s digest version:

If I have a long list, 1000 approx, of text items and I want the user to choose one how can I do this? In Access I can create a list box with the display source being a table so that when the user enters the field they can just start typing and then select the one they want. Maybe there’s another way that differs slightly?

 

Everything from here down is supplementary, don’t both reading unless you want to help and I don’t make sense. <g>

 

Specifically what I am doing:

I have created several macros for disposing of PDF scans in a paperless conversion project. Scanners output PDF’s and I have ME pop them open, ask the users for several bits of info then enter meta data into the PDF, save and then rename the file with a standard convention and move it to the proper client folder and subfolder based on that characteristic info.

 

My sleazy workaround:

Don’t laugh but right now I use the client folder list and the directory command to allow the user to select a clients name to be used in a later path and elsewhere. Problem is I’m modifying the macro to access via FTP instead of UNC so it doesn’t work there. My sleazy solution? Create a temporary directory structure on the users local machine simply as a place to store the 1000+ text variables and delete it later. Then have them use the folder select command. Problem is with my sleazy workaround(s) is that, 1- they have to start from scratch every time browsing, and 2- I can’t do more with the items like remembering past input. For instance I was thinking it would be nice to have a sort of MRUD except it would be clients and keep score so if they do a bunch from one client they could have a ‘top five’ list to shorten their input. 3- If I use the UNC variant but have a remote user using VPN directory browsing is too slow.

 

Comment on HTA:

I saw Floyd’s stimulating post on the HTA but after a few minutes of stumbling around I felt as if it was going to be a research project to get it to do what I want so I though that instead I would write a post to see if there is an easier ‘old school’ way.

 

Related posts:

I’ll post a message here in a few minutes about FTP in ME. This is the case of the day but this post is more generic and I’ve had several things like this. What I am doing is using the directory list from the FTP site as the 1000+ string variable list.

Link to comment
Share on other sites

the user enters the field they can just start typing and then select the one they want. Maybe there’s another way that differs slightly?

Hi,

 

Do you just want a picker like the file picker??

 

If your 1000 items are in a text file (ie each item on new line); with a few lines of code changed, it becomes a text picker; enter up to the first 3 letters (or change the code yourself of the prompt), and enter the name of the file (at present a prompt, but put in file name), and the picker list will come up.

 

Let me know if this is useful, or you want to adjust; or do you mean something else altogether?

Best, Randall

EDIT - PS the lines to alter the input are early in the macro (10-19);

// EnvironmentVars HTAs

Variable Set String %T8% "Text Items"

Variable Modify String: Copy %T8% to %T7%

Replace "\" with "_" in %T7%

Replace ":" with "_" in %T7%

Variable Set String %T51% from File Name

Variable Modify String: Save %T51% to Environment Variable

Variable Set String %T51% ""

Variable Set String %T51% from Prompt

The lines I alterd from Process in Folder for file names in directory to

Text File Process for lines in a text file are nearer the end (193-205);

  // HERE ARE THE MODIFED LINES=========================================================

  Text File Begin Process: "five.txt"

  Text File Begin Process: "%TextFileName%"

    Variable Modify String: Copy Part of %T2% to %T50%

    If Variable %T50% contains variable %T51%

      Variable Modify Integer: Inc (%N16%)

      Write Registry String: "%Reg%Name%N16%"

      Variable Modify String: Save %T2% to Environment Variable

      Variable Set String %T1% "<option value="%TempName%" selected>%TempName%</option>PGMCRLFPGMCRLF"

      Variable Modify String: Append %T1% to %T91%

    End If

  Text File End Process

  // END OF THE MODIFED LINES==================(cf input of T51 earlier)=================

TextPickerHTA.mxe

Link to comment
Share on other sites

It didn't work but we're on the right track here. It blows up if the first three don't exist and if you enter fewer than 3 one gets odd results. But forget that now, I gotta learn how you guys make these HTA's! Please tell me. Ideally I would like to create an HTA with multiple fields. I wouldn't need your picker then as the user can simply start typing. Whats-his-butt did that really cool write up on using HTA's but it looked complicated to me. I asked how it's done but never got a reply.

 

Can you teach me Mr. Wizard?

 

I mean do you use a GUI HTML editing program to create them? Or you just hard code the stuff. And how do you get it to link to a macro variable?

 

Please please tell me!

 

I have to add a feature to the one new macro I am workin on now so hopefully you will have an answer for me by the time I get back.

Link to comment
Share on other sites

Hi,Cory,

I don't know if I can help you get there quickly. Although I wrote it, I did so by "hard coding", I think! Modified a previous vbscript, put it in special lines in mE macro as you can see in "filepicker" or txt picker" macros.

Explanation of Filepicker

This program works by "writing" an HTA script in three parts. The first and last parts are simply put in by strings. The Middle part is a loop, inserting a line in the script for each file found in the selected directory.

I would like to help; but i suspect you were hoping therer were an easier aswer? lwet me know if I can do more!

 

In the text picker, you can see in the macro that I just wanted to show the possibilities.

You would need to modify those lines above for;

1. Checking input

2. Modify the match (all I have is checking if the 3 keys "are comtained" in the first 6 letters of the text lines so far; you could modify them to be the exact first 3 letters etc?

Best, Randall

 

cf

Text File Begin Process: "five.txt" 

Text File Begin Process: "%TextFileName%"   

Variable Modify String: Copy Part of %T2% to %T50%

      If Variable %T50% contains variable %T51%

 

The lines I altered from Process in Folder for file names in directory to

Text File Process for lines in a text file are nearer the end (193-205);

Link to comment
Share on other sites

Can't I just create and save an HTA? Kevin (was it) had his macro creating the file but it looked strange in my editor. I'll poke at it with a stick here in just a few minutes.

Link to comment
Share on other sites

Hi,

 

As the "HTA" in this instance is "written " line, by line, in the macro, before it is created, and contains the requested lines within itself, i think you can't do it here.

 

Whether vbscript has an inbuilt "listbox", I doubt.

 

The "Wizard" program (using AutoIT program externally) could be kept running and make such a listbox, say, to send back to an "ini" file or registry; I would have to write the script, though, so time -consuming, and not a rapid answer for you.

 

You will have seen the "formmaker" wizard i wrote; very basic, and no list boxes, only form fields;

FormMaker7.mex

Form maker topic

 

(btw your query about linking to macro;

1. Macro write HTA in process, then creates and runs it (so info contained)

2. sends back via "registry" entry

Randall

Link to comment
Share on other sites

So the macro must create the HTA? You can't simply have a premade HTA that posts it's results to the macro it was called to? Sounds difficult. I'll have to take a look at the one you sent me. Say, can you make one like the one you sent earlier but without the 3 letter trick? Somethig that simply gives the selection box?

 

This will work, if you go to Kevin's example and move into the list box and start typing it will take you right to the first suspects. This is a general Windows thing and works everywhere. Havent' you ever moved into a Windows Explorer window and just start typing the forst couple of letters of what you are looking for? It will take you right to it.

Link to comment
Share on other sites

I'm sorry, I should have looked at it first. Thanks.

 

Wasn't Kevin the one who wrote that deal on the HTA? Maybe it was someone else. I can't find it now.

Link to comment
Share on other sites

OK,

I think I kno wall that has been on the site, then; I was only able to work out how to script those HTA listboxes by copying the scripting Floyd wrote; HTA script is very cumbersome for this; although there may just be commands that I don't know; I doubt it as I think it is a very basic approach there.

I'll look at modifying the Wizard, though!

Tell me if the TextpickerHTA2 does what you expect in the list selection? - I was concerned it would be slow if you open 1000 lines?

Best, Randall

Link to comment
Share on other sites

Hey, Cory,

 

I think it is working..

Screenshot

Using latest upload of Wizard.

 

Wiz

 

TextPickerWizard macro can even be standalone.. (Sorry - Standalone with the wizard installed; I meant that you don't need MEBasic, nor do you need to import into library.... it is based on using external program, and that .exe file needs be in ME directory....)

 

Randall

WOOPS! - Sorry again,

I had the fileexists directory wrong in MacroExpress, not Wizard!

line 13 if you want to fix it manually; I've uploaded it again

TextPickerMacro

Link to comment
Share on other sites

I tried it but I get "Code Wizard not in Macro Express Installation directory?" What does this mean? I get one more text box but hten nothing.

Link to comment
Share on other sites

Hi,

Cory;

(Standalone with the wizard installed; I meant don't need MEBasic or import into library.... it is based on using external program, and that .exe file needs be in ME directory....)

Wizard

Randall

PS EDIT 16th June; delays help on some machines[Probably a limit of 4096 lines?]

TextPickerWizard.mxe

Edited by randallc
Link to comment
Share on other sites

Man I am soooo frustrated with all of this. Why the <expletive deleted> can’t ME have to most obvious and basic functionality of selecting items from a list? Every application in the world has this functionality. I like ME but every time I try to do something tricky I always run into that one hitch or oddly missing feature that becomes a monolith to work around. The reason I use ME is because I am not a programmer so why is it that to do the simplest things I need to be a programmer? Drives me nuts! OK, I’m done ranting.

 

Now I started to write my own routine for picking from a list but it was becoming complicated so I thought I would give Randall’s thing another try. But again it just doesn’t work. This time I copied that wizard to the ME program folder and tried running the playable text picker macro but the man just stands still I the system tray. If I right click him (abort) then it prompts me for a file with the list items. I don’t know what part of ‘abort’ it didn’t understand. Then it goes away a second and displays a MacroExpress dialog box that says “The macro ‘TextPickerWizard’ has been aborted.” And that’s it. I tired importing it and seeing where it was going wrong but I can’t follow what he’s doing.

 

What is ‘Wizard” anyway? And does it need to be installed? And what is MEBasic and does it need to be installed? Is this just an add on product of Randall’s or is it part of ME?

Link to comment
Share on other sites

Hi, Cory,

 

[(PS I think some machines are too fast, and have not been taking in the installation path; today i have added a delay]

cf previously in this thread; (I am not sure what the Macro Express guys would say about a "List box" being part of any program"; I doubt that would be the case for most macro programs, which were not usually designed with GUI interface)

Whether vbscript has an inbuilt "listbox", I doubt.

The "Wizard" program (using AutoIT program externally) could be kept running and make such a listbox, say, to send back to an "ini" file or registry; I would have to write the script, though, so time -consuming, and not a rapid answer for you.

TextPickerWizard macro can even be standalone.. (Sorry - Standalone with the wizard installed; I meant that you don't need MEBasic, nor do you need to import into library.... it is based on using external program, and that .exe file needs be in ME directory....)

 

Instructions on Wizard thread

 

Very much a personal add-on program of mine, very early and buggy at times ( I hadn't realised it still was). I have added this feature to it just because of your problem, and can't get enough exact feed back from people to find out why it runs for me and not others. I thought you had given up on it anyway!

 

The instructions for intallation of the Wizard are on the links in my signature (only needs to be ["MEbasicWizard.exe"] latest upload, put it in your ME installation directory), but I think you are too hassled and busy to have read them all. You shouldn't need MEBasic for the text line picker.

Hope it works out, Randall

Link to comment
Share on other sites

Man I am soooo frustrated with all of this. Why the <expletive deleted> can’t ME have to most obvious and basic functionality of selecting items from a list? Every application in the world has this functionality. I like ME but every time I try to do something tricky I always run into that one hitch or oddly missing feature that becomes a monolith to work around. The reason I use ME is because I am not a programmer so why is it that to do the simplest things I need to be a programmer? Drives me nuts! OK, I’m done ranting.

Macro Express is not a development language like VB, Delphi, Foxpro, and so forth. It is closer to a script language like VB Script. Script languages for the most part lack GUI interfaces. It is not what they do.

 

Macro Express was originally designed to automate our keyboard and mouse tasks but it has grown so much and has had so many new commands added to it, that it tantalizes and teases us with possibilities that go way beyond its original scope. Because it is so powerful, because we constantly find new ways to use it, we always think that it should do more and that it should have even more features.

 

Macro Express has, in my opinion, grown so much that it has become a hybrid. It is much more powerful than scripting and less than a development language. It is in a class all by itself.

Link to comment
Share on other sites

You're so right. I need to remember what it was originally intended as and how it does that very well. But it does taunt me with those possibilities. <g> BTW thanks for ME, it’s a great product. I apologize if I sound like an ingrate! I mean no offense.

 

I myself have been thinking that at some point I just need to take a VB class. Also I have been making Access DBs and I’m finding the same thing there where you can almost realize your vision then find that you need a VBA script to make it do what you really want.

 

Does anyone know any online courses for VB?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...