Change window title?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Rodger
Newbie
Posts: 2
Joined: Wed Sep 13, 2006 3:47 pm
Location: Montevideo, Uruguay
Contact:

Change window title?

Post by Rodger » Wed Sep 13, 2006 4:01 pm

Is there a way to use Macro Scheduler to change a window title?

I have a webpage that provides an online test. I don't want my students to take the test at home, so I don't want them to know the URL.

I turned off the address toolbar, but IE then puts the address in the title. Can I override that title?

Rodger

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Sep 13, 2006 5:02 pm

Well if this is a web page that you wrote then simply change the TITLE tag in the HTML.

Otherwise, yes, you can do this:

GetWindowHandle>Existing Window Title,hwnd
LibFunc>User32,SetWindowTextA,r,hwnd,New Window Title
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Wed Sep 13, 2006 7:00 pm

That's not very secure. If the File menus is available "properties" shows the URL, adding to favorites does too. If you have access to the server then putting the page in a separate directory and using .htaccess to limit the access to your school IP's would be pretty safe.

Rodger
Newbie
Posts: 2
Joined: Wed Sep 13, 2006 3:47 pm
Location: Montevideo, Uruguay
Contact:

Post by Rodger » Thu Sep 14, 2006 10:43 am

mtettmar wrote:Well if this is a web page that you wrote then simply change the TITLE tag in the HTML.
After I turned off the address bar, IE put the URL in the title bar. (it shows up that way on your next load of IE).
mtettmar wrote:Otherwise, yes, you can do this:

GetWindowHandle>Existing Window Title,hwnd
LibFunc>User32,SetWindowTextA,r,hwnd,New Window Title
Wow, thanks. This was the key. I get what I wanted with this.

Rodger

Legend
Newbie
Posts: 10
Joined: Fri Apr 04, 2014 12:11 am

Re:

Post by Legend » Sun Mar 29, 2015 7:23 am

Marcus Tettmar wrote:Well if this is a web page that you wrote then simply change the TITLE tag in the HTML.

Otherwise, yes, you can do this:

GetWindowHandle>Existing Window Title,hwnd
LibFunc>User32,SetWindowTextA,r,hwnd,New Window Title
Thanks, this work but after changing the window title, how can I made it become the active window or activate the new window to become active window?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Change window title?

Post by Marcus Tettmar » Mon Mar 30, 2015 12:51 pm

To activate a window use SetFocus:

SetFocus>window_title
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Legend
Newbie
Posts: 10
Joined: Fri Apr 04, 2014 12:11 am

Re: Change window title?

Post by Legend » Tue Mar 31, 2015 4:49 pm

Marcus Tettmar wrote:To activate a window use SetFocus:

SetFocus>window_title
I think you misundertand my question, I mean when after window title changed, sometimes that particular windows is minimise to taskbar, I want to restore/become the active window on my desktop or the top most windows on my computer screen.

SetFocus command didnt do/work that way.

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Change window title?

Post by JRL » Wed Apr 01, 2015 3:39 pm

SetFocus command didnt do/work that way.
That's all the SetFocus> command does do. If it did not restore the window then most likely you have not specified the window name correctly. Actually since in this process you have already acquired the window handle, the best thing would be to SetFocus to the window handle. You need to use the WIN_USEHANDLE variable to do that.

Code: Select all

Let>WIN_USEHANDLE=1
SetFocus>hwnd

Legend
Newbie
Posts: 10
Joined: Fri Apr 04, 2014 12:11 am

Re: Change window title?

Post by Legend » Wed Apr 01, 2015 5:32 pm

Both of you are right, I'm sorry, it only works if I compiled the script into exe file. But theres one problem, if the windows task manager is the active window, the notepad window will change to Confirmed but it wont be on top of the task manager window, it will still be in minimise taskbar state. Any solution to that?

Code: Select all

Let>WIN_USEHANDLE=0
WaitWindowOpen>Untitle*
GetWindowHandle>Untitle*,hwnd
LibFunc>User32,SetWindowTextA,r,hwnd,Confirmed
GetWindowHandle>Confirmed,hwnd
Let>WIN_USEHANDLE=1
SetFocus>hwnd

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts