Jump to content

Search the Community

Showing results for tags 'to'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

Found 9 results

  1. good morning sirs. please i have a request from you. i have an variable to Read a data from a file this data is Encrypted and when i read it i Decrypte it. for that i need a function to Write a ini data to string. ;#Function# ===================================================================================================================== ; Name............: _IniReadFromString ; Description.....: Returns the value of a key in a specific section of an ini-formatted string ; Syntax..........: _IniReadFromString($szInput, $szSection, $szKey, $Default) ; Parameters......: ;   $szInput - The string that contains data in ini format ;   $szSection   - The sectionname (just as in IniRead) ;   $szKey   - The keyname (just as in IniRead) ;   $Default - The default value if the key does not exist or reading failed (just as in IniRead) ; Return values ..: ;   Success  - Returns the read value ;   Failure  - Returns $Default ; Author .........: FichteFoll ; Remarks ........: Works for Unicode as well as for ANSI ; Related ........: IniRead, _IniReadSectionFromString ; Link ...........; See on top ; Example ........; $var = _IniReadFromString(StringFormat("[Sect]\r\nMyKey1=value1\r\nMyKey2=value2"), "Sect", "MyKey2", "no_value") ; =============================================================================================================================== Func _IniReadFromString($szInput, $szSection, $szKey, $Default) $szInput = StringStripCR($szInput) ;~  Local $aRegMl = StringRegExp($szInput, "\[" & __StringEscapeRegExp($szSection) & "\]\n+(?:[^\[].*?=.*\n)*" & __StringEscapeRegExp($szKey) & "=(.*)\n?(",3) Local $aRegMl = StringRegExp($szInput, "\[" & __StringEscapeRegExp($szSection) & "\]\n+(?:[^\[].*?=.*\n)*" & __StringEscapeRegExp($szKey) & "=(.*)\n?", 3) If @error Then Return SetError(1, 0, $Default) ; key not found    Return $aRegMl[0] EndFunc;==>_IniReadFromString ; ############################################################################################################################### ; =============================================== ; = Internal Use Only ; =============================================== Func __StringEscapeRegExp($szExp) Return StringRegExpReplace($szExp, "([\(\)\[\]\{\}\\\/\?\.\\|\+])", "\\$1") ; ()[]{}\/?.|+ EndFunc;==>__StringEscapeRegExp like this function Read the ini from string. please ihelp me thanks in advance
  2. Hello my friends I am a totally blind young man for easier to read books and articles Among the blind i has programmed a tool This tool converts text to audio with the possibility to save it into a wav or mp3 file It is also compatible with all persons, whether blind or ordinary I have completed the work of this tool and want to take your opinion i Especially published here for anyone looking about how to convert text to speech, I will put this tool open source for you I want to know what your think about it and if it need any other additions? Note : This tool converts texts to audio using sapi 5 voices so i was also puted a hot keys to control the tool Now I put this project to you for public benefit and I am ready to answer any question. Apology : I am an Arab youth from Algeria I do not mastered English very well So I apologize to you if there are written mistakes With my greetings and best wishes My texts to audio converter.zip
  3. 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
  4. Hello my friends I have an urgent question, please help. How do I select all the text in the edit or input And how to get the currently selected text Please help urgently Greetings and thanks for all
  5. Hey guys, I am very new to using AutoIt and wrote my first little script today after reading bits and pieces on the docs. The script is designed to make an ugly batch operation a bit more user friendly for the people in the office. I have a batch file that consists of: @echo off net use B: /delete net use B: \\10.10.10.10\Share /user:domain\username It is used to log a user onto a secure share drive on my NAS. I have spoofed the share location etc. however. My AutoIt Script is: Local $passwd = InputBox("Attempting to Access B:", "Enter your password.", "", "*","M") Run("C:\Users\User\Desktop\login.bat") WinWaitActive("C:\Windows\system32\cmd.exe") Send($passwd) Now this works fine, however once I input my password into the GUI and it Sends that Password to the cmd window, I cannot make it send an "ENTER" Keystroke. It isn't a HUGE issue as I can manually press enter once the cmd window shows up, but I would like it to input the password and do the carriage return straight away. I have tried using Send("{ENTER}") , and it returns an error. I have tried changing the way I implement the sending of {ENTER} in as many ways as I can think of. I would greatly appreciate it if anyone can help me on this. Also, if anyone knows of a way to run the cmd window silently but still be able to send the password to it that would be even better! Cheers
  6. hello, now i have a script and need it to stop it's function when "F3" is pressed. but i don't know what's wrong check that: HotKeySet("{F2}", "MSG") HotKeySet("{F3}", "xt") Func MSG() $chk = 1 while 1 MsgBox(0, "TEST", "1") MsgBox(0, "TEST", "2") MsgBox(0, "TEST", "3") MsgBox(0, "TEST", "4") MsgBox(0, "TEST", "5") $chk = 0 wend EndFunc ;==>MSG Func xt() $chk = 0 EndFunc ;==>xt While 1 Sleep(200) WEnd EDIT: I want it stop wherever which msgbox running whether msg1 or msg2 etc..
  7. Hey everybody. I have been using GUIOnEventMode for a while now, and have never come across this problem. When I am running my script, if I click a button with an event assigned to it, then it seems to queue the events until I right click on the autoit tray icon and tell it to exit, and then it runs the appropriate events for the functions, and then continues to run the script until it reaches the next GUI, and then the same happens. This is the script (Ofcourse I have removed the company name from it though). I am using 3.3.8.0 on Windows 7 Home Premium 64 bit, running the 32 bit AutoIT Executable. #AutoIt3Wrapper_UseX64=N #include <Array.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <Misc.au3> #include <String.au3> Opt("GUIOnEventMode", 1) Opt("GUICloseOnEsc", 0) Opt("TrayAutoPause", 0) _GDIPlus_Startup() OnAutoItExitRegister('_OnExit') Global $TestGui = 0, $DataGuiArray[10], $ProdNumGuiArray[6], $GUIArray[19], $Selected, $FilePath, $File, $Product, $PInfo, $PWarranty, $PDetails, $PCode, $PWrap, $PMain, $PName, $PCost, $PImages, $ImagesString, $Repeat, $PDetails, $PBrand, $PDelivery, $PWholeSale, $PSearchTags, $PWholesale, $SEOKeywords, $SEODesc, $PNum = "NO PRODUCT NUMBER", $PNumLimit, $MichaelBot = "MichaelBot/1.0 (+http://http://www.Michaelonline.com.au/)", $ThisImage = 0, $Pic, $ImagesGuiArray[5], $ImagesDirectory = "C:\Users\"&@UserName&"\Desktop\Images", $PImagesArray Global $UsePNum = 0, $Mode = 0 HttpSetUserAgent($MichaelBot) If $TestGui = 1 Then _CreateGUI() EndIf If $UsePNum = 1 Then _ProdNum() EndIf _Start() Func _ProdNum() $ProdNumGuiArray[0] = GUICreate("Automatic Product Numbers", 120, 120) $ProdNumGuiArray[1] = GUICtrlCreateLabel("From", 20, 20, 30, 21) $ProdNumGuiArray[2] = GUICtrlCreateInput("", 50, 17, 50, 21) $ProdNumGuiArray[3] = GUICtrlCreateLabel("To", 20, 50, 21) $ProdNumGuiArray[4] = GUICtrlCreateInput("", 50, 47, 50, 21) $ProdNumGuiArray[5] = GUICtrlCreateButton("OK", 40, 80, 40, 30) GUICtrlSetOnEvent($ProdNumGuiArray[5], "_CheckProdNum") GUISetOnEvent(-3, "_Exit") GUISetState(@SW_SHOW, $ProdNumGuiArray[0]) Local $Msg = 0 While 1 WEnd EndFunc Func _CheckProdNum() GUISetState(@SW_HIDE, $ProdNumGuiArray[0]) If GUICtrlRead($ProdNumGuiArray[2]) = "" Or GUICtrlRead($ProdNumGuiArray[4]) = "" Then MsgBox(0,"","Please insert a number in both input boxes.") Else If Number(GUICtrlRead($ProdNumGuiArray[2])) > Number(GUICtrlRead($ProdNumGuiArray[4])) Then MsgBox(0,"","The first number should be smaller than the second.") Else $PNum = Number(GUICtrlRead($ProdNumGuiArray[2])) $PNum -= 1 $PNumLimit = Number(GUICtrlRead($ProdNumGuiArray[4])) GUIDelete($ProdNumGuiArray[0]) _Start() EndIf EndIf EndFunc Func _Start() If $UsePNum = 1 Then If $PNum <> "NO PRODUCT NUMBER" Then If $PNum > $PNumLimit Then _ProdNum() Else $PNum += 1 EndIf EndIf EndIf Local $URL = 'http://www.oo.com.au/Vivitar-iTwist-X018-Digital-Ca_P42902C901.cfm';InputBox("URL", "Please input the product's URL.", ClipGet()) If $URL = "" Then MsgBox(0,"","No URL Supplied.") _Start() EndIf If Not _IsURL($URL) Then MsgBox(0,"","Given string is not URL.") _Start() EndIf If StringInStr($URL, "?") Then $URL = StringLeft($URL, StringInStr($URL, "?")) EndIf If Not StringInStr($URL, "http://") Then $URL = 'http://'&$URL EndIf Local $FilePath = @ScriptDir&"\File\File.html" ;~ ABOVE IS VALIDATION FOR THE URL ClipPut("") ;~ DOWNLOADING THE WEBPAGE InetGet($URL, $FilePath, 16, 0) If FileExists(@ScriptDir&"\File\File.htm") Then FileMove(@ScriptDir&"\File\File.htm", $FilePath, 9) EndIf ;~ ENSURING THAT THE CORRECT FILE EXISTS $File=FileRead($FilePath) ;~ GETTING THE FILE CONTENTS If $File = '' Then ;~ IF FILE NOT DOWNLOADED FROM OO ATTEMPT DOWNLOAD FROM GOOGLE CACHE MsgBox(0,"Error","Could Not Download from OO.com.au"&@CRLF&"Now attempting download from Google Cache.") If StringInStr($URL, 'http://') Then ;~ REMOVE HTTP FROM URL $URL = StringTrimLeft($URL, 7) EndIf $URL = StringTrimRight($URL, 9)&".cfm" ;~ REMOVE ARGUMENTS AND PARAMETERS FROM URL HttpSetUserAgent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1') ;~ SET USER AGENT TO FIREFOX TO AVOID GOOGLE CACHE ERRORS InetGet('http://webcache.googleusercontent.com/search?q=cache:'&$URL, $FilePath, 16, 0) ;~ ATTEMPT TO DOWNLOAD FILE FROM GOOGLE CACHE If FileExists(@ScriptDir&"\File\File.htm") Then FileMove(@ScriptDir&"\File\File.htm", $FilePath, 9) EndIf ;~ ENSURING THAT THE CORRECT FILE EXISTS HttpSetUserAgent($MichaelBot) ;~ RESETTING THE USER AGENT TO MichaelBOT $File=FileRead($FilePath) ;~ GETTING THE FILE CONTENTS If $File = '' Then ;~ IF FILE NOT DOWNLOADED FROM GOOGLE CACHE THEN DOWNLOAD MANUALLY MsgBox(0,"Error","Could Not Download from Google Cache"&@CRLF&"Please save the file manually to "&$FilePath&".") While Not FileExists($FilePath) If FileExists(@ScriptDir&"\File\File.htm") Then FileMove(@ScriptDir&"\File\File.htm", $FilePath, 9) EndIf ;~ ENSURING THAT THE CORRECT FILE EXISTS Sleep(1000) WEnd ;~ WAITING FOR USER TO DOWNLOAD FILE MsgBox(0,"","File detected. Attempting to use file as source.") $File=FileRead($FilePath) ;~ GETTING THE FILE CONTENTS If StringInStr(StringStripWS($File, 8), "Ashardaswetrywestillaren'tperfect.Wesuggestthatyoutryagainorcontactus.We'resorryforanyinconveniencethismaycause.We'lltryourbesttomakesureitdoesnothappenagain.") Then MsgBox(0,"ERROR","It appears that OO.com.au is down!"&@CRLF&"Attempting alternate download methods.") EndIf If $File = '' Or StringInStr(StringStripWS($File, 8), "Ashardaswetrywestillaren'tperfect.Wesuggestthatyoutryagainorcontactus.We'resorryforanyinconveniencethismaycause.We'lltryourbesttomakesureitdoesnothappenagain.") Then ;~ IF OO IS OFFLINE OR IF USER COULD NOT DOWNLOAD FROM OO $Msgbox = MsgBox(4,"Error", "Program could not read contents of file."&@CRLF&"Would you like to attempt to manually load the file's HTML into the program?") ;~ PRESENT USER WITH THE OPTION TO PASTE THE HTML INTO THE PROGRAM If $Msgbox = 6 Then ;~ IF USER ACCEPTS $File = InputBox("Insert HTML", "Please insert the page's source.", "") ;~ PRESENT USER WITH AN INPUT BOX TO PASTE THE HTML If $File = '' Then ;~ IF THE USER PASTED NOTHING MsgBox(0,"","Failed to retrieve page source from input box."&@CRLF&"Now Exiting.") Exit ;~ GIVE UP ON THE USER. MIGHT BE A GOOD IDEA TO BE PERSISTENT AND PLACE IN WHILE LOOP----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- EndIf Else ;~ IF USER DECLINES MsgBox(0,"","As the program could not retrieve the requested data, it will not exit.") Exit ;~ EXIT EndIf EndIf EndIf EndIf If StringInStr($File, 'images/refurbished.gif') Then ;~ ENSURE THAT THE PRODUCT IS NOT REFURBISHED MsgBox(0,"REFURBISHED", "Error - This product has been refurbished!");http://www.oo.com.au/Kodak-M531-Digital-Camera-14_P89056C901.cfm ;~ FileDelete($File) _Start() ;~ IF THE PRODUCT IS REFURBISHED, THEN MOVE USER ON TO NEXT PRODUCT EndIf ;~ MsgBox(0,"",$File) ;~ FileDelete($FilePath) _GetData() EndFunc Func _GetData() $ThisImage = 0 $Pic = 0 $Product = _HTMLGetElementByID($File, 'product') $PInfo = _HTMLGetElementByID($Product, 'p_info') $PWarranty = _HTMLGetElementByID($PInfo, 'p_warranty') $PWarranty = _HTMLGetWarranty($PWarranty) $PDetails = _HTMLGetElementByID($PInfo, 'p_details') $PBrand = _HTMLGetBrand($PDetails) If $PBrand = '' Then $PBrand = 'Michael' $PCode = _HTMLGetProductCode($PDetails) $PWrap = _HTMLGetElementByID($Product, 'p_wrap') $PMain = _HTMLGetElementByID($PWrap, 'p_main') $PName = StringTrimLeft(StringTrimRight($PMain, StringLen($PMain) - StringInStr($PMain, '</h1>')+1), StringInStr($PMain, '<h1>')+3) $PCost = _HTMLGetCost($PMain) $PWholeSale = $PCost $PCost = _Price($PCost) $PDelivery = _Delivery($PMain) $PImages = _HTMLGetElementByID($PWrap, 'p_imgs') $PImages = _HTMLGetImages($PImages) $PImagesArray = StringSplit($PImages, "|", 3) ;~ MsgBox(0,"",$PCode) For $Repeat = 0 To UBound($PImagesArray)-1 $PImagesArray[$Repeat] = 'http://img.oo.com.au/prod/'&$PCode&'/'&$Repeat+1&'b.jpg' Next $PDetails = _HTMLGetDescription($PDetails, $PWarranty) $PSearchTags = _GetSearchTags($PName) $SEOKeywords = _GetSEOKeywords($PName) $SEODesc = _GetSEODescription($PDetails) _Images() EndFunc Func _CreateGUI() ;GUI WINDOW $GUIArray[0] = GUICreate(" ", 170, 580, @DesktopWidth-200, 75) WinSetOnTop($GuiArray[0], "", 1) ;BASIC DETAILS $GUIArray[1] = GUICtrlCreateRadio("Product Name", 22, 25) $GUIArray[2] = GUICtrlCreateRadio("Product Code", 22, 45) ;PRICE DETAILS $GUIArray[3] = GUICtrlCreateRadio("Final Price", 22, 90) ;DESCRIPTION $GUIArray[4] = GUICtrlCreateRadio("Description", 22, 135) ;IMAGES $GUIArray[5] = GUICtrlCreateRadio("Images", 22, 180) ;Copies the image URL into an array ;ADVANCED DETAILS $GUIArray[6] = GUICtrlCreateRadio("Wholesale Price", 22, 225) $GUIArray[7] = GUICtrlCreateRadio("Brand", 22, 245) $GUIArray[8] = GUICtrlCreateRadio("Notes", 22, 265) $GUIArray[9] = GUICtrlCreateRadio("Product Search Tags", 22, 285) $GuiArray[10] = GUICtrlCreateRadio("Product Identifiers", 22, 305) ;POSTAGE $GUIArray[11] = GUICtrlCreateRadio("Fixed Cost", 22, 350) ;SEARCH ENGINE OPTIMISATION $GUIArray[12] = GUICtrlCreateRadio("Title", 22, 395) $GUIArray[13] = GUICtrlCreateRadio("Keywords", 22, 415) $GUIArray[14] = GUICtrlCreateRadio("Description", 22, 435) $GUIArray[15] = GUICtrlCreateRadio("Custom URL", 22, 455) ;BUTTONS $GUIArray[16] = GUICtrlCreateButton("View Data", 10, 490, 150, 22) GUICtrlSetOnEvent($GuiArray[16], "_DataGUI") $GuiArray[17] = GUICtrlCreateButton("New Product", 10, 520, 150, 22) GUICtrlSetOnEvent($GuiArray[17], '_ReStart') ;STATUSBAR $GuiArray[18] = _GUICtrlStatusBar_Create($GuiArray[0]) _GUICtrlStatusBar_SetText($GuiArray[18], $PNum) ;GROUPS GUICtrlCreateGroup("Basic Details", 10, 10, 150, 60) GUICtrlCreateGroup("Price Details", 10, 75, 150, 40) GUICtrlCreateGroup("Description", 10, 120, 150, 40) GUICtrlCreateGroup("Images", 10, 165, 150, 40) GUICtrlCreateGroup("Advanced Details", 10, 210, 150, 120) GUICtrlCreateGroup("Postage", 10, 335, 150, 40) GUICtrlCreateGroup("Search Engine Optimisation", 10, 380, 150, 100) ;GUI BEHAVIORS GUICtrlSetState($GUIArray[1], 1) GUISetOnEvent(-3, "_Exit") GUISetState(@SW_SHOW, $GuiArray[0]) ;CONTINUING WITH THE SCRIPT If $TestGui = 0 Then _Main() EndIf While 1 WEnd EndFunc Func _Main() WinsetOnTop(" ", "", 1) If $PBrand = '' Then GUICtrlSetState($GuiArray[7], $GUI_DISABLE) EndIf While 1 For $Repeat = 1 To 16 ;Getting selected radio box If GUICtrlRead($GuiArray[$Repeat]) = 1 Then ; MsgBox(0,"",$Selected) $Selected = $Repeat ExitLoop EndIf Next Switch $Selected Case 1 ;Product Name ClipPut($PName) While GUICtrlRead($GuiArray[1]) = 1 ;~ If _IsPressed(11) And _IsPressed(56) Then ;~ GUICtrlSetState($GuiArray[3], $GUI_CHECKED) ;~ EndIf WEnd Case 2 ;Product Code ClipPut($PNum) While GUICtrlRead($GuiArray[2]) = 1 If _IsPressed(11) And _IsPressed(56) Then While _IsPressed(11) And _IsPressed(56) WEnd Sleep(100) Send("{TAB}") Send("10") EndIf WEnd Case 3 ;Product Cost ClipPut($PCost) While GUICtrlRead($GuiArray[3]) = 1 WEnd Case 4 ;Product Description ClipPut($PDetails) While GUICtrlRead($GuiArray[4]) = 1 WEnd Case 5 ;Images ClipPut($PImagesArray[0]) $ThisImage = 0 While GUICtrlRead($GuiArray[5]) = 1 If _IsPressed(11) And _IsPressed(56) Then $ThisImage += 1 If $ThisImage = UBound($PImagesArray) Then ClipPut("") Else ClipPut($PImagesArray[$ThisImage]) EndIf EndIf WEnd Case 6 ;Wholesale ClipPut($PWholeSale) While GUICtrlRead($GuiArray[6]) = 1 WEnd Case 7 ;Brand ClipPut($PBrand) While GUICtrlRead($GuiArray[7]) = 1 WEnd Case 8 ;Notes ClipPut('Product Code: '&$PCode) While GUICtrlRead($GuiArray[8]) = 1 WEnd Case 9 ;Product Search Tags ClipPut(StringLeft($PSearchTags, StringInStr($PSearchTags, "|", 0, 1)-1)) $ThisPSearchTags = $PSearchTags While GUICtrlRead($GuiArray[9]) = 1 If _IsPressed(11) And _IsPressed(56) Then Sleep(100) $ThisPSearchTags = StringTrimLeft($ThisPSearchTags, StringInStr($ThisPSearchTags, "|")) ClipPut(StringLeft($ThisPSearchTags, StringInStr($ThisPSearchTags, "|")-1)) While _IsPressed(11) And _IsPressed(56) WEnd EndIf If ClipGet() = '' Then While GUICtrlRead($GuiArray[9]) = 1 WEnd EndIf WEnd Case 10 ;Product Identifyer ClipPut($PCode) While GUICtrlRead($GuiArray[10]) = 1 WEnd Case 11 ;Fixed Cost Postage ClipPut($PDelivery) While GUICtrlRead($GuiArray[10]) = 1 WEnd Case 12 ;SEO Title ClipPut($PName) While GUICtrlRead($GuiArray[11]) = 1 WEnd Case 13 ;SEO Keywords ClipPut($SEOKeywords) While GUICtrlRead($GuiArray[12]) = 1 WEnd Case 14 ;SEO Description ClipPut($SEODesc) While GUICtrlRead($GuiArray[13]) = 1 WEnd Case 15 ;Custom URL ClipPut($PNum) While GUICtrlRead($GuiArray[14]) = 1 WEnd EndSwitch WEnd EndFunc Func _DataGUI() $DataGuiArray[0] = GUICreate("", @DesktopWidth*0.75, @DesktopHeight*0.75, 0, 0, 0x010F0000) $DataGuiArray[1] = GUICtrlCreateListView("Name|Data", 0, 0, @DesktopWidth, @DesktopHeight) GUICtrlSetResizing($GuiArray[1], '102') $DataGuiArray[2] = GUICtrlCreateListViewItem("Product Name|"&$PName, $GuiArray[1]) $DataGuiArray[3] = GUICtrlCreateListViewItem("Product Cost|"&$PCost, $GuiArray[1]) $DataGuiArray[4] = GUICtrlCreateListViewItem("Delivery Cost|"&$PDelivery, $GuiArray[1]) $DataGuiArray[5] = GUICtrlCreateListViewItem("Description|"&$PDetails, $GuiArray[1]) $DataGuiArray[6] = GUICtrlCreateListViewItem("Wholesale|"&$PWholeSale, $GuiArray[1]) If $PBrand = "" Then $DataGuiArray[7] = GUICtrlCreateListViewItem("Brand|BRAND UNKNOWN", $GuiArray[1]) GUICtrlSetBkColor($DataGuiArray[7], 0xff5040) Else $DataGuiArray[7] = GUICtrlCreateListViewItem("Brand|"&$PBrand, $DataGuiArray[1]) EndIf $DataGuiArray[8] = GUICtrlCreateListViewItem("Warranty|"&$PWarranty, $DataGuiArray[1]) GuiSetOnEvent(-3, "_Exit") GUISetState(@SW_SHOW, $DataGuiArray[0]) Return EndFunc Func _HTMLGetElementByID($html_code, $div_id) Local $o_htmlfile = ObjCreate('HTMLFILE') If Not IsObj($o_htmlfile) Then Return SetError(-1, 0, '') EndIf $o_htmlfile.open() $o_htmlfile.write($html_code) $o_htmlfile.close() Local $div = $o_htmlfile.getElementByID($div_id) If Not IsObj($div) Then Return SetError(0, 0, '') EndIf Return $div.outerHTML EndFunc Func _HTMLGetDescription($Desc, $Warranty) $Desc = StringStripWS($Desc, 3) $Desc = StringReplace($Desc, "<p>", "") $Desc = StringReplace($Desc, "</p>", "<br />") $Title = StringTrimLeft($Desc, StringInStr($Desc, '<h2>')+3) $Title = StringTrimRight($Title, StringLen($Title) - StringInStr($Title, '</h2>')+1) $Title = '<div style="text-align: center;"><strong><span style="font-size: 20px; font-family: arial; color: #3333ff;">'&$Title&'</span></strong></div>' ;~ MsgBox(0, "Title", $Title) $Desc = StringTrimRight($Desc, (StringLen($Desc) - StringInStr($Desc, "<h4"))+1) $Desc = '<span style="font-size: 12px; font-family: arial;"><br />'&StringTrimLeft($Desc, StringInStr($Desc, "<DIV class=clear></DIV>")+24) $DescBody = StringLeft($Desc, StringInStr($Desc, '<h3>')-1) ;~ MsgBox(0, "DescBody", $DescBody) $Desc = StringTrimLeft($Desc, StringInStr($Desc, '<h3>')-1) $Desc = StringReplace($Desc, "<h3>", "<strong>") $Desc = StringReplace($Desc, "</h3>", "</strong>") $Desc = StringReplace($Desc, '<strong>Product Features</strong>', '<strong>Product Features</strong>') $Desc = StringReplace($Desc, '<strong>Features</strong>', '<strong>Product Features</strong>') $Desc = StringReplace($Desc, "<strong>Specifications</strong>", "<strong>Product Specifications</strong>") $Desc = StringReplace($Desc, "<strong>Contents</strong>", "<strong>Package Contents</strong>") $Desc = StringReplace($Desc, "<strong>Package Contains</strong>", "<strong>Package Contents</strong>") $Desc = StringReplace($Desc, "<strong>Contains</strong>", "<strong>Package Contents</strong>") If $Warranty = "This product comes with a warranty covered by either oo.com.au or the supplier of this product." Then $Desc &= "This product comes with a warranty.</span>" Else $Desc &= $Warranty&"</span>" EndIf $Desc = StringReplace($Desc, '</li></ul>', '</li>'&@CRLF&'</ul>') $DescBody = StringStripWS($DescBody, 7) While StringRight($DescBody, 6) = '<br />' $DescBody = StringTrimRight($DescBody, 6) $DescBody = StringStripWS($DescBody, 7) WEnd While StringRight($DescBody, 6) = '<br /><br />' $DescBody = StringReplace($DescBody, '<br /><br />', '<br />') $DescBody = StringStripWS($DescBody, 7) WEnd $DescBody = StringReplace($DescBody, '<br />', '<br /><br />'&@CRLF) $DescArray = StringSplit($Desc, @CR&@LF&@CRLF, 2) ;~ _ArrayDisplay($DescArray) $Desc = "" For $Repeat = 0 To UBound($DescArray)-1 $DescArray[$Repeat] = StringStripWS($DescArray[$Repeat], 3) If StringLeft($DescArray[$Repeat], 5) = ' <li>' And StringRight($DescArray[$Repeat], 5) <> '</li>' Then $DescArray[$Repeat] = ' '&$DescArray[$Repeat]&'</li>' EndIf If $DescArray[$Repeat] <> "" Then $Desc &= $DescArray[$Repeat]&@CRLF EndIf Next ;~ MsgBox(0, "DotPoints", $Desc) $Title = StringStripWS($Title, 3) $DescBody = StringStripWS($DescBody, 3)&'<br /><br />' $Desc = StringStripWS($Desc, 3) $Desc = StringReplace($Desc, '<li>', ' <li>') $Desc = StringReplace($Desc, '</li>', '</li>') $Desc = StringReplace($Desc, '<strong>', '<strong>') $Desc = StringReplace($Desc, '</strong>', '</strong>') $Desc = StringReplace($Desc, '<ul>', '<ul>') $Desc = StringReplace($Desc, '</ul>', '</ul>') Return $Title&@CRLF&$DescBody&@CRLF&$Desc EndFunc Func _HTMLGetProductCode($Desc) $Code = StringTrimRight($Desc, StringLen($Desc)-StringInStr($Desc, '</h4>')+1) $Code = StringRight($Code, StringLen($Code) - StringInStr($Code, 'Product Code:')-13) Return $Code EndFunc Func _HTMLGetImages($Images) $Images = StringTrimLeft($Images, StringInStr($Images, 'http')-1) Local $ImagesString = StringLeft($Images, StringInStr($Images, '.jpg')+3)&'|' While StringLeft($Images, StringInStr($Images, '.jpg')+3) <> StringRight($ImagesString, StringLen($ImagesString) - StringInStr($ImagesString, '|', 0, 1))&'|' If StringInStr($Images, 'http', 0, 2)-1 = '-1' Then ExitLoop EndIf $Images = StringTrimLeft($Images, StringInStr($Images, 'http', 0, 2)-1) $ImagesString &= StringLeft($Images, StringInStr($Images, '.jpg')+3)&'|' WEnd $ImagesString = StringTrimRight($ImagesString, 1) ;~ MsgBox(0,"", $Images) ;~ MsgBox(0,"Images",$ImagesString) Return $ImagesString EndFunc Func _HTMLGetBrand($Desc) Local $Brand = "" If StringInStr($Desc, '<div class="brand">') Then $Brand = StringTrimRight(StringTrimLeft($Desc, StringInStr($Desc, '<div class="brand">')-1), StringLen($Desc) - StringInStr($Desc, "</a>", 0, 2)+1) $Brand = StringRight($Brand, StringLen($Brand) - StringInStr($Brand, "More ")-4) ElseIf StringInStr($Desc, '<div class=brand>') Then $Brand = StringTrimRight(StringTrimLeft($Desc, StringInStr($Desc, '<div class=brand>')-1), StringLen($Desc) - StringInStr($Desc, "</a>", 0, 2)+1) $Brand = StringRight($Brand, StringLen($Brand) - StringInStr($Brand, "More ")-4) ElseIf StringInStr($Desc, 'Brand: ') Then $Brand = StringTrimLeft($Desc, StringInStr($Desc, 'Brand: ')+6) $Brand = StringLeft($Brand, StringInStr($Brand, '</li>')-1) EndIf Return $Brand EndFunc Func _HTMLGetWarranty($Warranty) $Warranty = StringTrimLeft(StringTrimRight($Warranty, StringLen($Warranty) - StringInStr($Warranty, '</p>')+1), StringInStr($Warranty, '<p>')+2) If $Warranty = 'This product comes with a warranty covered by either oo.com.au or the supplier of this product.' Then $Warranty = 'This product comes with a warranty.' EndIf Return $Warranty EndFunc Func _HTMLGetCost($Main) If StringInStr($Main, '<P class=was>') Then $Cost = StringTrimRight(StringTrimLeft($Main, StringInStr($Main, '<P class=was>')+24), StringLen(StringTrimLeft($Main, StringInStr($Main, '<P class=was>')+24))-StringInStr(StringTrimLeft($Main, StringInStr($Main, '<P class=was>')+24), '</span>')+1) Else $Cost = StringTrimLeft(StringTrimRight($Main, StringLen($Main)-StringInStr($Main, "</strong>")+1), StringInStr($Main, "<P class=price>Our Price: <strong>")+34) EndIf Return $Cost EndFunc Func _Images() Local $Image, $Width, $Height ;~ _ArrayDisplay($PImagesArray) $ImagesGuiArray[0] = GUICreate("Images", 600, 680) GUISetBkColor(0xd0d0d0, $ImagesGuiArray[0]) $ImagesGuiArray[1] = GUICtrlCreateButton("<", 245, 610, 30, 30) GUICtrlSetOnEvent($ImagesGuiArray[1], '_PrevImage') $ImagesGuiArray[2] = GUICtrlCreateButton("Edit", 285, 610, 30, 30) GUICtrlSetOnEvent($ImagesGuiArray[2], '_EditImage') $ImagesGuiArray[3] = GUICtrlCreateButton(">", 325, 610, 30, 30) GUICtrlSetOnEvent($ImagesGuiArray[3], '_NextImage') $ImagesGuiArray[4] = GUICtrlCreateLabel("", 245, 645, 105, 30, 0x01) GUICtrlSetState($ImagesGuiArray[1], 128) If UBound($PImagesArray) = 1 Then GUICtrlSetState($ImagesGuiArray[3], 128) EndIf If UBound($PImagesArray)>8 Then $PImagesArrayLimit = 8 Else $PImagesArrayLimit = UBound($PImagesArray)-1 EndIf _CreateImage() GUISetOnEvent(-3, "_Exit") GUISetState(@SW_SHOW, $ImagesGuiArray[0]) While 1 WEnd EndFunc Func _CreateImage() If StringLeft($PImagesArray[0], 4) = 'http' Then InetGet($PImagesArray[0], @TempDir&"\Pic.jpg", 16, 0) Else FileWrite(@TempDir&"\Pic.jpg", FileRead($ImagesDirectory&"\"&$PNum&" 0.jpg")) EndIf $Image = _GDIPlus_ImageLoadFromFile(@TempDir&"\Pic.jpg") $Width = _GDIPlus_ImageGetWidth($Image) $Height = _GDIPlus_ImageGetHeight($Image) If $Width > $Height Then $Height = 600*($Height/$Width) $Width = 600 ElseIf $Height > $Width Then $Width = 600*($Height/$Width) $Height = 600 Else $Height = 600 $Width = 600 EndIf _GDIPlus_ImageDispose($Image) $Pic = GUICtrlCreatePic(@TempDir&"\Pic.jpg", 0, 0, $Width, $Height) $ThisImage = 0 GUICtrlSetData($ImagesGuiArray[4], "Image 1 of "&UBound($PImagesArray)) Return EndFunc Func _NextImage() GUICtrlSetState($ImagesGuiArray[1], 255) $ThisImage += 1 GUICtrlSetData($ImagesGuiArray[4], "Image "&$ThisImage&" of "&UBound($PImagesArray)) If StringLeft($PImagesArray[$ThisImage], 4) = 'http' Then InetGet($PImagesArray[$ThisImage], @TempDir&"\Pic.jpg", 16, 0) Else FileDelete(@TempDir&"\Pic.jpg") FileWrite(@TempDir&"\Pic.jpg", FileRead($ImagesDirectory&"\"&$PNum&" "&$ThisImage&".jpg")) EndIf $Image = _GDIPlus_ImageLoadFromFile(@TempDir&"\Pic.jpg") $Width = _GDIPlus_ImageGetWidth($Image) $Height = _GDIPlus_ImageGetHeight($Image) If $Width > $Height Then $Height = 600*($Height/$Width) $Top = 300 - (0.5*$Height) $Width = 600 $Left = 0 ElseIf $Height > $Width Then $Width = 600*($Width/$Height) $Left = 300 - (0.5*$Width) $Height = 600 $Top = 0 Else $Left = 0 $Top = 0 $Height = 600 $Width = 600 EndIf _GDIPlus_ImageDispose($Image) GUICtrlDelete($Pic) $Pic = GUICtrlCreatePic(@TempDir&"\Pic.jpg", $Left, $Top, $Width, $Height) If $ThisImage = UBound($PImagesArray)-1 Then GUICtrlSetState($ImagesGuiArray[3], 128) EndIf Return EndFunc Func _EditImage() Local $Label, $ImageURL GUICtrlDelete($Pic) $Label = GUICtrlCreateLabel("Waiting for Microsoft Paint to close.", 220, 290) RunWait("mspaint "&@TempDir&"\Pic.jpg", @TempDir, @SW_SHOW) $PImagesArray[$ThisImage] = $ImagesDirectory&"\"&$PNum&" "&$ThisImage&".jpg" FileDelete($ImagesDirectory&"\"&$PNum&" "&$ThisImage&".jpg") FileWrite($ImagesDirectory&"\"&$PNum&" "&$ThisImage&".jpg", FileRead(@TempDir&"\Pic.jpg")) $Image = _GDIPlus_ImageLoadFromFile(@TempDir&"\Pic.jpg") $Width = _GDIPlus_ImageGetWidth($Image) $Height = _GDIPlus_ImageGetHeight($Image) If $Width > $Height Then $Height = 600*($Height/$Width) $Top = 300 - (0.5*$Height) $Width = 600 $Left = 0 ElseIf $Height > $Width Then $Width = 600*($Width/$Height) $Left = 300 - (0.5*$Width) $Height = 600 $Top = 0 Else $Left = 0 $Top = 0 $Height = 600 $Width = 600 EndIf _GDIPlus_ImageDispose($Image) $Pic = GUICtrlCreatePic(@TempDir&"\Pic.jpg", $Left, $Top, $Width, $Height) GUICtrlDelete($Label) EndFunc Func _PrevImage() GUICtrlSetState($ImagesGuiArray[3], 255) $ThisImage -= 1 GUICtrlSetData($ImagesGuiArray[4], "Image "&$ThisImage&" of "&UBound($PImagesArray)) If StringInStr($PImagesArray[$ThisImage], 'http') Then InetGet($PImagesArray[$ThisImage], @TempDir&"\Pic.jpg", 16, 0) Else FileDelete(@TempDir&"\Pic.jpg") FileWrite(@TempDir&"\Pic.jpg", FileRead($ImagesDirectory&"\"&$PNum&" "&$ThisImage&".jpg")) EndIf $Image = _GDIPlus_ImageLoadFromFile(@TempDir&"\Pic.jpg") $Width = _GDIPlus_ImageGetWidth($Image) $Height = _GDIPlus_ImageGetHeight($Image) If $Width > $Height Then $Height = 600*($Height/$Width) $Top = 300 - (0.5*$Height) $Width = 600 $Left = 0 ElseIf $Height > $Width Then $Width = 600*($Width/$Height) $Left = 300 - (0.5*$Width) $Height = 600 $Top = 0 Else $Left = 0 $Top = 0 $Height = 600 $Width = 600 EndIf _GDIPlus_ImageDispose($Image) GUICtrlDelete($Pic) $Pic = GUICtrlCreatePic(@TempDir&"\Pic.jpg", $Left, $Top, $Width, $Height) If $ThisImage = 0 Then GUICtrlSetState($ImagesGuiArray[1], 128) EndIf Return EndFunc Func _Price($FinalPrice) $FinalPrice = 1.3*$FinalPrice If $FinalPrice > 15 Then Local $FinalPriceArray = StringSplit($FinalPrice, ".", 3) If UBound($FinalPriceArray) = 1 Then _ArrayAdd($FinalPriceArray, 0) EndIf If StringRight($FinalPriceArray[0], 1) & "." & $FinalPriceArray[1] >= 2.45 And StringRight($FinalPriceArray[0], 1) & "." & $FinalPriceArray[1] < 7.45 Then $FinalPrice = StringLeft($FinalPriceArray[0], StringLen($FinalPriceArray[0])-1)&"4.95" Else If StringRight($FinalPriceArray[0], 1) > 5 Then $FinalPrice = StringLeft($FinalPriceArray[0], StringLen($FinalPriceArray[0])-1)&"9.95" Else $FinalPrice = (StringLeft($FinalPriceArray[0], StringLen($FinalPriceArray[0])-1)&"9.95")-10 EndIf EndIf EndIf ;~ MsgBox(0,"",$FinalPrice) Return $FinalPrice EndFunc Func _GetSearchTags($SearchTags) Local $DontAllow[4] = [" ", ",", "-", "&amp"] For $Repeat = 0 To UBound($DontAllow)-1 $SearchTags = StringReplace($SearchTags, $DontAllow[$Repeat], "|") Next While StringInStr($SearchTags, "||") $SearchTags = StringReplace($SearchTags, "||", "|") WEnd Return $SearchTags EndFunc Func _GetSEOKeywords($Keywords) Local $DontAllow[4] = [" ", ",", "-", "&amp"] For $Repeat = 0 To UBound($DontAllow)-1 $Keywords = StringReplace($Keywords, $DontAllow[$Repeat], ",") Next While StringInStr($Keywords, ",,") $Keywords = StringReplace($Keywords, ",,", ",") WEnd Return $Keywords EndFunc Func _Exit() Switch @GUI_WinHandle Case $GuiArray[0] Exit Case $ImagesGuiArray[0] GUIDelete($ImagesGuiArray[0]) _CreateGUI() Case $ProdNumGuiArray[0] $Exit = MsgBox(4,"Exit Now?", "Are you sure you want to exit?") If $Exit = 6 Then Exit Else Return EndIf Case Else GUIDelete(@GUI_WinHandle) ;DataGuiArray[0] EndSwitch EndFunc Func _OnExit() GUIDelete($GuiArray[0]) _GDIPlus_Shutdown() EndFunc Func _Delivery($Main) Local $Delivery ;$Delivery = StringTrimLeft($PMain, StringInStr($PMain, '<p class=delivery>', 0)+36) ;$Delivery = StringTrimRight(StringTrimLeft($Delivery, StringInStr($Delivery, "$")-1), StringLen($Delivery)-StringInStr($Delivery, ".")-2) Local $Delivery = StringRegExp($Main, '<P class=delivery>([\S\s]*?)<\/P>', 1) $Delivery = StringRegExp($Delivery[0], '<STRONG>([\S]+)<\/STRONG>', 1) $Delivery[0] = StringTrimLeft($Delivery[0], 1) ;~ MsgBox(0,"",$Delivery[0]) Return $Delivery[0] EndFunc Func _GetSEODescription($Desc2) $Desc2 = _HTML2PlainText($Desc2);StringRegExpReplace($Desc2, "(<[^>]+?>)", "") $Desc2 = _RemExtraLineBreaks($Desc2);StringReplace($Desc2, @CRLF&@CRLF, @CRLF, 0) Return $Desc2 EndFunc Func _HTML2PlainText($sHtml) $sHtml = StringRegExpReplace($sHtml, "<br[^>]*\/>", @CRLF) $sHtml = StringRegExpReplace($sHtml, "<\/?p[^>]*>", @CRLF & @CRLF) $sHtml = StringRegExpReplace($sHtml, '(<[^>]+>)', '') Return $sHtml EndFunc Func _RemExtraLineBreaks($sTxt) $sTxt = StringRegExpReplace($sTxt, "[\s][\s]+", @CRLF) Return $sTxt EndFunc Func _IsURL($URL) Select Case StringInStr($URL, ".com") Return True Case StringInStr($URL, ".net") Return True Case StringInStr($URL, ".org") Return True Case StringInStr($URL, ".gov") Return True Case StringInStr($URL, ".edu") Return True Case StringInStr($URL, ".biz") Return True Case Else Return False EndSelect EndFunc Func _Restart() GUIDelete($GuIArray[0]) _Start() EndFunc Does anybody have the same problem? Thanks.
  8. I really want to make a GUI that when you type a text in the Input box and click a button a Notepad should pop up and the text you wrote in the GUI input box appears in the Notepad. I've tried this for an hour now and could not figure out how to do it correctly. It seems that it's giving me errors and when I'm correcting those errors I'm getting no where. Please help modify my code below: Thank You.
  9. Hey all So I was trying to change a file name using FileMove, but it didn't work for me. (Maybe I just didn't use it in the right way?) Is there another way to change a file name? Thank you!
×
×
  • Create New...