rm4453

File Open Keeps Repeating Itself.

2 posts in this topic

#1 ·  Posted (edited)

I have a problem with my code where the File Open keeps opening itself... This gui is not fully functional. I am trying to allow the user to select an image for each of the image buttons, when they do all I want to grab is the full file path ex: C:\windows\user\username\images\image.jpg to a variable. "I am just diving into guis myself and have used Koda for most of this form generation. The custom code I have either written myself " most of it " or got help for it on here or the help files. I have searched for at least an hour now and can't seem to figure out what is causing the infinite loop where the file open box continually opens... I am sure its something simple like changing the state of the button that was clicked back to not clicked however I can't figure out how to do that or if that is even the answer... Here is all of the code I can share "This is an NDA project so I will have to take some parts out that are non pertinent etc...."  (ANY * are edits to protect the NDA any missing lines are as well.... :D)

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <***Login.au3>

$section = "Test"
$Item_Wanted = "false"
$For_Sale = "true"
$Business_Listing = "false"
$Private_Listing = "true"
$Posts = 0
$Submit = 0
$SaveListingSettings = 0
$Image1_Description = 0
$Image2_Description = 0
$Image3_Description = 0
$Image4_Description = 0
$Image5_Description = 0
$Image6_Description = 0
$Description1 = 0
$Description2 = 0
$Description3 = 0
$Description4 = 0
$Image1_Pressed = 0

; AutoItSetOption ("GUIOnEventMode", 1)

Func ReadIni()

;Login Info
Global $Email_ini = IniRead("Settings.ini", $section, "Email", "Email")
Global $Password_ini = IniRead("Settings.ini", $section, "Password", "Password")

;Listing Info
Global $Price_ini = IniRead("Settings.ini", $section, "Price", "0")
Global $Title_ini = IniRead("Settings.ini", $section, "Title", "Title Example")

  ;Listing Type
Global $For_Sale_ini = IniRead("Settings.ini", $section, "For_Sale", "True")
Global $Item_Wanted_ini = IniRead("Settings.ini", $section, "Item_Wanted", "False")

If $For_Sale_ini = "false" Then
    GUICtrlSetState($Item_Wanted, 1)
Else
    If $For_Sale_ini = "true" Then
        GUICtrlSetState($For_Sale, 1)
    EndIf
EndIf


  ;Business Or Private
Global $Business_Listing_ini = IniRead("Settings.ini", $section, "Business_Listing", "False")
Global $Private_Listing_ini = IniRead("Settings.ini", $section, "Private_Listing", "True")

If $Private_Listing_ini = "false" Then
    GUICtrlSetState($Business_Listing, 1)
Else
    If $Private_Listing_ini = "true" Then
        GUICtrlSetState($Private_Listing, 1)
    EndIf
EndIf


  ;Image FilePaths and Descriptions
Global $Image1_ini = IniRead("Settings.ini", $section, "Image1", "C:\image1.jpg")
Global $Image1_Description_ini = IniRead("Settings.ini", $section, "Image1_Description", "Default Descrip")
Global $Image2_ini = IniRead("Settings.ini", $section, "Image2", "C:\image2.jpg")
Global $Image2_Description_ini = IniRead("Settings.ini", $section, "Image2_Description", "Default Descrip")
Global $Image3_ini = IniRead("Settings.ini", $section, "Image3", "C:\image3.jpg")
Global $Image3_Description_ini = IniRead("Settings.ini", $section, "Image3_Description", "Default Descrip")
Global $Image4_ini = IniRead("Settings.ini", $section, "Image4", "C:\image4.jpg")
Global $Image4_Description_ini = IniRead("Settings.ini", $section, "Image4_Description", "Default Descrip")
Global $Image5_ini = IniRead("Settings.ini", $section, "Image5", "C:\image5.jpg")
Global $Image5_Description_ini = IniRead("Settings.ini", $section, "Image5_Description", "Default Descrip")
Global $Image6_ini = IniRead("Settings.ini", $section, "Image6", "C:\image6.jpg")
Global $Image6_Description_ini = IniRead("Settings.ini", $section, "Image6_Description", "Default Descrip")

  ;Listing Descriptions
