AutoIt Forums: How to convert GUI scripts to v3.2.12.0 - AutoIt Forums

Jump to content

  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

How to convert GUI scripts to v3.2.12.0 Read me if your scripts no longer work in v3.2.12.0

#1 User is offline   Jon 

  • Here is Sub-zero. Now just plain zero.
  • Icon
  • Group: Admin
  • Posts: 8,101
  • Joined: 02-December 03
  • Gender:Male

Posted 10 May 2008 - 09:28 AM

In v3.2.12.0 a number of changes were made to the include files used for the GUI:
  • GUIConstants.au3 is identical to GUIConstantsEx.au3. This means that many scripts using advanced GUI functionality will need to use additional #include statements to include files containing constants that were previously and erroneously included.
  • GUIDefaultConstants.au3 no longer exists. You must now #include the corresponding individual constants file for the control type you need.

Needs some more detail, and maybe a step by step guide of how to convert a couple of scripts - please reply to this thread with suggestions/drafts of how this post should look and I'll update. This is to help with the inevitable flood of questions when 3.2.12.0 is released.

0

#2 User is offline   Jon 

  • Here is Sub-zero. Now just plain zero.
  • Icon
  • Group: Admin
  • Posts: 8,101
  • Joined: 02-December 03
  • Gender:Male

Posted 10 May 2008 - 10:48 AM

Discuss.
0

#3 User is offline   monoceres 

  • In Soviet Russia, titles keep you!
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 3,088
  • Joined: 04-June 07
  • Gender:Male
  • Location:Sweden för bövelen

Posted 10 May 2008 - 01:10 PM

I just made a small "updater" which will search through your scripts and add appropriate includes.
Feel free to change it since it's not very optimized and it could have some problems (Tested on one of my old projects with 400+ lines and worked flawless though)
[ autoIt ]    ( ExpandCollapse - Popup )
#include <Array.au3> #include <File.au3> $script=FileOpenDialog("Choose script that will be fixed",@ScriptDir,"au3 (*.au3)") $autoitdir=FileSelectFolder("Autoit Include folder","") If $autoitdir="" Then Exit If $script="" Then Exit Global  $includelines, $scriptdata Global $includestoadd[1], $count=0 $scriptdata=FileRead($script) $includes=_FileListToArray($autoitdir,"*Constants*.au3") For $i=1 To Ubound($includes)-1     _FileReadToArray($autoitdir&"\"&$includes[$i],$includelines)     For $j=1 To Ubound($includelines)-1         If StringLeft($includelines[$j],12)="Global Const" Then             $const=StringMid($includelines[$j],StringInStr($includelines[$j],"$"),StringInStr($includelines[$j],'=')-StringInStr($includelines[$j],"$")-1)             If StringInStr($scriptdata,$const) Then                 _ArrayAdd($includestoadd,$includes[$i])                 ExitLoop             EndIf                     EndIf     Next Next For $a=1 To UBound($includestoadd)-1     If StringInStr($scriptdata,"#include <"&$includestoadd[$a]&">")=0 And StringInStr($scriptdata,"#include<"&$includestoadd[$a]&">")=0 And $includestoadd[$a]<>"GUIConstants.au3" Then         _FileWriteToLine($script,1,"#include <"&$includestoadd[$a]&">")         $count+=1     EndIf Next MsgBox(0,"Result",$count&" include(s) were added")

0

#4 User is offline   Zedna 

  • AutoIt rulez!
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 6,249
  • Joined: 17-June 05
  • Location:Czech republic

Posted 10 May 2008 - 01:42 PM

Very handy tool for this migration process is Organize Includes from Xenobiologist
Link: http://www.autoitscript.com/forum/index.php?showtopic=55368

This post has been edited by Zedna: 10 May 2008 - 01:43 PM

0

#5 User is online   GEOSoft 

  • Mr. Nice Guy [ NOT!]
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 6,482
  • Joined: 08-December 03
  • Gender:Male
  • Location:Nanaimo, BC, Canada

