Sign in to follow this  
Followers 0
ReconX

Using "InetGet" with if statements

17 posts in this topic

#1 ·  Posted (edited)

I am a beginner to AutoIt. 

I am trying to get "InetGet" to work with a Checkbox when a button is clicked. This is what I have so far.

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <InetConstants.au3>

$hGUI = GUICreate("FixIt GUI", 650, 650, -1, -1)
$hTab = GUICtrlCreateTab(5, 5, 640, 640)
GUICtrlCreateTabItem("Virus Removal Software ")
$hButton = GUICtrlCreateButton("Download Selected", 220, 590, 270, 40)
$hCheckbox = GUICtrlCreateCheckbox("ComboFix", 270, 140, 130, 30)
GUICtrlSetFont(-1, 9, 800, 0)

GUICtrlCreateTabItem("")
$hCheckbox2 = GUICtrlCreateCheckbox("Eset", 270, 178, 130, 30)
GUICtrlSetFont(-1, 8.5, 800, 0)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            If GUICtrlRead($hCheckbox) = $GUI_CHECKED Then

                Local $dDirCreate

                DirCreate(@DesktopCommonDir & "\Virus Removal\")
                DirCreate(@DesktopCommonDir & "\Virus Removal\1- Combofix\")
                
                Local $sDownload
                                
            EndIf
        EndSwitch
WEnd

Help would be appreciated. xD

Edited by ReconX

Share this post


Link to post
Share on other sites



Just add:

InetGet("Http://www.urlhe.re/subdirectory/file.exe", @DesktopCommonDir & "\Virus Removal\1- Combofix\file.exe")

After

Local $sDownload

This will download file.exe...Or is there something else you're trying to attempt?


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

For Checkbox, Radio control several states can be returned. So use i.e. BitAND(GUICtrlRead($Item), $GUI_CHECKED) to test if the control is checked.

Thus saith the helpfile  :)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

For Checkbox, Radio control several states can be returned. So use i.e. BitAND(GUICtrlRead($Item), $GUI_CHECKED) to test if the control is checked.

Thus saith the helpfile  :)

It's not necessary to do that, the help file is mistaken in this reference. A checkbox has 3 returns, and it only ever returns one of them at a time. Using GUICtrlGetState it might be that way, but not with GUICtrlRead. The three possible results of using GUICtrlRead on a checkbox are $GUI_CHECKED, $GUI_UNCHECKED and $GUI_INDETERMINATE.

BTW, the help file example for GUICtrlGetState uses GUICtrlRead($n) for the checkbox example ($n is the checkbox control ID).

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Then it would be a good idea to update the GuiCtrlRead page in the helpfile   :)

Share this post


Link to post
Share on other sites

mikell,

 

For Checkbox and Radio controls only the checked, unchecked or indeterminate states are returned - so the value can be used directly.

Happy with that text? :)

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

What about adding the constants in parenthesis as well e.g. checked ($GUI_CHECKED), unchecked ($GUI_UNCHECKED) etc..? Just an idea I had.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

Guinness,

 

For Checkbox and Radio controls only the $GUI_CHECKED (1), $GUI_UNCHECKED (4) or $GUI_INDETERMINATE (2) states are returned so the value can be used directly.

In that case I feel we ought to add some magic numbers as well. ;)

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

I just threw it in my mouth! Thanks Melba23.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

All done. :)

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

#12 ·  Posted (edited)

Melba, it's wonderful  :)

Edited by mikell

Share this post


Link to post
Share on other sites

I appreciate the help, but I can't seem to get it to work still. I have the code as follows:

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <InetConstants.au3>

$hGUI = GUICreate("FixIt GUI", 650, 650, -1, -1)
$hTab = GUICtrlCreateTab(5, 5, 640, 640)
GUICtrlCreateTabItem("Virus Removal Software ")
$hCheckbox = GUICtrlCreateCheckbox("ComboFix", 270, 140, 130, 30)
$hButton = GUICtrlCreateButton("Download Selected", 220, 590, 270, 40)
GUICtrlSetFont(-1, 9, 800, 0)

GUICtrlCreateTabItem("")
$hCheckbox2 = GUICtrlCreateCheckbox("Eset", 270, 178, 130, 30)
GUICtrlSetFont(-1, 8.5, 800, 0)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            If GUICtrlRead($hCheckbox) = 1 Then
                InetGet("http://download.bleepingcomputer.com/dl/a1e7b60ed7d85c7f08c6c44d854584b4/5356044d/windows/security/anti-virus/c/combofix/ComboFix.exe", @DesktopCommonDir & "\Combo.exe")
                Local $sDownload
            EndIf
        EndSwitch
WEnd

From what I am understanding is that this is supposed to download the "ComboFix.exe" from the link to my desktop when the Combofix checkbox is checked, and the button is clicked. Am I not doing something right, or am I just not understanding. :P 

What I am trying to do is, when you select the program you want to download, via the check boxes, and click the download button, it downloads from the specified link into whatever directory that was specified.

Share this post


Link to post
Share on other sites

From: download.bleepingcomputer.com

The Download link has expired!

The links to our downloads expire after 10 minutes. You will be redirected in three seconds to the proper page to download the program.


"Today's scientists have substituted mathematics for experiments, and they wander off through equation after equation, and eventually build a structure which has no relation to reality." ~ Nikola Tesla

Share this post


Link to post
Share on other sites

Try downloading from a site that doesn't constantly change it's download pages, that'll fix your problem.


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

I don't want to resume a old (?) thread but me too I have to download files (and combofix !) from temporary links.

For Combofix I have found in this forum: http://www.bleepingcomputer.com/forums/t/356979/ftpwget-download-combofix/

this advice :

it is a variable type "Content from URL (start/end)" on the URL "http://www.bleepingcomputer.com/download/anti-virus/combofix"
 
on the pages code I have marked it out as follows:
 
[start]<td width='20%'><b>BleepingComputer Mirror:</b></td>
[end]" class="goodurl">ComboFix Download Link</a></td>[/end]
select the text in between the [start] brackets for the start marker,
and select the text in-between the [end] brackets for the end marker.
 
How to adapt this in AutoIt ? Maybe something from  #include <IE.au3> ?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0