Sign in to follow this  
Followers 0
ghetek

easy array problem

9 posts in this topic

i think its an easy fix but im in the middle of a brainfart.

#include <File.au3>
_FileCreate(@SystemDir & "\ScreenScripter.ini")
$ini_Locale = @SystemDir & "\ScreenScripter.ini"

;win0 = WinList ("Adobe Acrobat Professional","")

$win0 = WinList ()
for $var = 0 To $win0[0][0] step 1
$win1 = WinGetPos($win0[$var][0],"")
IniWrite($ini_locale,"Win" & $var,"wintitle",$win0[$var][0])
IniWrite($ini_locale,"Win" & $var,"winhandle",$win0[$var][1])
IniWrite($ini_locale,"Win" & $var,"winposx",$win1[0])
IniWrite($ini_locale,"Win" & $var,"winposy",$win1[1])
IniWrite($ini_locale,"Win" & $var,"winsizex",$win1[2])
IniWrite($ini_locale,"Win" & $var,"winsizey",$win1[3])
Next

Share this post


Link to post
Share on other sites



Where are you getting the variable $win1 from? And what 'exactly' are you trying to accomplish?


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

$win0 = WinList ()
for $var = 0 To $win0[0][0] step 1
 $win1 = WinGetPos($win0[$var][0],"")
 if IsArray($win1) Then
  IniWrite($ini_locale,"Win" & $var,"wintitle",$win0[$var][0])
  IniWrite($ini_locale,"Win" & $var,"winhandle",$win0[$var][1])
  IniWrite($ini_locale,"Win" & $var,"winposx",$win1[0])
  IniWrite($ini_locale,"Win" & $var,"winposy",$win1[1])
  IniWrite($ini_locale,"Win" & $var,"winsizex",$win1[2])
  IniWrite($ini_locale,"Win" & $var,"winsizey",$win1[3])
 EndIf
Next


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

$win0 = WinList ()
for $var = 0 To $win0[0][0] step 1
 $win1 = WinGetPos($win0[$var][0],"")
 if IsArray($win1) Then
  IniWrite($ini_locale,"Win" & $var,"wintitle",$win0[$var][0])
  IniWrite($ini_locale,"Win" & $var,"winhandle",$win0[$var][1])
  IniWrite($ini_locale,"Win" & $var,"winposx",$win1[0])
  IniWrite($ini_locale,"Win" & $var,"winposy",$win1[1])
  IniWrite($ini_locale,"Win" & $var,"winsizex",$win1[2])
  IniWrite($ini_locale,"Win" & $var,"winsizey",$win1[3])
 EndIf
Next
Ahh, I get it... I never looked at the 'key' he was trying to write, just the fact that there wasn't a $win1 :lmao:

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

But there is a $win1... it's right there... $win1 = WinGetPos($win0[$var][0],"")

Share this post


Link to post
Share on other sites

But there is a $win1... it's right there... $win1 = WinGetPos($win0[$var][0],"")

o:);):lmao::king:

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

im not understanding why we need an if statement there.

Share this post


Link to post
Share on other sites

Well WinGetPos returns an array, but if it fails it returns 0. The if statement checks to see if it failed or not - if it didn't fail, it's safe to try and use the array in the following functions.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Dunno, it might throw an error if it's minimized?

Edit:

The only time I got it to throw a Non-Array Error is when I wasn't using the entire title. Even Hidden I at least got a -32000 position in hidden and minimized mode.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
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
Sign in to follow this  
Followers 0