Jump to content

Recommended Posts

Posted (edited)

Hi everyone, need some help...trying to move certain windows to a poistion/size.

Not sure if this is possible, but can part of script be copied from a text file while already running?

HotKeySet("+^k", "_SetWinPosition")
While 1
    Sleep(1)
WEnd

Func _SetWinPosition()
    ???
EndFunc

And lets say I am reading ??? from a text file called TEST.txt, and content of file is as follows...

WinActivate("New tab - Internet Explorer")
WinMove("New tab - Internet Explorer", "", 676, 22, 1023, 853)

WinActivate("Test - Notepad")
WinMove("Test - Notepad", "", 645, 316, 688, 707)

Edited by montyali
correction
Posted (edited)
HotKeySet("+^l", "_SetWinPosition")
While 1
    Sleep(1)
WEnd

Func _SetWinPosition()
    $setposdata = FileRead(@ScriptDir & "\TEST.txt")
    Execute($setposdata)
EndFunc

WinActivate("New tab - Internet Explorer")
WinMove("New tab - Internet Explorer", "", 676, 22, 1023, 853)

WinActivate("Test - Notepad")
WinMove("Test - Notepad", "", 645, 316, 688, 707)

and where TEST.txt contained above text...sorry this did not work for me

...also, it's reading the file properly though, but not executing.

Edited by montyali
  • Developers
Posted (edited)

Execute() needs a single valid statement... not a multiline script so I am sure you are getting @error = 1.

This will work:

$myexecute = 'WinActivate("Test - Notepad") + WinMove("Test - Notepad", "", 645, 316, 688, 707)'
 

$myexecute = 'WinActivate("Test - Notepad") + WinMove("Test - Notepad", "", 645, 316, 688, 707)'
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : Execute($myexecute) = ' & Execute($myexecute) & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console

Jos 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted
2 hours ago, Jos said:

This will work:

$myexecute = 'WinActivate("Test - Notepad") + WinMove("Test - Notepad", "", 645, 316, 688, 707)'

What about using & instead of +

$myexecute = 'WinActivate("Test - Notepad") &" "& WinMove("Test - Notepad", "", 645, 316, 688, 707)'

so as to capture the individual return codes?

Code hard, but don’t hard code...

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