Posted 16 May 2008 - 08:11 PM

View PostZedna, on May 10 2008, 05:42 AM, said:

Very handy tool for this migration process is Organize Includes from Xenobiologist
Link: http://www.autoitscript.com/forum/index.php?showtopic=55368

Too bad that doesn't work without Scite.
0

#6 User is offline   MattX 

  • Spammer!
  • PipPipPip
  • Group: Full Members
  • Posts: 224
  • Joined: 01-April 04

Posted 17 May 2008 - 12:13 AM

Odd why now lines in a script of mine like this: ( problem lies around $icon16= )

[ code='text' ]    ( Popup )
#include <GUIConstantsEx.au3> $Form1 = GUICreate("Edugeek's Admin's Admin Bar 1.7.1", 465, 160, 64, 34) $helpmenu = GUICtrlCreateMenu("Help") $support_sites_menu = GUICtrlCreateMenu("Support Sites") $infoitem = GUICtrlCreateMenuItem("About", $helpmenu) $infoitem2 = GUICtrlCreateMenuItem("Support Sites", $support_sites_menu) GUISetBkColor(0x0066FF) $Icon16 = GUICtrlCreateIcon(@SystemDir & "\eventvwr.exe", 0, 380, 7, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP)) GUICtrlCreateLabel("Event", 381, 35) GUICtrlCreateLabel("Viewer", 381, 48) GUICtrlSetTip(-1, "Launch Event Viewer")


Is showing errors:

