Jump to content

Search the Community

Showing results for tags 'exit'.



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

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 14 results

  1. Hi all, I'm working on a relatively complex automation program and I need it to call a specific function when it is closed by a user. Ive resorted to "OnAutoItExitRegister" as i believe that's the only option available. This command works perfectly fine in a small scale test application I wrote, but once implemented in the final program that's much larger and divided over many files in many directories it no longer works. I don't get any error messages. My question is has anyone encountered an issue where implementation of this command in a large scale program gave them trouble? Does it matter where "OnAutoItExitRegister" is called and where the function is located? Currently they are both places in the main file that runs the whole program but it still doesn't work. Any help is appreciated
  2. I have created an exit function and registered using OnAutoItExitRegister.But it is not running when I close the app from taskbar or even with normal exit during end. Below is the part of code and the included files. #include <MsgBoxConstants.au3> #include <FileConstants.au3> #include <WinAPIFiles.au3> #include <Date.au3> #include <file.au3> #include <Array.au3> #include <String.au3> OnAutoItExitRegister("Exit_Program") Func Exit_Program() LoggingMainScr("Entered Exit_Program") Local $exitmethod = ["Natural closing", "close by Exit function", "close by clicking on exit of the systray","close by user logoff","close by Windows shutdown"] ExitProgram("Exit with exit code: "& @exitCode & " And because of: " & $exitmethod[@exitmethod],@exitmethod) EndFunc Func ExitProgram($sReason="Exit by user",$sCode=0) LoggingMainScr($sReason) if $sCode <> 0 then LoggingMainScr("stopped before completion") FileDelete(@ScriptDir&"\Machines*.txt") FileDelete(@ScriptDir&"\PsExec.exe") FileDelete(@ScriptDir&"\HyperVMachines.ps1") FileDelete(@ScriptDir&"\VMwareMachines.ps1") EndFunc Func LoggingMainScr($sMessage) LoggingDefault($sMessage,@ScriptDir&"\MainScr_Logging.log") EndFunc Func LoggingDefault($sMessage,$sLogFile=@ScriptDir&"\Logging.log") If $sMessage = "" Then FileWriteLine($sLogFile, "") Else FileWrite($sLogFile,_NowCalc() & " :: " & $sMessage&@CRLF) EndIf EndFunc Any suggestion.
  3. So I have a lot of different functions in the little program I'm making. Most of them use the Do statement, such as finding images, clicking buttons, etc. The question I have is how would I be able to both 1) Create a hotkey to pause whatever I am doing at the moment. If I have to put something into every function in the program, I don't mind. 2) Create a hotkey to exit whatever I am doing and stop all loops or commands and bring back the main GUI?
  4. For some reason my personal notes were omitted when posting. Still a Newb it seems! So have attached my slightly modified example. If I comment out Exit button references script will not Exit even with windows 'X' button icon. If I'm losing GUI/Tab focus I cannot see where is the difference with(out) definition. GUI_No_Exit.au3
  5. Hi all, Ctrl+Break stops script only if AutoIt window is active. It doesn't work while automation is going on elsewhere. Is there a way to stop the script regardless of where the automation is happening? Thanks
  6. Hi everyone! I'm developing small testing tool for new software in my company. Tool itself is working correctly (it follows scripted test commands one by one), but I'm trying to develop an error checking function. Mechanics are simple: every time software (external) shows specific error (via window class), program asks for next step. Continue, or abort test (and return to main GUI)? The error check function is switched on/off via Checkbox in GUI. Here are some code fragments: Checkbox: Global $idCheckbox1 = GUICtrlCreateCheckbox("Enable TP.net error handling", 352, 40, 249, 17) GUICtrlSetFont(-1, 12, 400, 0, "Calibri") GUICtrlSetColor(-1, 0x000000) Checkbox switch: GUISetState(@SW_SHOW) Local $Choosen While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idCheckbox1 If _IsChecked($idCheckbox1) Then $cSwitch1 = 1 Else $cSwitch1 = 0 EndIf Case $idAddTest (and so on...) Function call: (alot of ElseIf commands...) ElseIf $aItem = $idOperatorIn Then WywolanieOkna() WinActivate($hFSO) ControlClick($hFSO, "", "[NAME:lblCashierNumber]") Sleep($Sleep_05) Send("0000019{Enter}19{Enter 2}") Sleep($Sleep_75) EndIf #EndRegion ### START ELSEIF ARMY ### Next If $cSwitch1 = 1 Then MsgBox( 0, "Error check!", "Error check ON!") /// just for testing purposes CheckError() Else Return EndIf EndSwitch WEnd Classic _IsChecked function: Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked And Checkerror() function itself: Func CheckError() Local $Answer If ControlCommand($hMsgPanel, "", "[NAME:panelMsgBox]", "IsEnabled", "") Then ;~ Sleep($Sleep_05) $Answer = MsgBox(52, "Error!", "An error occured! Continue testing?") ;~ Sleep($Sleep_05) Switch $Answer Case 6 MsgBox(0, "Error!", "Test will now continue.", 3) Send("{Enter}") WinActivate($hWnd) Return Case 7 MsgBox(64, "Error!", "Test cancelled.", 5) $ElseIfArmyOff = 1 ControlClick($hMsgPanel, "", "[NAME:cmdOK]") WinActivate($AppName) #cs MsgBox( 0, "test1", $idTSList) Local $idTSListCopy For $i = 0 to _GUICtrlListView_GetItemCount($idTSList) - 1\ #ce $idTSListCopy = _GUICtrlListView_GetItemTextString($idTestCaseList, $LoopCount) ExitLoop EndSwitch EndIf Return 1 EndFunc ;==>CheckError Problem is: i can't make this function (CheckError() ) return to main gui state, that means: break the If/ElseIf loop. The switch is working correctly (MsgBox on error shows only when it's activated). Checkerror() function works correctly - recognizes the error, stops script until decision is made. But it doesn't terminate If/ElseIf loop. Any help appreciated!
  7. Hi Guys, I have written a little loop program that counts to whatever you choose in "Rounds". (this is just a short version of my program, but it should cover what I try to achieve) I now want to be able to stop the counting by pressing the start/stop button. Unfortunately, autoit only registers my click on my button AFTER the func has ended. Do you guys have an idea how to stop the function? Maybe check if button was pressed in the loop? Thanks, Comboku #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <IE.au3> #include <Array.au3> #include <File.au3> $Form1 = GUICreate("Looper", 355, 229, 435, 293) $StartStop = GUICtrlCreateButton("Start", 136, 184, 75, 25) $Rounds = GUICtrlCreateInput("1", 210, 40, 80, 21) $lRounds = GUICtrlCreateLabel("Rounds", 298, 42, 52, 18) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $StartStop If GUICtrlRead($StartStop) = "Start" Then GUICtrlSetData($StartStop, "Stop") GUICtrlSetState($Rounds, $GUI_DISABLE) Call("Loop") ElseIf GUICtrlRead($StartStop) = "Stop" Then ExitLoop MsgBox(0, "Info", "Stopped") Else MsgBox(0, "Info", "Error") EndIf Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Loop() $LoopTimes = GUICtrlRead($Rounds) For $i = 1 To $LoopTimes MsgBox(0, "Info", "LET US COUNT: " & $i) Sleep("2000") Next GUICtrlSetData($StartStop, "Start") GUICtrlSetState($StartStop, $GUI_ENABLE) GUICtrlSetState($Rounds, $GUI_ENABLE) EndFunc
  8. Is there any way to retrieve the exit code from a process while also being able to use StdoutRead/StderrRead?
  9. Hi, Here is a script which destroys the AutoIt Window, there is many issues that can understand and fix except that the application won't exit with the Exit code. Is there any way to "redirect" the exit code to terminate the application? There should be a main function in the internal autoit code, no way to make it exit? Here is the script : ;you will need to kill the autoit3 process. #include <WinAPI.au3> #include <Constants.au3> #include <WindowsConstants.au3> Global $_hWndProc = DllCallbackRegister("WM_HANDLER", "int", "hwnd;int;wparam;lparam") AutoItWinSetTitle("Wndtmp_") $hWnd = WinGetHandle("Wndtmp_") _WinAPI_SetWindowLong($hWnd, $GWL_WNDPROC, DllCallbackGetPtr($_hWndProc)) _WinAPI_DestroyWindow($hWnd) ;also destroys: ;tray icon, hotkeys, wm messages (in particular Exit), more things? Exit ;does not work Func WM_HANDLER($hWnd, $iMsg, $wParam, $lParam) Switch $iMsg Case $WM_CLOSE Return False EndSwitch Return _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>WM_HANDLER My purpose for this is insignificant, but I would be interested to know if it's possible. Br, FireFox.
  10. Hi All, I have written some script that scans every folder down from a given directory and determines if any new folders have come into existence. I used it to scan a release server to determine when new revisions of source have been compiled into a stable version. If the script does not detect any new files, it Exits with Exit Code 1 (This is so that Jenkins knows to fail the given job, and not continue to the next job). When I test the code on my local machine, a Windows 7 unit, Everything works normally and the exit code exits as "1", however when I run it on my windows 8 test system, The application immediately returns 0, and then a few seconds later actually runs (I can verify this is what's happening because of the files it generates, and the logging I create.) What's even more annoying is that I have other Auto IT applications that work just find on the Windows8 unit, and Exit with whatever ExitCode I give them. Is there something I may have set in the code that delays it running?
  11. Hey folks, I have written a small script that stops a service and waits a predefined time for it to actually be stopped. This script is compiled in CLI mode and is run by our scheduling system. The output of the script indicates, that the service is stopped: C:WINDOWSsystem32>C:jobsUniverseStopService.exe server1 servicex 300 Starting (Version 1.0.0.7) C:\Windows\System32\cmd.exe /c sc server1 query "servicex" | find /C /I "state" Message after 0s: 0 Message after 1s: 0 Message after 2s: 0 Message after 3s: 0 Message after 4s: 0 Message after 5s: 0 Message after 6s: 0 Message after 7s: 0 Message after 8s: 1 Service stopped Successfully This is the code part with the message: If $b_stopped Then ConsoleWrite("Service stopped Successfully" & @CRLF) Exit 0 Else Pretty obious that the script should end and set the returncode to "0", isn't it? Yes, but the script doesn't stop after that. In some unregular cases (different executions, differrent servers) these scripts just keep on executing. They just don't stop. Has anyone an idea what might go wrong here?
  12. Seem pretty simple enough but I can do it properly. So here is the code first: Local $ordi = InputBox( "VNCViewer - Script", "Entrez votre Addresse Ip ou le nom de hote") Run( "C:\Program Files\UltraVNC\vncviewer.exe" & " " & $ordi & " " & "-password 1111") If @error = 1 Then Exit; exit if cancel pressed What happens: when script is started, I press cancel to exit the script but when I do, vnc pop's up. What I want to happen: when cancel is pressed, it exits the script without opening vnc. Again, any help will be appreciated. Thanks guys
  13. 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.
  14. I have this small script: #include <ButtonConstants.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <NoFocusLines.au3> #include <ScreenCapture.au3> #include <SliderConstants.au3> #include <Misc.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt( "GUIOnEventMode" , 1 ) HotKeySet( "{UP}" , "_Up" ) HotKeySet( "{DOWN}" , "_Down" ) HotKeySet( "{LEFT}" , "_Left" ) HotKeySet( "{RIGHT}" , "_Right" ) Global $x = MouseGetPos( 0 ) , $y = MouseGetPos( 1 ) , $pos , $win_pos , $msg , $split , $old_x , $old_y , $zoom = 8 , $color = "F0F0F0" , $pause = False , $dll[ 2 ] $dll[ 0 ] = DllOpen( "user32.dll" ) $dll[ 1 ] = DllOpen( "gdi32.dll" ) $gui = GUICreate( "Cursor Info" , 285 , 390 , @DesktopWidth - 297 , 6 , Default , $WS_EX_TOPMOST ) $paused = GUICtrlCreateLabel( "Paused: " & $pause , 10 , 10 , 200 , 15 ) $cursor_position = GUICtrlCreateLabel( $x & " : " & $y , 10 , 30 , 60 , 15 ) $cursor_position_x = GUICtrlCreateButton( "Copy X co-ordinate" , 70 , 26 , 100 , 20 ) GUICtrlSetOnEvent( $cursor_position_x , "_Cursor_Position_X" ) $cursor_position_y = GUICtrlCreateButton( "Copy Y co-ordinate" , 175 , 26 , 100 , 20 ) GUICtrlSetOnEvent( $cursor_position_y , "_Cursor_Position_Y" ) $cursor_area = GUICtrlCreateLabel( "0 : 0" , 10 , 50 , 60 , 15 ) $cursor_area_x = GUICtrlCreateButton( "Copy X co-ordinate" , 70 , 46 , 100 , 20 ) GUICtrlSetOnEvent( $cursor_area_x , "_Cursor_Area_X" ) $cursor_area_y = GUICtrlCreateButton( "Copy Y co-ordinate" , 175 , 46 , 100 , 20 ) GUICtrlSetOnEvent( $cursor_area_y , "_Cursor_Area_Y" ) $cursor_color = GUICtrlCreateLabel( "" , 10 , 70 , 60 , 15 ) $cursor_color_example = GUICtrlCreateLabel( "" , 70 , 70 , 100 , 15 ) $cursor_color_copy = GUICtrlCreateButton( "Copy color value" , 175 , 66 , 100 , 20 ) GUICtrlSetOnEvent( $cursor_color_copy , "_Cursor_Color_Copy" ) $zoom_level = GUICtrlCreateSlider( 3 , 90 , 175 , 20 , $TBS_NOTICKS ) _NoFocusLines_Set( $zoom_level ) GUICtrlSetLimit( $zoom_level , 15 , 1 ) GUICtrlSetData( $zoom_level , 16 - $zoom ) $zoom_label = GUICtrlCreateLabel( "Zoom level: " & GUICtrlRead( $zoom_level ) , 180 , 92 , 70 , 15 ) $magnifier = GUICreate( "" , 264 , 264 , @DesktopWidth - 285 , 145 , $WS_POPUP + $WS_BORDER , Default , $gui ) GUIRegisterMsg( $WM_HSCROLL , "_Zoom" ) GUIRegisterMsg( $WM_MOVE , "_Drag" ) ;~ GUISetOnEvent( $GUI_EVENT_CLOSE , "_Esc" , $magnifier ) GUISetOnEvent( $GUI_EVENT_CLOSE , "_Esc" , $gui ) GUISetState( @SW_SHOW , $gui ) GUISetState( @SW_SHOW , $magnifier ) While 1 $pos = MouseGetPos() If Not $pause Then $old_x = $pos[ 0 ] $old_y = $pos[ 1 ] _Update() EndIf If _IsPressed( "02" , $dll[ 0 ] ) Then While _IsPressed( "02" , $dll[ 0 ] ) Sleep( 100 ) WEnd $pause = Not $pause GUICtrlSetData( $paused , "Paused: " & $pause ) EndIf If $pos[ 0 ] <> $x OR $pos[ 1 ] <> $y Then If Not WinActive( $gui ) Then WinActivate( $gui ) GUICtrlSetState( $zoom_level , $GUI_FOCUS ) $x = $pos[ 0 ] $y = $pos[ 1 ] If Not $pause Then GUICtrlSetData( $cursor_position , $x & " : " & $y ) If StringRight( Hex( PixelGetColor( $x , $y ) ) , 6 ) <> "0x" & $color Then $color = "0x" & StringRight( Hex( PixelGetColor( $x , $y ) ) , 6 ) GUICtrlSetData( $cursor_color , $color ) GUICtrlSetBkColor( $cursor_color_example , $color ) EndIf EndIf EndIf If Not $pause And _IsPressed( "01" , $dll[ 0 ] ) Then $x_1 = MouseGetPos( 0 ) $y_1 = MouseGetPos( 1 ) While _IsPressed( "01" , $dll[ 0 ] ) If _IsPressed( "02" , $dll[ 0 ] ) Then While _IsPressed( "02" , $dll[ 0 ] ) Sleep( 100 ) WEnd $pause = Not $pause GUICtrlSetData( $paused , "Paused: " & $pause ) EndIf If MouseGetPos( 0 ) <> $x OR MouseGetPos( 1 ) <> $y Then $x = MouseGetPos( 0 ) $y = MouseGetPos( 1 ) GUICtrlSetData( $cursor_position , $x & " : " & $y ) If StringRight( Hex( PixelGetColor( $x , $y ) ) , 6 ) <> "0x" & $color Then $color = "0x" & StringRight( Hex( PixelGetColor( $x , $y ) ) , 6 ) GUICtrlSetData( $cursor_color , $color ) GUICtrlSetBkColor( $cursor_color_example , $color ) EndIf EndIf If MouseGetPos( 0 ) <> $x_1 OR MouseGetPos( 1 ) <> $y_1 Then $old_x = MouseGetPos( 0 ) $old_y = MouseGetPos( 1 ) _Update() $x_1 = $pos[ 0 ] $y_1 = $pos[ 1 ] GUICtrlSetData( $cursor_area , Abs( $x_1 - $old_x ) & " : " & Abs( $y_1 - $old_y ) ) GUICtrlSetData( $cursor_position , $x_1 & " : " & $y_1 ) EndIf WEnd EndIf Sleep( 10 ) WEnd Func _Up() MouseMove( MouseGetPos( 0 ) , MouseGetPos( 1 ) - 1 , 0 ) EndFunc Func _Down() MouseMove( MouseGetPos( 0 ) , MouseGetPos( 1 ) + 1 , 0 ) EndFunc Func _Left() MouseMove( MouseGetPos( 0 ) - 1 , MouseGetPos( 1 ) , 0 ) EndFunc Func _Right() MouseMove( MouseGetPos( 0 ) + 1 , MouseGetPos( 1 ) , 0 ) EndFunc Func _Cursor_Position_X() $split = StringSplit( GUICtrlRead( $cursor_position ) , " : " , 1 ) ClipPut( $split[ 1 ] ) EndFunc Func _Cursor_Position_Y() $split = StringSplit( GUICtrlRead( $cursor_position ) , " : " , 1 ) ClipPut( $split[ 2 ] ) EndFunc Func _Cursor_Area_X() $split = StringSplit( GUICtrlRead( $cursor_area ) , " : " , 1 ) ClipPut( $split[ 1 ] ) EndFunc Func _Cursor_Area_Y() $split = StringSplit( GUICtrlRead( $cursor_area ) , " : " , 1 ) ClipPut( $split[ 2 ] ) EndFunc Func _Cursor_Color_Copy() $split = StringSplit( $color , "0x" , 1 ) ClipPut( $split[ 2 ] ) EndFunc Func _Zoom( $hWnd , $iMsg , $wParam , $lParam ) #forceref $hWnd, $iMsg, $wParam If $lParam = GUICtrlGetHandle( $zoom_level ) Then $zoom = 16 - GUICtrlRead( $zoom_level ) GUICtrlSetData( $zoom_label , "Zoom level: " & $zoom ) _Update() EndIf Return $GUI_RUNDEFMSG EndFunc Func _Drag( $hWnd , $iMsg , $wParam , $lParam ) $win_pos = WinGetPos( $gui ) WinMove( $magnifier , "" , $win_pos[ 0 ] + 12 , $win_pos[ 1 ] + 140 ) Return $GUI_RUNDEFMSG EndFunc Func _Update() $DeskHDC = DLLCall( $dll[ 0 ] , "int" , "GetDC" , "hwnd" , 0 ) $GUIHDC = DLLCall( $dll[ 0 ] , "int" , "GetDC" , "hwnd" , $magnifier ) If Not @error Then DLLCall( $dll[ 1 ] , "int" , "StretchBlt" , "int" , $GUIHDC[ 0 ] , "int" , 0 , "int" , 0 , "int" , 264 , "int" , 264 , "int" , $DeskHDC[ 0 ] , _ "int" , $old_x - 132 / $zoom / 2 + 1 , "int" , $old_y - 132 / $zoom / 2 + 1 , _ "int" , 132 / $zoom , "int" , 132 / $zoom , "long", $SRCCOPY ) DLLCall( $dll[ 0 ] , "int" , "ReleaseDC" , "int" , $DeskHDC[ 0 ] , "hwnd" , 0 ) DLLCall( $dll[ 0 ] , "int" , "ReleaseDC" , "int" , $GUIHDC[ 0 ] , "hwnd" , $magnifier ) $pen = DLLCall( $dll[ 1 ] , "hwnd" , "CreatePen" , "int" , 0 , "int" , 1 , "int" , 0x000000FF ) DLLCall( $dll[ 1 ] ,"hwnd","SelectObject", "hwnd", $GUIHDC[ 0 ] , "hwnd", $pen[ 0 ] ) DLLCall( $dll[ 1 ] , "int" , "MoveToEx" , "hwnd" , $GUIHDC[ 0 ] , "int" , 0 , "int" , 264 / 2 , "ptr" , 0 ) DLLCall( $dll[ 1 ] , "int" , "LineTo" , "hwnd" , $GUIHDC[ 0 ] , "int" , 264 , "int" , 264 / 2 ) DLLCall( $dll[ 1 ] , "int" , "MoveToEx" , "hwnd" , $GUIHDC[ 0 ] , "int" , 264 / 2 , "int" , 0 , "ptr" , 0 ) DLLCall( $dll[ 1 ] , "int" , "LineTo" , "hwnd" , $GUIHDC[ 0 ] , "int" , 264 / 2 , "int" , 264 ) EndIf EndFunc Func _Esc() ConsoleWrite( "before dll" & @CRLF ) DllClose( $dll[ 0 ] ) DllClose( $dll[ 1 ] ) ConsoleWrite( "before delete" & @CRLF ) GUIDelete( $magnifier ) ConsoleWrite( "before exit" & @CRLF ) Exit EndFunc If i run it from scite when i click the x button it doesn't exits, it just deletes the gui window but the process remains opened and i need to "Stop Executing" Why is that?
×
×
  • Create New...