Global $Description1_ini = IniRead("Settings.ini", $section, "Description1", "Default Descrip")
Global $Description2_ini = IniRead("Settings.ini", $section, "Description2", "Default Descrip")
Global $Description3_ini = IniRead("Settings.ini", $section, "Description3", "Default Descrip")
Global $Description4_ini = IniRead("Settings.ini", $section, "Description4", "Default Descrip")

  ;Contact Info
Global $Phone1_ini = IniRead("Settings.ini", $section, "Phone1", "888")
Global $Phone2_ini = IniRead("Settings.ini", $section, "Phone2", "999")
Global $Phone3_ini = IniRead("Settings.ini", $section, "Phone3", "9090")
Global $Address_ini = IniRead("Settings.ini", $section, "Address", "491 S 231 E")
Global $City_ini = IniRead("Settings.ini", $section, "City", "Sandy")
Global $State_ini = IniRead("Settings.ini", $section, "State", "WA")
Global $Zip_ini = IniRead("Settings.ini", $section, "Zip", "84119")

  ;Post Interval in Minutes
Global $Post_Interval_In_Minutes_ini = IniRead("Settings.ini", $section, "Post_Interval_In_Minutes", "10")

EndFunc

Func Gui()
$***AutoPoster = GUICreate("*** Auto Poster", 615, 437, 340, 172)
$LoginInfo = GUICtrlCreateGroup("Login Info", 8, 8, 177, 113)
$Submit = GUICtrlCreateButton("Submit", 58, 84, 75, 25)


