Jump to content
Macro Express Forums

Updating a text box's title


Recommended Posts

I frequently use the Text Box Update command but after some experimentation I can't see any way to update the window title. I was thinking this would be clever to display some information there so it could be seen by the user in the task icon in the taskbar. EG my time tracking shows the total hours there. Of course one could close the window and open a new one but that really slows down the macro. Before I made a feature request I wanted to see if anyone else saw a way I missed.

 

 

Link to comment
Share on other sites

Something like this? This script prompts for the header each repeat, but the value of %Header% can probably come from elsewhere:

 

Variable Set String %Header% to "Start"
Repeat Until %Header% Equals ""
 Text Box Display: %Header%
 Variable Set String %Header%: Prompt
 Update Textbox: %Header%
End Repeat

Link to comment
Share on other sites

Actually that will not work, I tried it in a slightly different way. I did a repeat 10 times with 1 second delays. It's a bootstrapping problem. You can't vary the header before updating because the command will not find the text box!

 

 

 

My goal here was to use the taskbar icon as a progress indicator. EG display the percentage of completion of a large invisible job where it would need to be updated 100 times

 

But thanks for the suggestion!

 

 

Link to comment
Share on other sites

Actually that will not work, I tried it in a slightly different way. I did a repeat 10 times with 1 second delays. It's a bootstrapping problem. You can't vary the header before updating because the command will not find the text box!

 

 

 

My goal here was to use the taskbar icon as a progress indicator. EG display the percentage of completion of a large invisible job where it would need to be updated 100 times

 

But thanks for the suggestion!

I wrote myself a DisplayPausing macro in ME3, before we had the ability to update an existing textbox. You'll see that it does indeed "change" the header, and I have never observed any performance problems with it.

// Timeout number of seconds
If Variable %N[91]% Equals "0"
 Variable Set Integer %N[91]% to 10
End If

// Display Pause dialog box for N91 seconds
If Variable %T[99]% Equals ""
 Variable Set String %T[99]% to "the job in hand."
End If
Repeat Until %N[91]% Equals "0"
 Sound File: Windows XP Battery Low.wav
 Text Box Display: Pausing (closes and continues after %N[91]% seconds)
 Delay: 1 seconds
 If Window "Pausing (closes and continues after %N[92]% seconds)" is running
   Text Box Close: Pausing (closes and continues after %N[92]% seconds)
 End If
 If Not Window "Pausing (closes and continues after %N[91]% seconds)" is running
   Clear Variables
   Variable Save: Save All Variables
   Macro Stop
 Else
   Variable Modify Integer set %N[92]% to the contents of %N[91]%
   Variable Modify Integer %N[91]%: Decrement
 End If
End Repeat

<COMMENT Value="Timeout number of seconds"/>
<IF VARIABLE Variable="%N[91]%" Condition="\x00" Value="0" IgnoreCase="FALSE"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%N[91]%" Value="10"/>
<END IF/>
<COMMENT/>
<COMMENT Value="Display Pause dialog box for N91 seconds"/>
<IF VARIABLE Variable="%T[99]%" Condition="\x00" IgnoreCase="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[99]%" Value="the job in hand." NoEmbeddedVars="FALSE"/>
<END IF/>
<REPEAT UNTIL Variable="%N[91]%" Condition="\x00" Value="0"/>
<SOUND FILE File="C:\\WINDOWS\\Media\\Windows XP Battery Low.wav" Wait="FALSE" _IGNORE="0x0007"/>
<TEXT BOX DISPLAY Title="Pausing (closes and continues after %N[91]% seconds)" Content="Close this dialogue box to abort all further processing for %T[99]%" Left="1760" Top="467" Width="320" Height="84" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x02" Delay="2"/>
<DELAY Flags="\x01" Time="1"/>
<IF WINDOW Option="\x01" Title="Pausing (closes and continues after %N[92]% seconds)" Partial="TRUE" Wildcards="FALSE"/>
<TEXT BOX CLOSE Header="Pausing (closes and continues after %N[92]% seconds)"/>
<END IF/>
<IF NOT WINDOW Option="\x01" Title="Pausing (closes and continues after %N[91]% seconds)" Partial="TRUE" Wildcards="FALSE"/>
<CLEAR VARIABLES Type="Text Variables" Option="\x02"/>
<VARIABLE SAVE Option="\x00"/>
<MACRO STOP/>
<ELSE/>
<VARIABLE MODIFY INTEGER Option="\x06" Destination="%N[92]%" Variable="%N[91]%"/>
<VARIABLE MODIFY INTEGER Option="\x08" Destination="%N[91]%"/>
<END IF/>
<END REPEAT/>

