Jump to content

Im new here .. how to ..


ia85
 Share

Go to solution Solved by ia85,

Recommended Posts

Hi,

Im new to AutoIT.

I know it should be simple but i cant get it to work , can someone please write the complete scripts ?

 

1.trying to make a window return to be on top of other windows.

this should be looped every 2 seconds as long as the window is open.

 

2.trying to make a window (notepad for example) return to be on top of other windows,

be in focus for receiving key strikes to a text box.

this should be looped every 2 seconds as long as the window is open.

thanks!

Link to comment
Share on other sites

  • Moderators

ia85,

Welcome to the AutoIt forums. :)

We do not write code to order here - we help you get your code working. Think of the old saying: "Give a man a fish, you feed him for a day; give a man a net and you feed him forever". We try to be net makers and repairers, not fishmongers.

So I suggest you take a look at AutoIt's excellent Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) as this will help you enormously. You should also look at this excellent tutorial - you will find other tutorials in the Wiki (the link is at the top of the page). There are even video tutorials on YouTube if you prefer watching to reading. :)

As JohnOne has suggested, I would start with WinSetOnTop, WinExists, Send & Sleep - that should get you most of what you want. Just post your code (see here how to do it) even if it does not work and we will help you lick it into shape. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Solution

ok,

so i took the tutorials and managed to make actual progress - thanks for your guidance !

it only needed 3 commands, but it works great. 

i used a while loop that is always true, WinActivate, Sleep

this is my first code: 

While 1
   WinActivate("[CLASS:Notepad]", "")
   Sleep(2000)
WEnd
 
any ideas on how to replace the Sleep command and use a more elegant command on order to keep the window in focus ?
Link to comment
Share on other sites

This code will replace 'sleep()' so that your script does not lockup or halt during the sleep() command.

You can process other information, instead of idling (sleeping) with this code.

 

$timer_len= 2*60*1000;set the timer for two min
$timer= timerinit();start the timer
While 1
    if timerdiff($timer)>= $timer_len then;check the timer
        $timer= timerinit();reset timer
        WinActivate("[CLASS:Notepad]", "");do that thing
    endif
WEnd
.

I'm not sure about the elegant focus.

You could use a handle to only activate a specific notepad window. Is that what you want?

Edited by Xandy
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...