GUICtrlSetTip(-1, "Verify Login Information")
Global $Email = GUICtrlCreateInput($Email_ini, 23, 31, 145, 21)
GUICtrlSetTip(-1, "*** Email")
Global $Password = GUICtrlCreateInput($Password_ini, 23, 57, 145, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
GUICtrlSetTip(-1, "*** Password")
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $ListingInfo = GUICtrlCreateGroup("Listing Info", 200, 8, 401, 417)
Global $Price = GUICtrlCreateInput($Price_ini, 232, 40, 137, 21)
GUICtrlSetTip(-1, "Asking Price For Listing")
Global $Title = GUICtrlCreateInput($Title_ini, 232, 72, 137, 21)
GUICtrlSetTip(-1, "Title Of Listing")
Global $ListingType = GUICtrlCreateGroup("Listing Type", 376, 24, 193, 81)
Global $For_Sale = GUICtrlCreateRadio("For Sale", 384, 39, 193, 21)
GUICtrlSetTip(-1, "Is Item For Sale")
Global $Item_Wanted = GUICtrlCreateRadio("Item Wanted", 384, 71, 193, 21)
GUICtrlSetTip(-1, "Are You Looking For Item")
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Business_or_Private = GUICtrlCreateGroup("Business or Private", 232, 112, 337, 65)
Global $Business_Listing = GUICtrlCreateRadio("Business Listing", 248, 136, 137, 25)
GUICtrlSetTip(-1, "Is This A Business Listing")
Global $Private_Listing = GUICtrlCreateRadio("Private Listing", 408, 136, 137, 25)
GUICtrlSetTip(-1, "Is This A Private Listing")
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $ContactInfo = GUICtrlCreateGroup("Contact Info", 232, 312, 337, 73)
Global $Phone1 = GUICtrlCreateInput($Phone1_ini, 237, 330, 33, 21)
GUICtrlSetTip(-1, "Phone Number Area Code")
Global $Phone3 = GUICtrlCreateInput($Phone3_ini, 317, 330, 33, 21)
GUICtrlSetTip(-1, "Last 4 Numbers Of Phone Number")
Global $Phone2 = GUICtrlCreateInput($Phone2_ini, 277, 330, 33, 21)
GUICtrlSetTip(-1, "First 3 Numbers Of Phone Number")
Global $Address = GUICtrlCreateInput($Address_ini, 360, 328, 201, 21)
GUICtrlSetTip(-1, "Address For Listing")
Global $City = GUICtrlCreateInput($City_ini, 360, 352, 49, 21)
GUICtrlSetTip(-1, "City For Listing")
Global $State = GUICtrlCreateInput($State_ini, 416, 352, 97, 21)
GUICtrlSetTip(-1, "State For Listing (Only Use Abrieviations)")
Global $Zip = GUICtrlCreateInput($Zip_ini, 520, 352, 41, 21)
GUICtrlSetTip(-1, "Zip Code For Listing")
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $SaveListingSettings = GUICtrlCreateButton("Save Listing Settings", 456, 392, 114, 25)


GUICtrlSetTip(-1, "Save Listing Settings")
Global $Post_Interval_In_Minutes = GUICtrlCreateInput($Post_Interval_In_Minutes_ini, 232, 392, 209, 21)
GUICtrlSetTip(-1, "How Often Program Should Auto Post (Will Be Randomized Somewhat For Validity)")
Global $Description1_Button = GUICtrlCreateButton($Description1_ini, 232, 189, 145, 49)


Global $Description2_Button = GUICtrlCreateButton($Description2_ini, 426, 189, 145, 49)


Global $Description3_Button = GUICtrlCreateButton($Description3_ini, 232, 252, 145, 49)


Global $Description4_Button = GUICtrlCreateButton($Description4_ini, 426, 252, 145, 49)


GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Select_Images = GUICtrlCreateGroup("Select Images", 8, 136, 177, 89)
Global $Image1 = GUICtrlCreateButton($Image1_ini, 16, 160, 41, 25)


Global $Image2 = GUICtrlCreateButton($Image2_ini, 69, 160, 41, 25)


Global $Image3 = GUICtrlCreateButton($Image3_ini, 128, 160, 41, 25)


Global $Image4 = GUICtrlCreateButton($Image4_ini, 17, 192, 41, 25)


Global $Image5 = GUICtrlCreateButton($Image5_ini, 69, 192, 41, 25)


Global $Image6 = GUICtrlCreateButton($Image6_ini, 129, 192, 41, 25)


GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $PostCounter = GUICtrlCreateGroup("Post Counter", 8, 240, 177, 65)
Global $TotalPosts = GUICtrlCreateLabel("Total Posts", 32, 267, 57, 18)
Global $PostCount = GUICtrlCreateLabel($Posts, 104, 267, 50, 18)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $ListingSelection = GUICtrlCreateGroup("Listing Selection", 8, 312, 177, 113)
Global $SelectListing = GUICtrlCreateButton("Select Listing", 24, 336, 145, 33)


Global $BeginSubmission = GUICtrlCreateButton("Begin Submission", 24, 376, 145, 33)


GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
EndFunc


Func OpenImages()
    $message = "Please Find and Select Your Image."
    $var = FileOpenDialog($message, @WindowsDir & "\", "Images (*.jpg;*.gif)")
    FileChangeDir(@ScriptDir)
    Global $imagePath = $var
    ;$filepathmsg = MsgBox("Path","Here is File Path", $imagePath)
EndFunc

$Save_Section = 1
Func SaveIni()
    IniWrite ( "Settings.ini", $Save_Section, "Email", GUICtrlRead($Email))
    IniWrite ( "Settings.ini", $Save_Section, "Password", GUICtrlRead($Password))
    IniWrite ( "Settings.ini", $Save_Section, "Price", GUICtrlRead($Price))
    IniWrite ( "Settings.ini", $Save_Section, "Title", GUICtrlRead($Title))
    IniWrite ( "Settings.ini", $Save_Section, "For_Sale", GUICtrlRead($For_Sale))
    IniWrite ( "Settings.ini", $Save_Section, "Item_Wanted", GUICtrlRead($Item_Wanted))
    IniWrite ( "Settings.ini", $Save_Section, "Business_Listing", GUICtrlRead($Business_Listing))
    IniWrite ( "Settings.ini", $Save_Section, "Private_Listing", GUICtrlRead($Private_Listing))
    IniWrite ( "Settings.ini", $Save_Section, "Image1", GUICtrlRead($Image1))
    IniWrite ( "Settings.ini", $Save_Section, "Image1_Description", GUICtrlRead($Image1_Description))
    IniWrite ( "Settings.ini", $Save_Section, "Image2", GUICtrlRead($Image2))
    IniWrite ( "Settings.ini", $Save_Section, "Image2_Description", GUICtrlRead($Image2_Description))
    IniWrite ( "Settings.ini", $Save_Section, "Image3", GUICtrlRead($Image3))
    IniWrite ( "Settings.ini", $Save_Section, "Image3_Description", GUICtrlRead($Image3_Description))
    IniWrite ( "Settings.ini", $Save_Section, "Image4", GUICtrlRead($Image4))
    IniWrite ( "Settings.ini", $Save_Section, "Image4_Description", GUICtrlRead($Image4_Description))
    IniWrite ( "Settings.ini", $Save_Section, "Image5", GUICtrlRead($Image5))
    IniWrite ( "Settings.ini", $Save_Section, "Image5_Description", GUICtrlRead($Image5_Description))
    IniWrite ( "Settings.ini", $Save_Section, "Image6", GUICtrlRead($Image6))
    IniWrite ( "Settings.ini", $Save_Section, "Image6_Description", GUICtrlRead($Image6_Description))
    IniWrite ( "Settings.ini", $Save_Section, "Description1", GUICtrlRead($Description1))
    IniWrite ( "Settings.ini", $Save_Section, "Description2", GUICtrlRead($Description2))
    IniWrite ( "Settings.ini", $Save_Section, "Description3", GUICtrlRead($Description3))
    IniWrite ( "Settings.ini", $Save_Section, "Description4", GUICtrlRead($Description4))
    IniWrite ( "Settings.ini", $Save_Section, "Phone1", GUICtrlRead($Phone1))
    IniWrite ( "Settings.ini", $Save_Section, "Phone2", GUICtrlRead($Phone2))
    IniWrite ( "Settings.ini", $Save_Section, "Phone3", GUICtrlRead($Phone3))
    IniWrite ( "Settings.ini", $Save_Section, "Address", GUICtrlRead($Address))
    IniWrite ( "Settings.ini", $Save_Section, "City", GUICtrlRead($City))
    IniWrite ( "Settings.ini", $Save_Section, "State", GUICtrlRead($State))
    IniWrite ( "Settings.ini", $Save_Section, "Zip", GUICtrlRead($Zip))
    IniWrite ( "Settings.ini", $Save_Section, "Post_Interval_In_Minutes", GUICtrlRead($Post_Interval_In_Minutes))
EndFunc


$GuiOpened = 1
$im = 1

While 1 = 1
    If $GuiOpened = 1 Then
        ReadIni()
        Gui()
        ReadIni()
        $GuiOpened = 2
    EndIf
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Submit
            $email = $Email_ini
            $pass = $Password_ini
            Login()
        Case $SaveListingSettings
            $Save_Section = InputBox("Listing Name", "Please Type The Name For Your Listing", "EXAMPLE: Blue Blanket")
            SaveIni()
        Case $Image1
            OpenImages()
            Global $Image1 = $imagePath
            Global $Image1_Description = GUICtrlCreateEdit("Image Description", 615, 437, 50, 40)

    EndSwitch
WEnd

 

Edited by rm4453
Code would not insert so I Posted Topic then added Code

Share this post


Link to post
Share on other sites



rm4453,

The first time you run the script, $Image1 is set the controlID of the button as intended - thus the Switch functions correctly. However, as soon as that button fires, you run the OpenImages functions and reset the variable to what seems to be the string returned from the FileOpenDialog call within the function:

Case $Image1
    OpenImages()
    Global $Image1 = $imagePath

As AutoIt expects a number within the Switch statement it tries to convert that string to a number - which as the string will always start with a letter - will result in $Image1 being set to 0. That is the default return from GUIGetMsg when there are no events to process - and so the $Image1 case fires on every pass.

Solution: Do not reuse variables which refer to ControlIDs.

M23

P.S. That code is, quite frankly, appallingly written - for example, you declare practically every Global variable within a function. I think a complete recast of the code would be a very good idea.

P.P.S Having just seen this line:

GUICtrlSetTip(-1, "How Often Program Should Auto Post (Will Be Randomized Somewhat For Validity)")

I have also decided that this is not a script we are prepared to support. Having to make that sort of statement leads me to believe that the site which you are attempting to spam would not approve of the script being used. Thread closed - PM me if you wish to explain why you feel I should reopen it.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Similar Content

    • VaishnaviBUtpat
      By VaishnaviBUtpat
      <!DOCTYPE html> <html lang="en" xml:lang="en" style="height: 100%;" xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <style> * { margin: 0; padding: 0; } .th-lk { color: #3665d0; font-family: Arial; font-size: small; text-decoration: none; } .th-lk { vertical-align: 0px; } .th-menu2 .th-lk { line-height: 2em; margin-bottom: 0px; margin-right: 0px; overflow: hidden; padding: 0; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; width: 100%; } .th-menu2 .th-lk { color: black; font-weight: bold; } .th-menu2 > li > .th-lk { display: block; padding-left: 8px; width: auto; } .th-menu2 .th-menu2-sub-item .th-lk, .th-menu2 .th-menu2-sub-item-hov .th-lk { margin-right: 20px; } .th-menu2-sub-item { position: relative !important; } .th-menu2 .th-menu2-item, .th-menu2 .th-menu2-item-hov, .th-menu2 .th-menu2-sub-item, .th-menu2 .th-menu2-sub-item-hov { background-repeat: repeat-x; border-left-style: solid; border-left-width: 1px; border-right-style: solid; border-right-width: 1px; border-top-style: solid; border-top-width: 1px; height: 2em; list-style: none; margin-bottom: 0px; padding: 0; width: 100%; } .th-menu2 .th-menu2-item, .th-menu2 .th-menu2-item-hov, .th-menu2 .th-menu2-sub-item, .th-menu2 .th-menu2-sub-item-hov { background-color: #ECECEC; background-image: url(sap_skins/default/styling/lshape/chg_butt_det_nav.gif); border-left-color: #d3d1ce; border-right-color: #d3d1ce; border-top-color: #d3d1ce; border-top-width: 0px; } .th-menu2 { border: 0 solid black; left: 0px; list-style: none; margin: 0; padding: 0; position: relative; } .th-menu2 { z-index: 10006; } .th-menu2 { background-color: white; } div { zoom: 1; } .th-sc-content { left: 0px; position: absolute; top: 0px; } .th-sc-container { left: 0px; overflow: hidden; position: relative; top: 0px; } .th-sc-top { position: relative; } .th-sc-top, .th-sc-content, .th-sc-container, .th-sc-buttondown, .th-sc-buttonup { width: 172px; } .th-sc-buttonup, .th-sc-container { z-index: 10101; } .th-sc-top { z-index: 10100; } body, td, th { font-family: Arial,Helvetica,sans-serif; font-size: small; } .th-l-navcontainer, .th_l_downcontainer { border-right-style: solid; border-right-width: 1px; width: 172px; } .th-l-navcontainer, .th_l_downcontainer { background-color: white; border-right-color: #d3d1ce; } body, html { margin: 0px; border: 0; margin: 0; } </style> </head> <body><form name="myFormId" id="myFormId" action="/sap(ZT1TVVJEWDFWVFVsOWZYMTlmTWpNNU9UWmZXWTlwZG5telZ1RGhBSUFBQ3Nyc2tBPT0=)/bc/bsp/sap/crm_ui_frame/BSPWDApplication.do?sap-client=100&amp;sap-language=EN&amp;sap-domainrelax=min" method="post" target="WorkAreaFrame2"><div class="th-ajax-area" id="rootAreaDiv"><div id="C1_W1_V2" tgt="" dhe="false"><table width="100%" style="table-layout: fixed;" cellspacing="0" cellpadding="0"><tbody><tr><td><table width="100%" style="table-layout: fixed;" cellspacing="0" cellpadding="0"><tbody><tr valign="top"><td class="th-l-navcontainer" id="th_l_navcontainer"><div class="th-sc-top" id="C1_W1_V2_thescroll" style="height: 786px;"><div class="th-sc-container" id="C1_W1_V2_thescroll_scbox" style="height: 786px;"><div class="th-sc-content" id="C1_W1_V2_thescroll_sccontent"><div class="th-ajax-area" id="C1_W1_V2_$navbar"><div id="C7_W35_V36" tgt="" dhe="true" excevt="" intevt="c:C7_W35_V36:C1_W1_V2_C7_W35_V36_MainNavigationLinks.do;" automode="true"><div class="th-ajax-area" id="C1_W1_V2_C7_W35_V36_MainNavigationLinks.do"><ul class="th-menu2" id="C7_W35_V36_mainmenu" style="width: 171px;"><li class="th-menu2-sub-item"><a title="Sales Cycle" class="th-lk" id="C7_W35_V36_UTL-SLS" onclick="htmlbSubmitLib('htmlb',this,'thtmlb:link:click:0','myFormId','C7_W35_V36_UTL-SLS','UTL\x2dSLS\x2dWC',0);return false" onfocus="thSaveKbFocus(this);" oncontextmenu="return false;" href="javascript:void(0)">Sales Cycle</a></li></ul></div></div></div></div></div></div></td></tr></tbody></table></td></tr></tbody></table></div></div></form></body> </html> How to capture above HTML element using AutoIT
    • Jibberish
      By Jibberish
      Hi,
      I am automating the testing of a video player. I search a file for ".mp4" and want to create a GUI with radio buttons to select what video to play. The number of videos can change based on the user's library so this must be created automatically.  I have searched for how to accomplish this and there are several posts out there that help a little but I can't figure out the solution. I pulled the offending code from my main script and created the file below to make this easier to read. I am sure one of our experts here can help!
      #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <array.au3> #include <File.au3> #include <GUIConstantsEx.au3> Local $sMediaFile = "D:\MediaFiles\MediaFiles.txt" Local $iStrReturn = 0 Local $aText Local $aArrayFile Local $iMax = 6 ;Default number of Videos - 1 for the array counter Local $aVideoName[$iMax] = [0] Local $sCheckBox1 Local $iT = 0, $iVideoCount = 0, $iCount Local $ix = 0 Local $iy = 0 Local $idClose1 Const $iL = 10 ; Count from Left for GUI so all buttons line up ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Read a list of video file names and create a GUI with Radio Buttons to select a single video. ; Problem: We don't know how many video names will be in the text file, so we can't hard code Case Statements & their variables ; Put the Video File Names into an Array _FileReadToArray($sMediaFile, $aArrayFile) For $a = 1 To $aArrayFile[0] ; Step through the array looking for .mp4 If StringInStr($aArrayFile[$a], ".mp4") Then $iVideoCount = $iVideoCount + 1 $aText = StringSplit($aArrayFile[$a],"\\") ; This video player reads double backslashes For $a1 = 1 to $aText[0] ; Check that the array is big enough If StringInStr($aText[$a1], ".mp4") Then ;MsgBox(0,"","Video is " & $aText[$a1]) If UBound($aVideoName) = $iVideoCount Then ; Resize the array when $iCount is equal to the element count in the array to prevent subscript error ReDim $aVideoName[$aVideoName[0] + $iMax] EndIf $aVideoName[$iVideoCount] = $aText[$a1]; add data to new index element $aVideoName[0] = $a1 ; update the index count for future reference ; The idea is to create a GUI width to accommodate long video file names $it = StringLen($aVideoName[$iVideoCount]) If $iT > $ix Then $ix = $iT EndIf EndIf Next EndIf Next ; Move backwards through the array deleting blank rows For $iCount = UBound($aVideoName) - 1 To 0 Step -1 If $aVideoName[$iCount] = "" Then _ArrayDelete($aVideoName, $iCount) EndIf Next ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Create the GUI - Names and Radio Button counts will vary - How do I do this? ; ;_ArrayDisplay($aVideoName) ;Local $aVarName[$aVideoName[0]] Local $iRows = UBound($aVideoName, $UBOUND_ROWS) $iRows = $iRows -1 $aVideoName[0] = $iRows ; Prep the GUI to display the FileNames with Radio Buttons - Can only select one at a time. $a = 0 $ix = $ix + 200 $iy = ($aVideoName[0] * 30) + 60 $hGUI = GUICreate("Videos", $ix, $iy) ;$iT = $iT+30 ; Create the variable names for the Case statement - Video count may change so Video Names displayed and GUICtrlCreateRadio count may change. ;~ For $a = 1 to $aVarName[0] ;~ If UBound($aVarName) = $aVarName Then ;~ ; Resize the array when $iCount is equal to the element count in the array to prevent subscript error ;~ ReDim $aVarName[$aVarName[0] + $iMax] ;~ EndIf ;~ Assign("$bVideoName" & $a, $a) ;~ Local $aVarName[$a] = Eval($bVideoName[$a]) ;~ ; $aVarName[$a] = GUICtrlCreateRadio($aVarName[$a], $iL, $iT) ;~ Next $iCount = 1 ;MsgBox(0,"","VideoName[0] is "&$aVideoName[0]) ;_ArrayDisplay($aVideoName) Local $bVideoName1 If $iCount < $aVideoName[0] Then $bVideoName1 = GUICtrlCreateRadio($aVideoName[$iCount], $iL, $iT) GUICtrlSetState($bVideoName1, $GUI_CHECKED) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0]) Then Local $bVideoName2 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0]) Then Local $bVideoName3 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0]) Then Local $bVideoName4 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0] -1) Then Local $bVideoName5 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0] -1) Then Local $bVideoName6 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0] -1) Then Local $bVideoName7 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iT = $iT + 30 $idClose1 = GUICtrlCreateButton("Go!", $iL, $iT) GUISetState(@SW_SHOW) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Switch Statement ; ;Local $nMsg = "" While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $bVideoName1 Case $bVideoName2 Case $bVideoName3 Case $bVideoName4 Case $bVideoName5 ;Case $bVideoName6 <- Fails because there are only 5 videos - Need variable $bVideoNames ;Case $bVideoName7 <- Fails because there are only 5 videos Case $idClose1 $bVideoName1 = GUICtrlRead($bVideoName1) $bVideoName2 = GUICtrlRead($bVideoName2) $bVideoName3 = GUICtrlRead($bVideoName3) $bVideoName4 = GUICtrlRead($bVideoName4) $bVideoName5 = GUICtrlRead($bVideoName5) ;$bVideoName6 = GUICtrlRead($bVideoName6) ;$bVideoName7 = GUICtrlRead($bVideoName7) ExitLoop EndSwitch WEnd GUIDelete($nMsg) MsgBox(0,"","Case " & $nMsg & " was selected.") ; Always returns 8. ??? This is the "MediaFiles.txt" file I am reading:
      D:\\MediaFiles\\BigBuckBunny.mp4 D:\\MediaFiles\\BigBuckBunny60fps.mp4 D:\\MediaFiles\\Sintel.mp4 D:\\MediaFiles\\sintel-2048-surround.mp4 D:\\MediaFiles\\TearsOfSteel.mp4 D:\\MediaFiles\\tearsofsteel_4K.mp4 I'm sure I have several mistakes (or poor coding methods) in my AutoIt file.
    • cu0x
      By cu0x
      Hello guys,
       
      im trying to solved a problem that I have.
       
      Need to get some chinese text from an old Wise script, and in the wise file says f.e. Ù×÷ϵͳ¡£ ÇëÉý¼¶Ä. Is there any way to convert it to traditional chinese?
       
      Already tryied the following code...
       
      #include <MsgBoxConstants.au3> Example() Func Example() ; Define the string that will be converted later. ; NOTE: This string may show up as ?? in the help file and even in some editors. ; This example is saved as UTF-8 with BOM. It should display correctly in editors ; which support changing code pages based on BOMs. Local Const $sString = "Ù×÷ϵͳ¡£ ÇëÉý¼¶Ä" ; Temporary variables used to store conversion results. $dBinary will hold ; the original string in binary form and $sConverted will hold the result ; afte it's been transformed back to the original format. Local $dBinary = Binary(""), $sConverted = "" ; Convert the original UTF-8 string to an ANSI compatible binary string. $dBinary = StringToBinary($sString) ; Convert the ANSI compatible binary string back into a string. $sConverted = BinaryToString($dBinary) ; Display the resulsts. Note that the last two characters will appear ; as ?? since they cannot be represented in ANSI. DisplayResults($sString, $dBinary, $sConverted, "ANSI") ; Convert the original UTF-8 string to an UTF16-LE binary string. $dBinary = StringToBinary($sString, 2) ; Convert the UTF16-LE binary string back into a string. $sConverted = BinaryToString($dBinary, 2) ; Display the resulsts. DisplayResults($sString, $dBinary, $sConverted, "UTF16-LE") ; Convert the original UTF-8 string to an UTF16-BE binary string. $dBinary = StringToBinary($sString, 3) ; Convert the UTF16-BE binary string back into a string. $sConverted = BinaryToString($dBinary, 3) ; Display the resulsts. DisplayResults($sString, $dBinary, $sConverted, "UTF16-BE") ; Convert the original UTF-8 string to an UTF-8 binary string. $dBinary = StringToBinary($sString, 4) ; Convert the UTF8 binary string back into a string. $sConverted = BinaryToString($dBinary, 4) ; Display the resulsts. DisplayResults($sString, $dBinary, $sConverted, "UTF8") EndFunc ;==>Example ; Helper function which formats the message for display. It takes the following parameters: ; $sOriginal - The original string before conversions. ; $dBinary - The original string after it has been converted to binary. ; $sConverted- The string after it has been converted to binary and then back to a string. ; $sConversionType - A human friendly name for the encoding type used for the conversion. Func DisplayResults($sOriginal, $dBinary, $sConverted, $sConversionType) MsgBox($MB_SYSTEMMODAL, "", "Original:" & @CRLF & $sOriginal & @CRLF & @CRLF & "Binary:" & @CRLF & $dBinary & @CRLF & @CRLF & $sConversionType & ":" & @CRLF & $sConverted) EndFunc ;==>DisplayResults Thanks a lot!
    • nacerbaaziz
      By nacerbaaziz
      Hi dear
      I want create retractable bar using autoit
      I tried creating slider, but there's a problem with screen reader for the blind, so is there another retractable tape?
      It is advisable to not accept dragging with the keybord only with  mouse
      note:
      This bar is needed in the process of raising and lowering the volume
      I hope that there is a solution to do that
      i waiting your responses.
      Thanks in advance to all members and administrators
    • Skeletor
      By Skeletor
      Hi All,
      I know many newbies search for this feature.
      I decided to share this piece of code with everyone.
      Basically its a "splash screen" that has a transparent image.
      In a nutshell - Gui with a transparent gif.
      Enjoy...
      Download attachment....
       
      Splash Screen GUI.zip