Link to comment
Share on other sites

Actually that will not work...

But thanks for the suggestion!

 

If refreshing of the TBD was acceptable, the following minor variation on Alan's suggestion might be a suitable approach? Note that the TBD option Keep Focus is unchecked

 

Repeat Until %Header% Equals ""

Variable Set String %Header% from the clipboard contents

Text Box Display: %Header%

Update Textbox: %Header%

Delay: 1 seconds

End Repeat

 

<REPEAT UNTIL Variable="%Header%" Condition="\x00"/>
<VARIABLE SET STRING Option="\x02" Destination="%Header%"/>
<TEXT BOX DISPLAY Title="%Header%" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="FALSE" Mode="\x01" Delay="1"/>
<UPDATE TEXTBOX Header="%Header%" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 \r\n\\par }\r\n"/>
<DELAY Flags="\x01" Time="1"/>
<END REPEAT/>

 

BTW, I didn't follow what you meant about getting this into "...the taskbar icon..." What taskbar icon?

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Feedback would be polite, Cory!

 

That post was one of several replies to you into which I put some effort but never had the courtesy of a reply. This one, some 7 weeks old, is another

http://pgmacros.invisionzone.com/index.php?showtopic=4706&pid=20241&st=0entry20241

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Dude, relax. I haven't had time to cruise the for a few days. Been on a new efficiency kick lately to bill more hours and one of my rules is to bill X hours before I do any personal projects. Too often I find myself spending too many hours in the morning in this forum!

 

 

Link to comment
Share on other sites

I’m not following your suggestion. How is the text %header% being changed?

 

 

The problem is that MEP uses the header to identify the text box to be updated. So if I initially set %header% to “Fred” then change it to “Barney” and tell it to update text box %header% it can’t find the text box named Barney because it’s still named Fred.

 

 

By taskbar icon I mean, errr… The icons in the task bar. I’m not sure how else to describe it. It’s the icon that represents the visible application. EG open Word and an icon for Word appears in the taskbar. And in the text of the icon there’s the window’s title. Some put information in there like my time tracking software and I wanted to do the same. However it doesn’t sound like it’s directly possible with MEP without closing and re-opening.

 

 

 

 

Link to comment
Share on other sites

I have done very similar things. Closing and re-opening does cost time but if it's only being done infrequently it's no big deal. But I have some macros that I do it several hundred times a minute. IE progress indicators. In the past I avoided this problem by calculating a percent, or rounding to every hundred and only closing and opening the text box then. IE reducing the frequency. But it still causes the box to flash into and out of existence which can be annoying if it’s happening several times a second. The update command is great. I can be lazy and let it update every time with negligible impact on performance.

 

 

Link to comment
Share on other sites

I’m not following your suggestion. How is the text %header% being changed?

 

Via the clipboard. Hence the command

Variable Set String %Header% from the clipboard contents

 

 

The problem is that MEP uses the header to identify the text box to be updated. So if I initially set %header% to “Fred” then change it to “Barney” and tell it to update text box %header% it can’t find the text box named Barney because it’s still named Fred. [/size]

 

Did you try the macro?

 

By taskbar icon I mean, errr… The icons in the task bar. I’m not sure how else to describe it. It’s the icon that represents the visible application. EG open Word and an icon for Word appears in the taskbar. And in the text of the icon there’s the window’s title. Some put information in there like my time tracking software and I wanted to do the same. However it doesn’t sound like it’s directly possible with MEP without closing and re-opening.[/size]

 

I didn't ask "What is a taskbar icon?" but "What taskbar icon?"!

 

IOW, what application, Explorer window, etc? Is this a specialist application? The only example you mentioned was your time billing program. I can't think offhand of any of my apps that show changing information in the XP Pro Taskbar. (Unlike the System Tray, of course, where the most familiar example is the time.) Is this a feature new to Win 7?. Assuming you succeed in dynamically changing the Header in a TBD macro command, how do you get it into the taskbar entry?

 

Another approach that occurs to me would be to keep changing the name of a Notepad file (using the Rename File/Files command) and minimising it to the Taskbar.

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Oh I see the confusion now. I'm talking about the taskbar icon for the MEP text box. I want it to indicate progress as well. EG Progress: 1%, Progress: 2%, Progres: 3%...

 

 

Link to comment
Share on other sites

I'm talking about the taskbar icon for the MEP text box. I want it to indicate progress as well. EG Progress: 1%, Progress: 2%, Progres: 3%...

 

Sorry, but I still don't follow what you mean. Is there some option for the Text Box Display command that I've missed all this time, which lets you minimise it to the Windows Taskbar? Or are you merely reducing its size and positioning it manually above the Taskbar?

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Sorry, but I still don't follow what you mean. Is there some option for the Text Box Display command that I've missed all this time, which lets you minimise it to the Windows Taskbar? Or are you merely reducing its size and positioning it manually above the Taskbar?

 

--

Terry, East Grinstead, UK

 

I think what Cory does have in mind is this:

 

taskbardicon.png

 

When downloading something with firefox (and I'm quite sure it's the same for other browsers) you will see a window showing the progress of a file download and its representation in the taskbar ("the taskbar icon"), also showing the progress. This way, you don't have to have the downloading window on the top to see where are you at with the file download. It would be great if it could work the same way for ME TBD.

Minimising the window is not the priority (or necessity) here. As long as we can check the progress without bringing the TBD window to the front we are fine.

Link to comment
Share on other sites

Thanks Arek. That seems to confirm my assumption that there are two unsolved requirements. Not just 'How do I get dynamic interaction with a TBD header', but also, so far unspoken: 'How do I get the TBD to the Windows Taskbar?'.

 

The opening sentence of Cory's opening post was

I frequently use the Text Box Update command but after some experimentation I can't see any way to update the window title. I was thinking this would be clever to display some information there so it could be seen by the user in the task icon in the taskbar. ( (My italics, my bold.)

 

I interpreted that as implying that the only question was how to change the header!

 

If I'm still mistaken, and it's obvious how to get the TBD to the Taskbar, can someone tell me how please?

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Double duh! Embarrassed to admit I've never been aware of it. I suppose because I have so many taskbar icons and Quick Launch and Tray icons that they're all quite small. With the 'M' of Macro Explorer and the similar 'M' of Script Editor, never noticed the brief appearance of a third 'M' for the TBD.

 

Now that I know it's there, I just tried my macro and Paul's again and they both run OK here. (Although I had to get rid of most of my running apps so that I could see the changing text in the icon.) Don't they work for you, Cory?

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Sigh. Never mind. Thanks for all your input but this train has long ago gone off the rails. But to be polite please understand that Paul’s ‘solution’ is one that that is based on opening and closing, not using the update command. To be honest I didn’t see ant TBU commands in his script so I knew this wasn’t a solution because closing and reopening is hundreds of times slower. But if I’m missing something please let me know and I’ll look at it more closely.

 

 

 