C:\COOL\test.au3(10,94) : WARNING: $SS_NOTIFY: possibly used before declaration.
$Icon16 = GUICtrlCreateIcon(@SystemDir & "\eventvwr.exe", 0, 380, 7, 32, 32, BitOR($SS_NOTIFY,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\COOL\test.au3(10,105) : WARNING: $WS_GROUP: possibly used before declaration.
$Icon16 = GUICtrlCreateIcon(@SystemDir & "\eventvwr.exe", 0, 380, 7, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~^
C:\COOL\test.au3(10,94) : ERROR: $SS_NOTIFY: undeclared global variable.
$Icon16 = GUICtrlCreateIcon(@SystemDir & "\eventvwr.exe", 0, 380, 7, 32, 32, BitOR($SS_NOTIFY,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\COOL\test.au3 - 1 error(s), 2 warning(s)

I have put in the new #include <GUIConstantsEx.au3> but why the variable errors when it worked ok before ?
0

#7 User is offline   monoceres 

  • In Soviet Russia, titles keep you!
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 3,088
  • Joined: 04-June 07
  • Gender:Male
  • Location:Sweden för bövelen

Posted 17 May 2008 - 07:36 AM

You need additional constants, please test my script above :)
0

#8 User is offline   MattX 

  • Spammer!
  • PipPipPip
  • Group: Full Members
  • Posts: 224
  • Joined: 01-April 04

Posted 17 May 2008 - 08:50 AM

View Postmonoceres, on May 17 2008, 07:36 AM, said:

You need additional constants, please test my script above :)


I ran your excellent script against mine and it stated it didn't need any additional constants...
0

#9 User is offline   i542 

  • Welcome back; your last visit was: Jan 18 2009, 06:57 PM
  • PipPipPipPipPipPip
  • Group: Full Members
  • Posts: 1,816
  • Joined: 13-August 05
  • Location:MSN Messenger

Posted 17 May 2008 - 09:21 AM

You need to add #include <WindowsConstants.au3> :)
0

#10 User is offline   monoceres 

  • In Soviet Russia, titles keep you!
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 3,088
  • Joined: 04-June 07
  • Gender:Male
  • Location:Sweden för bövelen

Posted 17 May 2008 - 05:46 PM

You also need:
#include <StaticConstants.au3>

Ps. tested fixing your script with my script, it worked fine. Sure you specified the include folder in the autoit folder?
0

#11 User is offline   1bobby 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 50
  • Joined: 19-January 07
  • Location:Jupiter

Posted 19 May 2008 - 05:31 PM

View PostJon, on May 10 2008, 04:28 AM, said:

In v3.2.12.0 a number of changes were made to the include files used for the GUI:
  • GUIConstants.au3 is identical to GUIConstantsEx.au3. This means that many scripts using advanced GUI functionality will need to use additional #include statements to include files containing constants that were previously and erroneously included.
  • GUIDefaultConstants.au3 no longer exists. You must now #include the corresponding individual constants file for the control type you need.

Needs some more detail, and maybe a step by step guide of how to convert a couple of scripts - please reply to this thread with suggestions/drafts of how this post should look and I'll update. This is to help with the inevitable flood of questions when 3.2.12.0 is released.

0

#12 User is offline   1bobby 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 50
  • Joined: 19-January 07
  • Location:Jupiter

Post icon  Posted 19 May 2008 - 07:17 PM

Monoceres, that is a GREAT script, once I figured it out. Love it. Ran two scripts and it sure bailed me out. Wish I could think that fast, but it works great. Thanks for your efforts for us new kids on the block. bobby
:party: You the coder!
0

#13 User is offline   monoceres 

  • In Soviet Russia, titles keep you!
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 3,088
  • Joined: 04-June 07
  • Gender:Male
  • Location:Sweden för bövelen

Posted 19 May 2008 - 07:46 PM

View Post1bobby, on May 19 2008, 08:17 PM, said:

Monoceres, that is a GREAT script, once I figured it out. Love it. Ran two scripts and it sure bailed me out. Wish I could think that fast, but it works great. Thanks for your efforts for us new kids on the block. bobby
:party: You the coder!


Thanks :)
It sure has helped me out a lot as well ;)
0

#14 User is offline   mdwerne 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 85
  • Joined: 11-April 07
  • Gender:Male
  • Location:NM, USA

Posted 20 May 2008 - 09:02 PM

Hello,

Not 100% sure this is relative to this post, but my problem has cropped up since switching to 3.2.12 and I am getting similar errors.

C:\Documents and Settings\mdwerne\Desktop\AutoIt Scripts\PrevMaintLite\Test.au3(8,119) : WARNING: $STDOUT_CHILD: possibly used before declaration.
$dsqOut = Run(@ComSpec & " /c dsquery computer domainroot -name " & @ComputerName, @SystemDir, @SW_HIDE, $STDOUT_CHILD)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\mdwerne\Desktop\AutoIt Scripts\PrevMaintLite\Test.au3(8,119) : ERROR: $STDOUT_CHILD: undeclared global variable.
$dsqOut = Run(@ComSpec & " /c dsquery computer domainroot -name " & @ComputerName, @SystemDir, @SW_HIDE, $STDOUT_CHILD)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\mdwerne\Desktop\AutoIt Scripts\PrevMaintLite\Test.au3 - 1 error(s), 1 warning(s)

I added all the includes below, and while my error above went away (by adding constants.au3), my dsquery is now blank.

Any thoughts?

Thanks, Mike

P.S. If it's not obvious, I'm still pretty new to scripting with AutoIt. Slowly trying to get better.

[ code='text' ]    ( ExpandCollapse - Popup )
;#include <constants.au3> #include <GUIConstants.au3> ;#include <GUIConstantsEx.au3> ;#include <WindowsConstants.au3> ;#include <StaticConstants.au3> Global $dsqOut, $OU $dsqOut = Run(@ComSpec & " /c dsquery computer domainroot -name " & @ComputerName, @SystemDir, @SW_HIDE, $STDOUT_CHILD) $OU = StdoutRead($dsqOut) GUICreate("PML ", 500, 400) $GROUP_1 = GUICtrlCreateGroup("Computer", 15, 10, 475, 157) $LABEL_1 = GUICtrlCreateLabel("Computer Name:", 25, 30, 80, 20) $INPUT_1 = GUICtrlCreateInput(@ComputerName, 110, 25, 75, 20) $INPUT_2 = GUICtrlCreateInput($OU, 25, 95, 450, 20) $Quit = GUICtrlCreateButton("Quit", 100, 300, 60, 50) GUISetState() While 1     $msg = GUIGetMsg()     Select         Case $msg = $GUI_EVENT_CLOSE             ExitLoop         Case $msg = $Quit             ExitLoop     EndSelect WEnd

0

#15 User is online   GEOSoft 

  • Mr. Nice Guy [ NOT!]
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 6,482
  • Joined: 08-December 03
  • Gender:Male
  • Location:Nanaimo, BC, Canada

Posted 20 May 2008 - 10:00 PM

Change $STDOUT_CHILD to 2
0

#16 User is offline   mdwerne 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 85
  • Joined: 11-April 07
  • Gender:Male
  • Location:NM, USA

Posted 20 May 2008 - 10:25 PM

View PostGEOSoft, on May 20 2008, 03:00 PM, said:

Change $STDOUT_CHILD to 2


Thank you, that resolved the error I was getting without having constants.au3 included.

But for some reason my dsquery still comes up blank?

From a command line I'm getting a result, but for some reason the query is not making it back into the script. $INPUT_2 is blank.

Again, thank you for the optional handle to $STDOUT_CHILD.

-Mike
0

#17 User is offline   mdwerne 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 85
  • Joined: 11-April 07
  • Gender:Male
  • Location:NM, USA

Post icon  Posted 20 May 2008 - 11:50 PM

View Postmdwerne, on May 20 2008, 03:25 PM, said:

Thank you, that resolved the error I was getting without having constants.au3 included.

But for some reason my dsquery still comes up blank?

From a command line I'm getting a result, but for some reason the query is not making it back into the script. $INPUT_2 is blank.

Again, thank you for the optional handle to $STDOUT_CHILD.

-Mike


Problem resolved!!!

After searching the forums I found this answer by Valik: http://www.autoitscript.com/forum/index.php?showtopic=16098

Bottomline, I added "ProcessWaitClose($dsqOut)" and all is well again. Not sure why 3.2.10 worked and 3.2 12 didn't, but oh well. It' s fixed.

-Mike
0

#18 User is offline   Andy007 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 24
  • Joined: 16-May 08
  • Location:Sydney, Australia

Post icon  Posted 21 May 2008 - 12:38 AM

Hi All,

Newbie alert...

I installed v3.2.10.0 the other day and then noticed the newer version, so installed that (removing the old one first).

I was able to run the clock.au3 (C:\Program Files\AutoIt3\Examples\GUI\Advanced\Clock.au3) in previous version but not now.

Can someone tell me how to make the changes to get it to work. I want to show the boss some of the things that can be done...

Any help will be appreciated. :)

This post has been edited by Andy007: 21 May 2008 - 12:40 AM

0

#19 User is offline   mdwerne 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 85
  • Joined: 11-April 07
  • Gender:Male
  • Location:NM, USA

Posted 21 May 2008 - 02:48 AM

View PostAndy007, on May 20 2008, 05:38 PM, said:

Hi All,

Newbie alert...

I installed v3.2.10.0 the other day and then noticed the newer version, so installed that (removing the old one first).

I was able to run the clock.au3 (C:\Program Files\AutoIt3\Examples\GUI\Advanced\Clock.au3) in previous version but not now.

Can someone tell me how to make the changes to get it to work. I want to show the boss some of the things that can be done...

Any help will be appreciated. :)


As I am in the noob boat too, take my suggestion with a grain of salt.

I added this:

#include <WindowsConstants.au3>

and commented out this:

;Global Const $ULW_ALPHA = 2

Works for me!

-Mike
0

#20 User is offline   Andy007 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 24
  • Joined: 16-May 08
  • Location:Sydney, Australia

Posted 21 May 2008 - 03:22 AM

Thanks Mike.

That worked. I just assumed it should have been fine in the first place being a sample au3 script that was installed during the setup.
0

  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users