Sign in to follow this  
Followers 0
GEOSoft

AutoItSetOptions Builder

14 posts in this topic

#1 ·  Posted (edited)

Just extract the 2 files to the same folder.

The script creates the AutoItSetOption (Opt) code and places it on the clipboard.

This is actually extracted from a function that I use in Project Express and then converted to be a stand-alone GUI.

A couple of notes:

1) If the option is one that requires a string value to be added there will be a preview button available. The only way to refresh the preview at the bottom is to click the button. However if you click Copy then the output code will still be correct and the preview will update then anyway.

2) If you want to create nore than 1 Opt then just create the first, click "Copy" and then repeat for each OPt that you want to create. They will all be on the clipboard as separate lines.

Here is the code but you will still have to extract the dat file from the attached Zip file.

;;This AutoIt script file was generated by Project Express  v3.9.0.20 Nov 15 / 2006
;;Compiler Version:         3.2.1.12
;;Language:     English (US)
;;Platform:         All
;Author:        GEOSoft
;;
;;Project Name:         AutoItSetOption
;;Project Description:  GUI For creating the AutoItSetOption or Opt lines
;;                                              NOTE: More than 1 option can be created in the same session by creating the first, click "Copy",
;;                                              create the second, click copy Etc & Etc
;;                                              Each Line is added to the clipboard.
;;                                              ANOTHER NOTE: If the the preview button is visible then you will have to click it to refresh the preview line however the
;;                                              copied code will still be correct without the refresh.  The preview button is visible on Opts that require user input eg: OnExitFunc
;;To Do List:
;;
;;
Opt ("TrayIconDebug", 1)
Opt ("GUICoordMode", 2)
Local $Gw = 600, $Gh = 320, $Dat_File = @ScriptDir & '\Opts.dat',$Disp_Txt = '', $Tab_Chr = '   ', $C_Data = '', $Def = ''
$Opts_Data = '#NoTrayIcon|CaretCoordMode|ColorMode|ExpandEnvStrings|ExpandVarStrings|FtpBinaryMode|GUICloseOnESC|' & _
      'GUICoordMode|GUIDataSeparatorChar|GUIEventOptions|GUIOnEventMode|GUIResizeMode|MouseClickDelay|MouseClickDownDelay|' & _
      'MouseClickDragDelay|MouseCoordMode|MustDeclareVars|OnExitFunc|PixelCoordMode|RunErrorsFatal|SendAttachMode|SendCapslockMode|' & _
      'SendKeyDelay|SendKeyDownDelay|TCPTimeout|TrayAutoPause|TrayIconDebug|TrayIconHide|TrayMenuMode|TrayOnEventMode|' & _
      'WinDetectHiddenText|WinSearchChildren|WinTextMatchMode|WinTitleMatchMode|WinWaitDelay'
ClipPut('') ;; Clear the clipboard and get ready for action
$Form_Opts = GUICreate(' AutoIt Options',$Gw,$Gh)
$Lbl_Opts = GUICtrlCreateLabel('Select the AutoIt Option', 40, 10, 120, 20)
$Combo_Opts = GUICtrlCreateCombo('', 0, -1, 180, 160)
GUICtrlSetFont($Combo_Opts, 9, 400, -1, "")
GUICtrlSetData($Combo_Opts, $Opts_Data, '#NoTrayIcon')
$Lbl_Value = GUICtrlCreateLabel('Value', 10, -1, 40, 20)
$Combo_Val = GUICtrlCreateCombo('', 0, -1, 40, 100, 259)
$In_Val = GUICtrlCreateInput('', -1, -1, 100, 20, 129)
GUICtrlSetState($In_Val, 160)
GUICtrlSetTip ( $In_Val,'Enter the value that you want to use for the option.', 'Value', 1, 3)
$Btn_Preview = GUICtrlCreateButton('Preview',10,-1,60,20)
GUICtrlSetTip ( $Btn_Preview,'Use to update the preview display.', 'Preview', 1, 3)
GUICtrlSetState($Btn_Preview, 160)
GuiSetCoord($Gw/2-100,50)
$Lbl_Style = GUICtrlCreateLabel('Style',-1,-1,40,20)
$Radio_Style1 = GUICtrlCreateRadio('AutoItSetOption',0,-1,100,20)
$Radio_Style2 = GUICtrlCreateRadio('Opt',10,-1,40)
GuiCtrlSetState($Radio_Style2,1)
GUISetCoord(10,80)
$Lbl_Description = GUICtrlCreateLabel('',-1,-1,$Gw-20,$Gh- 150)
GUICtrlSetFont($Lbl_Description, 9, 400)
$Lbl_Out = GUICtrlCreateLabel('',-($Gw-20),10,$Gw-20,20,0x01)
GUICtrlSetTip ( $Lbl_Out,'NOTE:  If the "Refresh" button is available then' & @CRLF & ' you will have to use it to refresh this display.', 'Preview', 1, 3)
GUICtrlSetFont($Lbl_Out, 10, 400)
GuiCtrlSetBkColor($Lbl_Out,0xfafca0)
GUISetCoord($Gw/2-70,$Gh - 30)
$Btn_Build = GUICtrlCreateButton ('Build It',-1,-1,60,20)
GUICtrlSetTip ( $Btn_Build,'Copy the AutoIt option to the clipboard', 'Build It', 1, 3)
$Btn_Exit = GuiCtrlCreateButton ('Exit',20,-1)
$Txt = StringSplit(FileReadLine($Dat_File,1),'~')

For $I = 4 To $Txt[0]
   $Disp_Txt = $Disp_Txt & $Txt[$I] & @CRLF
   If $I > 1 Then $Disp_Txt = $Disp_Txt
Next

GUICtrlSetData($Lbl_Description,$Disp_Txt)
GUICtrlSetData($Lbl_Out,$Txt[1])

For $I = $Lbl_Value To $Radio_Style2
   GUICtrlSetState($I,128)
Next

GUISetState()

While 1
   $Index = GetCurSel($Combo_Opts)
   $Out_Value = GUICtrlRead($Combo_Val) & GUICtrlRead($In_Val)
   If GuiCtrlRead($Radio_Style2) = 1 Then
      $Style = 'Opt ('
   Else
      $Style = 'AutoItSetOption ('
   EndIf
   $Msg = GuiGetMsg()

   Select
      Case $Msg = $Combo_Opts
         $Disp_Txt = ''
         $C_Data = ''
         $Def = ''
         GuiCtrlSetData($Combo_Val,'|')
         $Txt = StringSplit(FileReadLine($Dat_File,$Index +1),'~')
         $Def = $Txt[3]

         For $I = 4 To $Txt[0]
            $Disp_Txt = $Disp_Txt & $Txt[$I] & @CRLF
         Next

         $Disp_Txt = StringReplace($Disp_Txt,'{}',$Tab_Chr)
         GUICtrlSetData($Lbl_Description,$Disp_Txt)

         Select
            Case $Index = 0 ;; It's "#NoTrayIcon" so there are no options and we disable the option controls.

               For $I = $Lbl_Value To $Radio_Style2
                  GUICtrlSetState($I,128)
               Next

               GUICtrlSetData($Lbl_Out,$Txt[1])
            Case Else
               $Txt[1] = Chr(34) & $Txt[1] & Chr(34)
               If GUICtrlGetState($Lbl_Value) = 144 Then

                  For $I = $Lbl_Value To $Radio_Style2
                     If $I <> $Combo_Val Then GUICtrlSetState($I,64)
                  Next

               EndIf
               GUICtrlSetData($Lbl_Out,$Style & $Txt[1] & ', ' & $Out_Value & ')')
               If $Txt[2] = '1' Then
                  GUICtrlSetState($Combo_Val,160)
                  GUICtrlSetState($In_Val,80)
                  GUICtrlSetState($Btn_Preview,80)
                  GUICtrlSetData($In_Val,StringReplace($Def,Chr(34),''));; Remove quotes from $Def to make the control easier to read
                  GUICtrlSetState($In_Val,256)
                  GUICtrlSetData($Combo_Val,'')
                  GUICtrlSetData($Lbl_Out,$Style & $Txt[1] & ', ' & $Def & ')')
                  ContinueLoop
               Else
                  If GUICtrlGetState($Combo_Val) <> 80 Then
                     GUICtrlSetState($In_Val,160)
                     GUICtrlSetData($In_Val, '')
                     GUICtrlSetState($Btn_Preview,160)
                     GUICtrlSetState($Combo_Val,80)
                  EndIf
                  If $Txt[2] = '2' Then
                     If $Index = 32 Then;;  WinTextMatchMode needs special handling
                        $C_Data = '1|2'
                     Else
                        $C_Data = '0|1|'
                     EndIf
                  ElseIf $Txt[2] = 3 Then
                     $C_Data = '0|1|2'
                  ElseIf $Txt[2] = '4' Then
                     $C_Data = '1|2|3|4'
                  EndIf
                  GUICtrlSetData($Combo_Val,$C_Data,$Def)
                  GUICtrlSetData($Lbl_Out,$Style & $Txt[1] & ', ' & $Def & ')')
                  GuiCtrlSetState($Combo_Val,256)
               EndIf
         EndSelect

      Case $Msg = $Radio_Style1 Or $Msg = $Radio_Style2
         If $Index <> 0 Then
            GUICtrlSetData($Lbl_Out,$Style & $Txt[1] & ', ' & $Out_Value & ')')
         Else
            GUICtrlSetData($Lbl_Out,$Txt[1])
         EndIf
      Case $Msg = $Combo_Val
         GUICtrlSetData($Lbl_Out,$Style & $Txt[1] & ', ' & $Out_Value & ')')
      Case $Msg = $Btn_Preview
         If $Index = 10 And (GuiCtrlRead( $In_Val) < 0 OR GuiCtrlRead( $In_Val) > 1023) Then;; An invalid entry was used for GUIResizeMode
            MsgBox ( 262192, 'Invalid Parameter', 'The value must be between 0 and 1023.' & @CRLF & 'Please enter a new value.')
            GUICtrlSetData($Lbl_Out,$Style & $Txt[1] & ', ' & $Def & ')')
            GUICtrlSetData($In_Val, $Def)
            GUICtrlSetState($In_Val, 256)
         ElseIf $Index = 8 OR $Index = 17 Then ;; These 2 need to be quoted
            $Out_Value = StringStripWS($Out_Value, 8);; in case of accidental spaces
            ;; If the user entered more than just the function name for OnExitFunc then remove the extra portion of the string
            If StringInStr($Out_Value,'(') Then $Out_Value = StringLeft($Out_Value,StringInStr($Out_Value,'(')-1)
            $Out_Value = Chr(34) & $Out_Value & Chr(34)
            $Out_Value = StringReplace($Out_Value, Chr(34) & Chr(34),Chr(34)); In case the user entered quotes already
            $Out_Value = StringReplace($Out_Value, Chr(39),''); In case the user entered single quotes
         EndIf
         GUICtrlSetData($Lbl_Out,$Style & $Txt[1] & ', ' & $Out_Value & ')')
      Case $Msg = -3 Or $Msg = $Btn_Exit
         Exit
      Case $Msg = $Btn_Build
         If $Index = 10 And (GuiCtrlRead( $In_Val) < 0 OR GuiCtrlRead( $In_Val) > 1023) Then;; An invalid entry was used for GUIResizeMode
            MsgBox ( 262192, 'Invalid Parameter', 'The value must be between 0 and 1023.' & @CRLF & 'Please enter a new value.')
            GUICtrlSetData($Lbl_Out, $Style & $Txt[1] & ', ' & $Def & ')')
            GUICtrlSetData($In_Val, $Def)
            GUICtrlSetState($In_Val, 256)
            ContinueLoop
         EndIf
         If $Txt[2] = '1' Then GUICtrlSetData($Lbl_Out,$Style & $Txt[1] & ', ' & $Out_Value & ')')
         If ClipGet() = '' Then
            ClipPut(GuiCtrlRead($Lbl_Out))
         Else
            ClipPut(ClipGet() & @CRLF & GuiCtrlRead($Lbl_Out))
         EndIf
   EndSelect

Wend

Func GetCurSel($H_Combobox)
   If IsHWnd ($H_Combobox) Then
      Local $A_Ret = DllCall ("user32.dll", "int", "SendMessage", "hwnd", $H_Combobox, "int", 0x147, "int", 0, "int", 0)
      Return $A_Ret[0]
   Else
      Return GUICtrlSendMsg ($H_Combobox, 0x147, 0, 0)
   EndIf
EndFunc   ;<==> GetCurSel($h_combobox)
;;============= End of Script ============

Edited for code error and new zip file

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites



Great Idea, I will have to check this later. I do hate looking them up.

Thanks


[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

I had to change the script a little to get it to work. However I like it a lot. Very useful when using options.


My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I had to change the script a little to get it to work. However I like it a lot. Very useful when using options.

What changes did you have to make? I didn't spend much time with the stand alone but it's working fine in Project Express. Really interested in your changes though. I'm starting Ver 4 of PX so I want to re-write a lot of the functions for speed, size &etc.

I just found 2 copy?paste errors in it. Lines 153 and 170

GUICtrlSetData($Lbl_Out,($Lbl_Out,$Style & $Txt[1] & ', ' & $Def & ')')oÝ÷ Ù(hºW[y«­¢+ÙU%
ÑɱMÑÑ ÀÌØí1±}=ÕаÀÌØíMÑå±µÀìÀÌØíQáÑlÅtµÀìÌäì°ÌäìµÀìÀÌØíµÀìÌäì¤Ìäì

I'll chang it on the original post now and then replace the Zip file in a while.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

I had to change the script a little to get it to work. However I like it a lot. Very useful when using options.

yeah what did you change because there is so much wrong with it

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

yeah what did you change because there is so much wrong with it

I just posted the corrected version but ideas are welcome.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Looks good. but is it supposed to be "0100" for "0" and "1100" for "1"???


[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

Using Scite Editor,

I personally type

options <then press spacebar> List them all, commented out

unremark the ones i need, delete the rest at tidy time.

what could be easier.

HardCopy


Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

Share this post


Link to post
Share on other sites

Looks good. but is it supposed to be "0100" for "0" and "1100" for "1"???

No. I had that error twice and both times it was when I was running it with Scite. If I just run the file it's fine. I am going to take a look at it though, just in case. I might even try running PX with Scite to see what happens then. I rarely use Scite so I'm not sure if it has issues with some code or not. And NO I am not anti-Scite, I just don't use it although I do have the opion in PX to Edit AutoIt files with Scite. I generally only use my default editor because I can work with several different file types at one time. Using PX I can open an entire project at the same time including the AutoIt script, patchfile, the CHM project and the setup script. Then close the editor and compile all of the project by selecting the right checkboxes and clicking one button. Result = a compiled AutoIt file, a compiled help file, a compiled patch file and a compiled setup package all archived and ready in less time than it takes to open each compiler separately. An AutoIt script of +- 6000 lines will take less than 30 seconds from click to ready for distribution so I think I'll stick with my existing system. I'll just keep adding to it. :whistle:

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Using Scite Editor,

I personally type

options <then press spacebar> List them all, commented out

unremark the ones i need, delete the rest at tidy time.

what could be easier.

HardCopy

That works fine using Scite but read my other reply.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

I like it!!! good job!!!

Ed

Thanks @Ed_Maximized. Because of the need to make it a stand alone script, I had to make some mods to remove references to variables already declared in PX and a function call to another PX function there are a couple of minor issues. I have them sorted out but I want to test it a bit more before posting the corrected code again. If you want to correct your copy of the script then make the following changes for now.

Line 82

Change

GuiCtrlSetData($Combo-Val, '')oÝ÷ Ù:ºÚ"µÍÝZPÝÙ]]J ÌÍÐÛÛX×Õ[    ÌÎNß ÌÎNÊ
Hope this helps. I'll be posting the corrected script later.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

The new code has been uploaded along with a new zip. See the first post. I recommend that you use the zip file since I made some changes to Opts.dat.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Looks good. but is it supposed to be "0100" for "0" and "1100" for "1"???

This problem appears to be gone from the latest version.

Try downloading the new zip file


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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