BTW I put my taskbar on the left side of my primary screen about 2” wide and always on top. This affords me the ability to see what the titles are for most of the windows instead of just a little icon. Also I can see 20+ at a glance. It’s a personal preference to be sure but I can’t understand why anyone would have the taskbar at the bottom of the screen if they have dual or large displays and can afford the dedication or display real-estate. I just can’t stand the extra time hunting for ‘the’ window hidden in multiple icons with the same icons.

 

 

Link to comment
Share on other sites

BTW I put my taskbar on the left side of my primary screen about 2” wide and always on top. This affords me the ability to see what the titles are for most of the windows instead of just a little icon. Also I can see 20+ at a glance. It’s a personal preference to be sure but I can’t understand why anyone would have the taskbar at the bottom of the screen if they have dual or large displays and can afford the dedication or display real-estate. I just can’t stand the extra time hunting for ‘the’ window hidden in multiple icons with the same icons.

 

I guess that goes to me :)

I have the taskbar on the bottom for the same reason I'm still stuck on XP. I need to run some games in maximised mode. I have to have the taskbar visible cause it won't let me start a macro if the game has focus (and it of course has if it is fullscreen, therefore the maximised mode). If I moved the taskbar I'd need to rewrite plenty of macros because the game window "extends" or "shrinks" to use all the screen it's given in maximised mode. And it does it in a very irregular way therefore it's not only a matter of adjusting the coordinates by lets say 20 pixels this way or another. Hope I made it clear enough but the behaviour of game window contents is very different from "usual programs" and it's not obvious if someone didn't stumble upon it. Resizing the game window by 1 pixel causes more hassle that anyone would think it could. Seriously.

On my other PC that I don't use for game macros writing (bots) I also have the sidebar moved to the side [i prefer the right edge] of the screen and it *IS* much better to work with, no doubt about it.

Link to comment
Share on other sites

But to be polite please understand that Paul’s ‘solution’ is one that that is based on opening and closing, not using the update command. To be honest I didn’t see ant TBU commands in his script...

I believe that is what I said when, in the message accompanying the code, I wrote

"I wrote myself a DisplayPausing macro in ME3, before we had the ability to update an existing textbox. You'll see that it does indeed "change" the header, and I have never observed any performance problems with it."

Link to comment
Share on other sites

BTW I put my taskbar on the left side of my primary screen about 2” wide and always on top. This affords me the ability to see what the titles are for most of the windows instead of just a little icon. Also I can see 20+ at a glance. It’s a personal preference to be sure but I can’t understand why anyone would have the taskbar at the bottom of the screen if they have dual or large displays and can afford the dedication or display real-estate. I just can’t stand the extra time hunting for ‘the’ window hidden in multiple icons with the same icons.

I have 3 19-inch screens, and an independent taskbar at the bottom of each, showing only those windows open on that screen. I personally can't stand having myriad windows open; I normally have no more than perhaps 8 windows open at most. I use all of my 3-screen real estate, and could not tolerate having a taskbar occupying as much space as would be needed to support having the taskbar on the left of any monitor!

Link to comment
Share on other sites

  • 2 weeks later...

That's interesting. How do you have a task bar on each?

UltraMon will give you a pretty decent taskbar on each monitor, with most of the functionality you'd expect:

UltraMon

But I no longer use the multiple taskbars feature of UltraMon, since I find the following software better:

Actual Window Manager

Here's what they say about the multi-monitor component:

"Although there are several third party solutions that allow duplicating the taskbar on secondary monitors, they still have no or just partial support of the new taskbar features presented in Windows 7. Actual Multiple Monitors 3.0 is the first and only multi-monitor software that provides the exact replica of Windows 7 Taskbar on secondary displays."

I also use AWM to allow me to "close" some windows, e.g. Firefox, by clicking on the X; this causes Firefox to minimize to the tray.

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...
×
×
  • Create New...