Jump to content

New at AutoIt


Recommended Posts

Hi guys,

Just need help understanding how to tell the script that once it gets to the msgbox "cancel", "are you sure?" if the user presses 'no' instead of yes, what script do I need to then get it to go back to the first inputbox "$seanum"?

something like: If Msgbox(4, "cancel", "are you sure?") = 7 Then __________ <--- what goes here to get it back to the first inputbox?

WEnd

$grey0 = ""
$greys = "Greys Anatomy - Season "
$greys2 = " Episode "
$fin = 2
While $fin = 2
$seanum = InputBox("Giggy Launcher v1.0 - TV Series", "Greys Anatomy - Input Season number", "Type Season Number")
If @error = 1 Then
If MsgBox(4, "cancel","are you sure?") = 6 Then Exit
EndIf
$seaep = InputBox("Giggy Launcher v1.0 - TV Series", "Greys Anatomy - Input Episode number", "Type Episode Number")
If @error = 1 Then
If MsgBox(4, "cancel","are you sure?") = 6 Then Exit
EndIf
$fin = MsgBox(1, "Giggy Launcher v1.0 - TV Series", $greys & $seanum & $greys2 & $seaep)
If @error = 1 Then
If MsgBox(4, "cancel","are you sure?") = 6 Then Exit
EndIf
WEnd

Thanks

Link to comment
Share on other sites

Hi reecedorward,

an easy way would be to use the "ContinueLoop" statement. It will just do another loop and -a s to say for your script just start over again.

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

Hi guys, Thanks for your help so far!

JohnOne, I tried a similar approach to your method, I did as follows:

If MsgBox(4, "cancel","are you sure?") = 6 Then Exit

If MsgBox(4, "cancel","are you sure?") = 7 Then ContinueLoop

EndIf

With that script, I think it either went to the second InputBox "$seaep" OR it just brought up the exact same MsgBox... Never went back to the first InputBox

I think with VBScript the <> means 'other' but not too sure if it works in AutoIt? Correct me if I'm wrong?

Is there a function like "goto"? so then I could write something like:

If MsgBox(4, "cancel","are you sure?") = 7 Then Goto $seanum

EndIf

???

Thanks for your help guys, Keep the help comin'!

Link to comment
Share on other sites

Hi,

the "<>" indeed is the same as VB "<>" or in other languages "!=".

There is no such thing like "GOTO" in AutoIT.

You should start reading the helpfile. A good place to start there would be the chapter about functions. ;)

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

What version are you using?

I think I recall a bug with 'continueloop' being on the same line as 'Then' is one version.

So try

If ... Then

...

EndIf

or a switch ...case...endswitch

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

The continueloop in a single if statement is indeed fixed in the latest betas.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Thanks again guys,

I have read into the help file, though I suppose being new at AutoIt... I don't really know what I'm looking for or if what I'm looking for even exists lol

So I have just tried this:

If MsgBox(4, "cancel","are you sure?") <> 6 Then ContinueLoop

EndIf

THAT WORKS! Though now I need to tell it that If they press Yes or in coding terms '7' then to Exit..

I'm using version 2.28.... Is that the latest?

Link to comment
Share on other sites

Is there a way to tell the script that if the user presses YES on a MsgBox... to go to another certain part of script or to like another MsgBox within the script?

So say you have, for example, 6 MsgBoxes named A B C D E F (and thats the order that they're written in the script)

If the user is on MsgBox 'E' and the question was 'Did you want to goto MsgBox B?' and if the user Presses YES.. what would be the function to make the script go back to MsgBox 'B'?

Hard to explain....

Link to comment
Share on other sites

Yes Functions.

Switch MsgBox(4,"MsgBox","Text")
Case 6
  _Yes()
Case 7
  _No()
Case Else
  Exit
EndSwitch


Func _Yes()
  MsgBox(0,"MsgBox","Yes")
EndFunc


Func _No()
  MsgBox(0,"MsgBox","No")
EndFunc
Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I am still having trouble guys..

Yes Functions.

Switch MsgBox(4,"MsgBox","Text")
Case 6
  _Yes()
Case 7
  _No()
Case Else
  Exit
EndSwitch


Func _Yes()
  MsgBox(0,"MsgBox","Yes")
EndFunc


Func _No()
  MsgBox(0,"MsgBox","No")
EndFunc

I loaded this script up and it works fine, but it doesn't quite help me with where I want my script to go, or atleast I cannot see how I could use it in my script...
Link to comment
Share on other sites

Ok so I am going to try and explain this again... sorry about all the confusion, but perhaps this will make it easier to understand as to what im trying to achieve:

--------------------------------------------------

$greys = "Greys Anatomy - Season "

$greys2 = " Episode "

$fin = 2

While $fin = 2

$seanum = InputBox("Giggy Launcher v1.0 - TV Series", "Greys Anatomy - Input Season number", "Type Season Number")

If @error = 1 Then

If MsgBox(4, "cancel", "are you sure?") = 6 Then Exit

EndIf

From here if the user clicks YES it terminates the script, if the user clicks NO I want to be able to bring the first inputbox "$seanum" back up... Currently if the user clicks NO, the script continues to goto "$seaep" (below)

$seaep = InputBox("Giggy Launcher v1.0 - TV Series", "Greys Anatomy - Input Episode number", "Type Episode Number")

If @error = 1 Then

If MsgBox(4, "cancel", "are you sure?") = 6 Then Exit

EndIf

From here the same thing happens as before.. If the user clicks NO I need it to still go back to the first inputbox "$seanum"

$fin = MsgBox(1, "Giggy Launcher v1.0 - TV Series", $greys & $seanum & $greys2 & $seaep)

If @error = 1 Then

If MsgBox(4, "cancel", "are you sure?") = 6 Then Exit

EndIf

WEnd

------------------------------------------------

Reasons being, if the user types in the wrong season number or the wrong episode number and needs to choose the numbers again, I need the script to get it to start back at the beginning or the first inputbox

Your help is much appreciated! ;)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...